Class: Pod::Command::Stable::Push
- Inherits:
-
Pod::Command::Stable
- Object
- Pod::Command
- Pod::Command::Stable
- Pod::Command::Stable::Push
- Defined in:
- lib/cocoapods-bb-PodAssistant/command/stable/push.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Push
constructor
A new instance of Push.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Push
Returns a new instance of Push.
38 39 40 41 42 43 44 45 46 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 38 def initialize(argv) @pods = argv.arguments! @dependencies = argv.option('dependencies', nil)&.split(',') @remove = argv.option('remove', nil)&.split(',') @version = argv.option('version') @stable_specs_index = argv.option('stable-specs-index', 0).to_i @is_public_data = false super end |
Class Method Details
.options ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 30 def self. [ ['--dependencies', '依赖组件名称,多个使用`,`隔开'], ['--remove', '移除公共组件名称,多个使用`,`隔开'], ['--stable-specs-index', '指定业务specs索引-0:公共(默认) 1:矩阵全线升级 2:拉布 3:科学 4:思维 5:abc,参照podfile配置信息'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 48 def run puts "[PodAssistant] 开始执行 $ pod stable push".yellow puts "stable_specs_project_name:#{get_stable_project_name} stable_specs_name:#{get_stable_spec_name}" source_manager = BB::SourceManager.new(false, get_stable_spec_name) cachePath = source_manager.cache_path puts "stable cache git=>#{cachePath}" Dir.chdir(File.join(cachePath)) { path = get_stable_project_path # puts "path:#{path}".red if Dir.exist?(path) Dir.chdir(File.join(path)) { commit_msg = "" if @pods.any? if (@pods.length > 1) && (@dependencies) puts "❌ 无效指令,不能处理多个组件#{@pods}依赖,更新组件仅支持单组件".red puts "举例:pod stable push <单组件> --dependencies=<多组件>".green puts "详见 pod stable push --help".green system "pod stable push --help" exit elsif (@pods.length == 1) && (@dependencies || @remove) pod_name=@pods.first dependencies_hash = {} if @dependencies dependencies_hash[pod_name] = @dependencies end if @is_public_data source_manager.update_common_dependencies_and_remove_data(dependencies_hash, @remove) else source_manager.update_business_dependencies_and_remove_data(dependencies_hash, @remove) end end pods_str = @pods.join(" ") system "pod stable update #{pods_str}" commit_msg = "update pod #{pods_str}" else if (@dependencies) || (@remove) puts "❌ 无效指令,没有制定组件名称 详见 pod stable push --help".red system "pod stable push --help" exit end system "pod stable update" end # 提交spec本地lock依赖,避免pod stable push <组件>出现组件版本回退问题 source_manager.commit_localspec_data(commit_msg) } else puts "❌ 无效stable工程,请确认:#{get_stable_project_name}是否创建,at@hm".red exit end } end |