Class: CBin::Config
- Inherits:
-
Object
- Object
- CBin::Config
- Defined in:
- lib/cocoapods-lhj-bin/config/config.rb,
lib/cocoapods-lhj-bin/config/config_asker.rb,
lib/cocoapods-lhj-bin/config/config_builder.rb
Defined Under Namespace
Instance Method Summary collapse
-
#binary_upload_url ⇒ Object
上传的url.
-
#config_debug_iphoneos_file ⇒ Object
包含arm64 armv7架构,xcodebuild 是Debug模式.
-
#config_dev_file ⇒ Object
包含x86 arm64 armv7架构,xcodebuild 是Release模式.
- #config_file ⇒ Object
- #config_file_with_configuration_env(configuration_env) ⇒ Object
-
#config_release_iphoneos_file ⇒ Object
包含arm64 armv7架构,xcodebuild 是Release模式.
- #configuration_env ⇒ Object
- #default_config ⇒ Object
- #set_configuration_env(env) ⇒ Object
- #sync_config(config) ⇒ Object
-
#template_hash ⇒ Hash{String->Hash{Symbol->String or Array<String>
}].
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
130 131 132 133 134 135 136 137 138 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 130 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_upload_url ⇒ Object
上传的url
60 61 62 63 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 60 def binary_upload_url cut_string = '/%s/%s/zip' binary_download_url[0, binary_download_url.length - cut_string.length] end |
#config_debug_iphoneos_file ⇒ Object
包含arm64 armv7架构,xcodebuild 是Debug模式
70 71 72 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 70 def config_debug_iphoneos_file 'bin_debug_iphoneos.yml' end |
#config_dev_file ⇒ Object
包含x86 arm64 armv7架构,xcodebuild 是Release模式
80 81 82 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 80 def config_dev_file 'bin_dev.yml' end |
#config_file ⇒ Object
10 11 12 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 10 def config_file config_file_with_configuration_env(configuration_env) end |
#config_file_with_configuration_env(configuration_env) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 34 def config_file_with_configuration_env(configuration_env) file = config_dev_file case configuration_env when 'release_iphoneos' file = config_release_iphoneos_file when 'debug_iphoneos' file = config_debug_iphoneos_file when 'dev' else raise "\n===== #{configuration_env} 参数有误,请检查%w[dev debug_iphoneos release_iphoneos]====" end File.("#{Pod::Config.instance.home_dir}/#{file}") end |
#config_release_iphoneos_file ⇒ Object
包含arm64 armv7架构,xcodebuild 是Release模式
75 76 77 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 75 def config_release_iphoneos_file 'bin_release_iphoneos.yml' end |
#configuration_env ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 49 def configuration_env # 如果是dev 再去 podfile的配置文件中获取,确保是正确的, pod update时会用到 if @configuration_env == 'dev' || @configuration_env.nil? configuration_env ||= Pod::Config.instance.podfile.configuration_env if Pod::Config.instance.podfile configuration_env ||= 'dev' @configuration_env = configuration_env end @configuration_env end |
#default_config ⇒ Object
90 91 92 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 90 def default_config @default_config ||= template_hash.transform_values { |v| v[:default] } end |
#set_configuration_env(env) ⇒ Object
65 66 67 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 65 def set_configuration_env(env) @configuration_env = env end |
#sync_config(config) ⇒ Object
84 85 86 87 88 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 84 def sync_config(config) File.open(config_file_with_configuration_env(config['configuration_env']), 'w+') do |f| f.write(config.to_yaml) end end |
#template_hash ⇒ Hash{String->Hash{Symbol->String or Array<String>
Returns }].
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cocoapods-lhj-bin/config/config.rb', line 15 def template_hash { 'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] }, 'code_repo_url' => { description: '源码私有源 Git 地址', default: '[email protected]:su350380433/example_spec_source.git' }, 'binary_repo_url' => { description: '二进制私有源 Git 地址', default: '[email protected]:su350380433/example_spec_bin_dev.git' }, 'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://localhost:8080/frameworks/%s/%s/zip' }, # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] }, 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }, 'oss_endpoint' => { description: 'oss_endpoint', default: 'oss-cn-shenzhen.aliyuncs.com' }, 'oss_access_key_id' => { description: 'oss_access_key_id', default: 'xxxxxxx' }, 'oss_access_key_secret' => { description: 'oss_access_key_secret', default: 'xxxxxxxxx' }, 'oss_bucket' => { description: 'oss_bucket', default: 'oss_bucket' } } end |