Class: OrmDev::Command::Update
- Inherits:
-
OrmDev::Command
- Object
- CLAide::Command
- OrmDev::Command
- OrmDev::Command::Update
- Defined in:
- lib/ormdev/command/update.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Update
constructor
A new instance of Update.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Update
Returns a new instance of Update.
24 25 26 27 28 29 |
# File 'lib/ormdev/command/update.rb', line 24 def initialize(argv) @podspec_file = argv.shift_argument @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' } @repo_update = argv.flag?('repo-update') super end |
Class Method Details
.options ⇒ Object
18 19 20 21 22 |
# File 'lib/ormdev/command/update.rb', line 18 def self. [ ['--no-repo-update', 'Skip running `pod repo update` before install'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ormdev/command/update.rb', line 43 def run super OrmDev::LogUtil.info '[插件管理] 更新Pod依赖库'.green @spec = Pod::Specification.from_file(@podspec_path) OrmDev::SHUtil.run_command("pod cache clean #{@spec.name} --all",'清除Pod缓存',false) Dir.chdir('Example') do pod_update_command = '' pod_update_command << "#{@spec.name}_SOURCE=1" pod_update_command << ' pod update' pod_update_command << ' --no-repo-update' unless @repo_update OrmDev::SHUtil.run_command(pod_update_command,'更新Pod依赖库',false) end end |
#validate! ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ormdev/command/update.rb', line 31 def validate! super if @podspec_file help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file @podspec_path = @podspec_file else raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0 raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1 @podspec_path = @podspec_files.first end end |