Class: Pod::Command::DyUpdate
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::DyUpdate
- Includes:
- ProjectDirectory, RepoUpdate
- Defined in:
- lib/pod/command/dyupdate.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ DyUpdate
constructor
A new instance of DyUpdate.
- #installer_for_config ⇒ Object
- #run ⇒ Object
-
#verify_pods_are_installed! ⇒ Object
Check if all given pods are installed.
Constructor Details
#initialize(argv) ⇒ DyUpdate
Returns a new instance of DyUpdate.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pod/command/dyupdate.rb', line 31 def initialize(argv) @pods = argv.arguments! unless argv.arguments.empty? source_urls = argv.option('sources', '').split(',') excluded_pods = argv.option('exclude-pods', '').split(',') unless source_urls.empty? source_pods = source_urls.flat_map { |url| config.sources_manager.source_with_name_or_url(url).pods } unless source_pods.empty? source_pods = source_pods.select { |pod| config.lockfile.pod_names.include?(pod) } if @pods @pods += source_pods else @pods = source_pods unless source_pods.empty? end end end unless excluded_pods.empty? @pods ||= config.lockfile.pod_names.dup non_installed_pods = (excluded_pods - @pods) unless non_installed_pods.empty? pluralized_words = non_installed_pods.length > 1 ? %w(Pods are) : %w(Pod is) = "Trying to skip `#{non_installed_pods.join('`, `')}` #{pluralized_words.first} " \ "which #{pluralized_words.last} not installed" raise Informative, end @pods.delete_if { |pod| excluded_pods.include?(pod) } end super end |
Class Method Details
.options ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/pod/command/dyupdate.rb', line 23 def self. [ ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to update dependent pods. ' \ 'Multiple sources must be comma-delimited. The master repo will not be included by default with this option.'], ['--exclude-pods=podName', 'Pods to exclude during update. Multiple pods must be comma-delimited.'], ].concat(super) end |
Instance Method Details
#installer_for_config ⇒ Object
101 102 103 |
# File 'lib/pod/command/dyupdate.rb', line 101 def installer_for_config DyInstaller.new(config.sandbox, config.podfile, config.lockfile) end |
#run ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/pod/command/dyupdate.rb', line 85 def run verify_podfile_exists! installer = installer_for_config installer.repo_update = repo_update?(:default => true) if @pods verify_lockfile_exists! verify_pods_are_installed! installer.update = { :pods => @pods } else UI.puts 'Update all pods'.yellow installer.update = true end installer.install! end |
#verify_pods_are_installed! ⇒ Object
Check if all given pods are installed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/pod/command/dyupdate.rb', line 67 def verify_pods_are_installed! lockfile_roots = config.lockfile.pod_names.map { |p| Specification.root_name(p) } missing_pods = @pods.map { |p| Specification.root_name(p) }.select do |pod| !lockfile_roots.include?(pod) end unless missing_pods.empty? = if missing_pods.length > 1 "Pods `#{missing_pods.join('`, `')}` are not " \ 'installed and cannot be updated' else "The `#{missing_pods.first}` Pod is not installed " \ 'and cannot be updated' end raise Informative, end end |