Class: Pindo::Command::Lib::Update
- Inherits:
-
Pindo::Command::Lib
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Lib
- Pindo::Command::Lib::Update
- Defined in:
- lib/pindo/command/lib/update.rb
Constant Summary
Constants inherited from Pindo::Command
DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
Attributes inherited from Pindo::Command
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Update
constructor
A new instance of Update.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pindo::Command
Methods included from Funlog::Mixin
Methods included from Pindoconfig::Mixin
Methods included from Githelper
#add_branch, #add_tag, #add_tag_with_check, #clone_clang_repo, #clone_devclang_repo, #clone_pindo_common_config_repo, #clone_pindo_env_config_repo, #clong_buildconfig_repo, #get_repo_base_name, #getcode_to_dir, #git_addpush_repo, #git_latest_commit_id, #local_branch_exists?, #local_tag_exists?, #prepare_gitenv, #process_need_add_files, #remote_branch_exists?, #remote_tag_exists?, #remove_branch, #remove_tag
Methods included from Executable
capture_command, #executable, execute_command, which, which!
Constructor Details
#initialize(argv) ⇒ Update
Returns a new instance of Update.
27 28 29 30 31 32 33 |
# File 'lib/pindo/command/lib/update.rb', line 27 def initialize(argv) @args_install_flag = argv.flag?('install', false) @project_dir = argv.option('p') @additional_args = argv.remainder! super(argv) end |
Class Method Details
.options ⇒ Object
20 21 22 23 24 25 |
# File 'lib/pindo/command/lib/update.rb', line 20 def self. [ ['--install', '更新完lib之后执行pod install, pindo lib update --install'], ['--p', '指定需要lint的pod库所在目录, 例如 --p=~/Users/xxx/MyPod'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
40 41 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 |
# File 'lib/pindo/command/lib/update.rb', line 40 def run working_dir = @project_dir pod_array = pindo_single_config.pod_repo_dict pod_index_url = nil if !pod_array.nil? pod_index_url = pod_array['podindex'] else raise Informative, '私有Pod索引地址未知!!' end sources = Pod::Config.instance.sources_manager.all repos_path = File.("~/.cocoapods/repos") private_source = sources.select { |s| s.git? && s.url.to_s.eql?(pod_index_url)}.first if !private_source.nil? puts "私有Pod地址:#{pod_index_url}" puts "私有Pod目录:~/.cocoapods" getcode_to_dir(reponame:File.basename(private_source.repo), remote_url: pod_index_url, path:repos_path) else puts "私有Pod地址:#{pod_index_url}" puts "私有Pod目录:~/.cocoapods" repository_name = pod_index_url.split("/").last.chomp(".git") getcode_to_dir(reponame:repository_name, remote_url: pod_index_url, path:repos_path) end if @args_install_flag begin if File.exist?("#{working_dir}/Podfile") Pod::Command::Install::run(['--clean-install']) end rescue => e puts e. end end end |
#validate! ⇒ Object
35 36 37 38 |
# File 'lib/pindo/command/lib/update.rb', line 35 def validate! super @project_dir=Dir.pwd if @project_dir.nil? || @project_dir.empty? end |