class Pod::Downloader::Mercurial
Public Class Methods
options()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 4 def self.options [:revision, :tag, :branch] end
Public Instance Methods
checkout_options()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 12 def checkout_options Dir.chdir(target_path) do options = {} options[:hg] = url options[:revision] = `hg --debug id -i`.chomp options end end
options_specific?()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 8 def options_specific? !(options[:revision] || options[:tag]).nil? end
Private Instance Methods
download!()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 25 def download! if options[:revision] download_revision! elsif options[:tag] download_tag! elsif options[:branch] download_branch! else download_head! end end
download_branch!()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 49 def download_branch! hg! 'clone', url, '--updaterev', options[:branch], @target_path end
download_head!()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 37 def download_head! hg! 'clone', url, @target_path end
download_revision!()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 41 def download_revision! hg! 'clone', url, '--rev', options[:revision], @target_path end
download_tag!()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 45 def download_tag! hg! 'clone', url, '--updaterev', options[:tag], @target_path end
validate_input()
click to toggle source
# File lib/cocoapods-downloader/mercurial.rb, line 53 def validate_input input = [url, options[:revision], options[:branch], options[:tag]].map(&:to_s) invalid = input.compact.any? { |value| value.start_with?('--') || value.include?(' --') } raise DownloaderError, "Provided unsafe input for hg #{options}." if invalid end