Class: CBin::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/cocoapods-pahealth-bin/config/config.rb,
lib/cocoapods-pahealth-bin/config/config_asker.rb
Defined Under Namespace
Classes: Asker
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
64
65
66
67
68
69
70
71
72
|
# File 'lib/cocoapods-pahealth-bin/config/config.rb', line 64
def method_missing(method, *args, &block)
if config.respond_to?(method)
config.send(method, *args)
elsif template_hash.keys.include?(method.to_s)
raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
else
super
end
end
|
Instance Method Details
#binary_repo_url ⇒ Object
56
57
58
|
# File 'lib/cocoapods-pahealth-bin/config/config_asker.rb', line 56
def binary_repo_url
end
|
#config_file ⇒ Object
5
6
7
|
# File 'lib/cocoapods-pahealth-bin/config/config.rb', line 5
def config_file
File.expand_path("#{Pod::Config.instance.home_dir}/bin.yml")
end
|
#default_config ⇒ Object
25
26
27
|
# File 'lib/cocoapods-pahealth-bin/config/config.rb', line 25
def default_config
@default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
end
|
#sync_config(config) ⇒ Object
19
20
21
22
23
|
# File 'lib/cocoapods-pahealth-bin/config/config.rb', line 19
def sync_config(config)
File.open(config_file, 'w+') do |f|
f.write(config.to_yaml)
end
end
|
#template_hash ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/cocoapods-pahealth-bin/config/config.rb', line 9
def template_hash
{
'code_repo_url' => { description: '私有源 Git 地址', default: 'http://domain/git/pahealth_private_repo.git' },
}
end
|