Module: Pindo::Appselect
- Included in:
- Command::Android::Autobuild, Command::Appstore::Autobuild, Command::Appstore::Autoresign, Command::Ios::Autoresign, Command::Ios::Cert, Command::Unity::Autobuild, Command::Utils::Renewcert, Command::Utils::Updateconfig, Command::Web::Autobuild
- Defined in:
- lib/pindo/module/appselect.rb
Instance Method Summary collapse
- #all_deploy_bundle_name ⇒ Object
-
#all_dev_bundle_name ⇒ Object
Android Bundle Name 相关函数.
- #all_dev_bundleid ⇒ Object
- #all_itc_bundleid ⇒ Object
- #all_release_bundleid ⇒ Object
- #all_tool_bundleid ⇒ Object
- #deploy_build_setting_json ⇒ Object
- #dev_build_setting_json ⇒ Object
- #get_deploy_repo_with_modul_name(module_name: nil) ⇒ Object
- #get_deploy_setting_repo(tagname: nil) ⇒ Object
- #get_dev_setting_repo(tagname: nil) ⇒ Object
- #get_selected_deploy_bundle_name ⇒ Object
- #get_selected_deploy_bundleid ⇒ Object
- #get_selected_dev_bundle_name ⇒ Object
- #get_selected_dev_bundleid ⇒ Object
- #get_setting_bundleid_withdir(repo_dir: nil) ⇒ Object
- #load_setting(setting_file: nil) ⇒ Object
- #select_main_app ⇒ Object
Instance Method Details
#all_deploy_bundle_name ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/pindo/module/appselect.rb', line 80 def all_deploy_bundle_name bundle_names = [] begin config = Pindoconfig.instance.pindo_common_config_json if config && config['android_deploy_bundle_array'] bundle_names = config['android_deploy_bundle_array'] end rescue => e raise Informative, "注意: android_deploy_bundle_array 配置不存在或无法加载" end return bundle_names end |
#all_dev_bundle_name ⇒ Object
Android Bundle Name 相关函数
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/pindo/module/appselect.rb', line 67 def all_dev_bundle_name bundle_names = [] begin config = Pindoconfig.instance.pindo_common_config_json if config && config['android_dev_bundle_array'] bundle_names = config['android_dev_bundle_array'] end rescue => e raise Informative, "注意: android_dev_bundle_array 配置不存在或无法加载" end return bundle_names end |
#all_dev_bundleid ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/pindo/module/appselect.rb', line 36 def all_dev_bundleid setting_file = File.join(pindo_single_config.pindo_env_configdir,'bundleid_config.json') setting_json = load_setting(setting_file:setting_file) sub_json = [] if !setting_json.nil? && !setting_json['all_dev_bundleid'].nil? sub_json = setting_json['all_dev_bundleid'] end return sub_json end |
#all_itc_bundleid ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/pindo/module/appselect.rb', line 94 def all_itc_bundleid all_bundleid = [] all_bundleid = all_bundleid | all_dev_bundleid all_bundleid = all_bundleid | all_release_bundleid all_bundleid = all_bundleid | all_tool_bundleid return all_bundleid end |
#all_release_bundleid ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/pindo/module/appselect.rb', line 56 def all_release_bundleid setting_file = File.join(pindo_single_config.pindo_env_configdir,'bundleid_config.json') setting_json = load_setting(setting_file:setting_file) sub_json = [] if !setting_json.nil? && !setting_json['all_release_bundleid'].nil? sub_json = setting_json['all_release_bundleid'] end return sub_json end |
#all_tool_bundleid ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/pindo/module/appselect.rb', line 46 def all_tool_bundleid setting_file = File.join(pindo_single_config.pindo_env_configdir,'bundleid_config.json') setting_json = load_setting(setting_file:setting_file) sub_json = [] if !setting_json.nil? && !setting_json['all_tool_bundleid'].nil? sub_json = setting_json['all_tool_bundleid'] end return sub_json end |
#deploy_build_setting_json ⇒ Object
29 30 31 32 33 34 |
# File 'lib/pindo/module/appselect.rb', line 29 def deploy_build_setting_json setting_file = File.join(pindo_single_config.pindo_env_configdir,'deploy_build_setting.json') setting_json = load_setting(setting_file:setting_file) return setting_json end |
#dev_build_setting_json ⇒ Object
23 24 25 26 27 |
# File 'lib/pindo/module/appselect.rb', line 23 def dev_build_setting_json setting_file = File.join(pindo_single_config.pindo_env_configdir,'dev_build_setting.json') setting_json = load_setting(setting_file:setting_file) return setting_json end |
#get_deploy_repo_with_modul_name(module_name: nil) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/pindo/module/appselect.rb', line 298 def get_deploy_repo_with_modul_name(module_name:nil) sub_setting_json = deploy_build_setting_json() repo_name = nil begin repo_name = sub_setting_json[module_name]['git_repo_name'] rescue => err raise Informative, "config.json app_type is error!!!" end return repo_name end |
#get_deploy_setting_repo(tagname: nil) ⇒ Object
276 277 278 279 |
# File 'lib/pindo/module/appselect.rb', line 276 def get_deploy_setting_repo(tagname:nil) sub_setting_json = deploy_build_setting_json() return sub_setting_json[tagname]['git_repo_name'] end |
#get_dev_setting_repo(tagname: nil) ⇒ Object
281 282 283 284 |
# File 'lib/pindo/module/appselect.rb', line 281 def get_dev_setting_repo(tagname:nil) sub_setting_json = dev_build_setting_json() return sub_setting_json[tagname]['git_repo_name'] end |
#get_selected_deploy_bundle_name ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/pindo/module/appselect.rb', line 248 def get_selected_deploy_bundle_name() all_bundle_names = all_deploy_bundle_name() if all_bundle_names.nil? || all_bundle_names.empty? puts "\n未配置任何发布环境的Android Bundle Name" return nil end cli = HighLine.new = "None" puts cli.choose do || .header = "可用的Android Bundle Name如下:" .prompt = "请选择使用的Bundle Name,请输入选项(1/2/3...):" for bundle_name in all_bundle_names do .choice(bundle_name) do |details| = "#{details}" end end end puts puts "选择的Bundle Name是: #{menu_choice}" puts return end |
#get_selected_deploy_bundleid ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/pindo/module/appselect.rb', line 180 def get_selected_deploy_bundleid() all_bundleid = all_release_bundleid() cli = HighLine.new ="None" puts cli.choose do || # you can also use constants like :blue .header = "可用的Bundle Id如下:" .prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):" if !all_bundleid.nil? && all_bundleid.length > 0 for bunld_id in all_bundleid do .choice(bunld_id) do |details| ="#{details}" end end end end puts puts "选择的bundle id是: #{menu_choice}" puts return ; end |
#get_selected_dev_bundle_name ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/pindo/module/appselect.rb', line 207 def get_selected_dev_bundle_name() state = Pindo::Options::GlobalOptionsState.instance # 检查 GlobalOptionsState 缓存(已包含环境变量和命令行参数) cached_bundle_name = state[:bundle_name] if cached_bundle_name && !cached_bundle_name.empty? puts "\n使用已配置的Bundle Name: #{cached_bundle_name}" puts return cached_bundle_name end all_bundle_names = all_dev_bundle_name() if all_bundle_names.nil? || all_bundle_names.empty? puts "\n未配置任何开发环境的Android Bundle Name" return nil end cli = HighLine.new = "None" puts cli.choose do || .header = "可用的Android Bundle Name如下:" .prompt = "请选择使用的Bundle Name,请输入选项(1/2/3...):" for bundle_name in all_bundle_names do .choice(bundle_name) do |details| = "#{details}" end end end puts puts "选择的Bundle Name是: #{menu_choice}" puts # 保存选择到 GlobalOptionsState state[:bundle_name] = return end |
#get_selected_dev_bundleid ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/pindo/module/appselect.rb', line 136 def get_selected_dev_bundleid() state = Pindo::Options::GlobalOptionsState.instance # 检查 GlobalOptionsState 缓存(已包含环境变量和命令行参数) cached_bundleid = state[:bundleid] if cached_bundleid && !cached_bundleid.empty? puts "\n使用已配置的Bundle ID: #{cached_bundleid}" puts return cached_bundleid end all_bundleid = [] all_bundleid = all_bundleid | all_dev_bundleid() all_bundleid = all_bundleid | all_tool_bundleid() cli = HighLine.new ="None" puts cli.choose do || .header = "可用的Bundle Id如下:" .prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):" if !all_bundleid.nil? && all_bundleid.length > 0 for bunld_id in all_bundleid do .choice(bunld_id) do |details| ="#{details}" end end end end puts puts "选择的bundle id是: #{menu_choice}" puts if .eql?("com.heroneverdie101.*") = "com.heroneverdie101" end # 保存选择到 GlobalOptionsState state[:bundleid] = return ; end |
#get_setting_bundleid_withdir(repo_dir: nil) ⇒ Object
286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/pindo/module/appselect.rb', line 286 def get_setting_bundleid_withdir(repo_dir:nil) bundl_id = "" config_json_file = File.join(repo_dir, "config.json") if File.exist?(config_json_file) config_json = JSON.parse(File.read(config_json_file)) bundl_id = config_json["app_info"]["app_identifier"] end return bundl_id end |
#load_setting(setting_file: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pindo/module/appselect.rb', line 9 def load_setting(setting_file:nil) setting_json = nil if setting_json.nil? && File.exist?(setting_file) # begin setting_json = JSON.parse(File.read(setting_file)) # rescue => exception # puts "load Pindo build setting error !!!" # end end return setting_json end |
#select_main_app ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/pindo/module/appselect.rb', line 103 def select_main_app sub_setting_json = dev_build_setting_json() cli = HighLine.new ="None" puts "" puts "如果没有想要打包的App, 可以使用 pindo dev createbuild 创建打包选项" puts "" puts "具体参考文档: https://tower.im/teams/851356/repository_documents/714/" puts "" puts "App Type:" puts cli.choose do || # you can also use constants like :blue .header = "可用的Bundle Id如下:" .prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):" .index_suffix = ") " if !sub_setting_json.nil? sub_setting_json.each do |key, items| .choice(key) do |details| ="#{details}" end end end end puts puts "选择的bundle id是: #{menu_choice}" puts return ; end |