class TYCiCore::ODMConfigModules
Attributes
content[RW]
Public Class Methods
new(config_path="./config_modules.json", pod_path="./Pods/")
click to toggle source
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 8 def initialize(config_path="./config_modules.json", pod_path="./Pods/") @config_path = config_path @pod_path = pod_path @content = config_hash end
Public Instance Methods
add_mix(key, value)
click to toggle source
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 14 def add_mix(key, value) mix = @content["mixMap"] if mix.nil? || mix.empty? mix = Hash[key => value] else mix[key]=value end @content["mixMap"]=mix end
remove_mix(key)
click to toggle source
def add_mix
(mixHash)
mix = @content["mixMap"] if mix.nil? || mix.empty? mix = mixHash else mix = mix.merge(mixHash) end
end
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 33 def remove_mix(key) @content["mixMap"].delete(key) end
save(target=@config_path)
click to toggle source
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 49 def save(target=@config_path) file_content = JSON.pretty_generate(@content) fh = File.new(target, "w") fh << file_content fh.close end
setup_modules()
click to toggle source
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 41 def setup_modules # 根据 pod目录生成 modules puts "ODM Setup #{@config_path} at #{@pod_path}".green modules = modules_in_pods @content["modules"] = modules end
update_config(key, value)
click to toggle source
# File lib/tuya/ci/core/config/odm_config_modules.rb, line 37 def update_config(key, value) @content[key]=value end