class Pod::Command::RepoArt::Update
Constants
- UTIL
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/pod/command/repo_art/update.rb, line 25 def initialize(argv) @name = argv.shift_argument @prune = argv.flag?('prune', false) super end
options()
click to toggle source
Calls superclass method
# File lib/pod/command/repo_art/update.rb, line 15 def self.options [ ['--prune', 'Prunes entries which do not exist in the remote this index was pulled from.'] ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/pod/command/repo_art/update.rb, line 38 def run update(@name, true) end
validate!()
click to toggle source
Calls superclass method
# File lib/pod/command/repo_art/update.rb, line 31 def validate! super unless @name help! 'This command requires a repo name to run.' end end
Private Instance Methods
hard_update(name, path, url)
click to toggle source
Performs a ‘hard’ update which prunes all index entries which are not sync with the remote (override)
# File lib/pod/command/repo_art/update.rb, line 89 def hard_update(name, path, url) UI.puts path begin repos_path = "#{Pod::Config.instance.home_dir}/repos/#{name}" repos_art_path = "#{Pod::Config.instance.home_dir}/repos-art/#{name}" repo_update_tmp = "#{repos_path}_update_tmp" repo_art_update_tmp = "#{repos_art_path}_update_tmp" system("mv", repos_path.to_s, repo_update_tmp) system("mv", repos_art_path.to_s, repo_art_update_tmp) argv = CLAide::ARGV.new([name, url, '--silent']) Pod::Command::RepoArt::Add.new(argv).run FileUtils.remove_entry_secure(repo_update_tmp, :force => true) FileUtils.remove_entry_secure(repo_art_update_tmp, :force => true) rescue => e FileUtils.remove_entry_secure(path.to_s, :force => true) system("mv", repo_update_tmp, repos_path.to_s) system("mv", repo_art_update_tmp, repos_art_path.to_s) raise Informative, "Error getting the index from Artifactory at: '#{url}' : #{e.message}" end end
soft_update(path, url)
click to toggle source
Performs a ‘soft’ update which appends any changes from the remote without deleting out-of-sync entries
# File lib/pod/command/repo_art/update.rb, line 79 def soft_update(path, url) downloader = Pod::Downloader::Http.new("#{path}", "#{url}/index/fetchIndex", :type => 'tgz', :indexDownload => true) downloader.download UTIL.cleanup_index_download("#{path}") UTIL.del_redundant_spec_dir("#{path}/Specs/Specs") system "cd '#{path}' && git add . && git commit -m 'Artifactory repo update specs'" end
update(source_name = nil, show_output = false)
click to toggle source
Update
command for Artifactory sources.
@param [String] source_name name
# File lib/pod/command/repo_art/update.rb, line 48 def update(source_name = nil, show_output = false) if source_name sources = [UTIL.get_art_repo(source_name)] else sources = UTIL.get_art_repos() end sources.each do |source| UI.section "Updating spec repo `#{source.name}`" do Dir.chdir(source.path) do begin # TODO HEAD to api/updateTime # TODO unless .lastupdated >= api/updateTime do # TODO Until we support delta downloads, update is actually add if not currently up tp date url = UTIL.get_art_url(source.path) if @prune hard_update(source.name, source.path, url) else soft_update(source.path, url) end UI.puts "Successfully updated repo #{source.name}".green if show_output && !config.verbose? rescue => e UI.warn "Unable to update repo `#{source.name}`: #{e.message}" end end end end end