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.
33 34 35 36 37 38 39 40 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 33 def initialize(argv) @pods = argv.arguments! @dependencies = argv.option('dependencies', nil)&.split(',') @remove = argv.option('remove', nil)&.split(',') @is_pub = argv.flag?('update-common', false) @is_matrix = !@is_pub # argv.flag?('update-matrix', true) super end |
Class Method Details
.options ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 24 def self. [ ['--dependencies', '依赖组件名称,多个使用`,`隔开'], ['--remove', '移除公共组件名称,多个使用`,`隔开'], ['--update-matrix', '更新[矩阵]产品公共业务线,默认true'], ['--update-common', '更新公共组件,默认false'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
42 43 44 45 46 47 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 |
# File 'lib/cocoapods-bb-PodAssistant/command/stable/push.rb', line 42 def run puts "[PodAssistant] 开始执行 $ pod stable push".yellow source_manager = BB::SourceManager.new(false, @is_matrix) cachePath = source_manager.cache_path puts "stable cache git=>#{cachePath}" Dir.chdir(File.join(cachePath)) { # puts "pwd:#{`pwd`}".green path = @is_matrix ? matrix_stable_path : common_stable_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_matrix source_manager.update_business_dependencies_and_remove_data(dependencies_hash, @remove) else source_manager.update_common_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(@is_matrix, commit_msg) } } end |