Class: Pindo::Command::Ios::Podupdate
- Inherits:
-
Pindo::Command::Ios
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Ios
- Pindo::Command::Ios::Podupdate
- Defined in:
- lib/pindo/command/ios/podupdate.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) ⇒ Podupdate
constructor
A new instance of Podupdate.
- #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, #git_root_directory, #is_git_directory?, #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) ⇒ Podupdate
Returns a new instance of Podupdate.
41 42 43 44 45 46 47 |
# File 'lib/pindo/command/ios/podupdate.rb', line 41 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
34 35 36 37 38 39 |
# File 'lib/pindo/command/ios/podupdate.rb', line 34 def self. [ ['--install', '更新完lib之后执行pod install, pindo ios podupdate --install'], ['--p', '指定需要lint的pod库所在目录, 例如 --p=~/Users/xxx/MyPod'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
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 |
# File 'lib/pindo/command/ios/podupdate.rb', line 54 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
49 50 51 52 |
# File 'lib/pindo/command/ios/podupdate.rb', line 49 def validate! super @project_dir=Dir.pwd if @project_dir.nil? || @project_dir.empty? end |