Class: GemFast::AbstractDownloadStrategy

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/gem-fast/remote_fetcher.rb

Direct Known Subclasses

CurlDownloadStrategy

Instance Method Summary collapse

Methods included from Util

#curl, #not_install_curl, #safe_system, #system

Constructor Details

#initialize(url, name = nil) ⇒ AbstractDownloadStrategy

Returns a new instance of AbstractDownloadStrategy.



50
51
52
53
# File 'lib/gem-fast/remote_fetcher.rb', line 50

def initialize url, name=nil
  @url=url
  @unique_token="#{name}" unless name.to_s.empty? or name == '__UNKNOWN__'
end

Instance Method Details

#expand_safe_system_args(args) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gem-fast/remote_fetcher.rb', line 55

def expand_safe_system_args args
  args.each_with_index do |arg, ii|
    if arg.is_a? Hash
      unless ARGV.verbose?
        args[ii] = arg[:quiet_flag]
      else
        args.delete_at ii
      end
      return args
    end
  end
  # 2 as default because commands are eg. svn up, git pull
  args.insert(2, '-q') unless ARGV.verbose?
  return args
end

#quiet_safe_system(*args) ⇒ Object



71
72
73
# File 'lib/gem-fast/remote_fetcher.rb', line 71

def quiet_safe_system *args
  safe_system(*expand_safe_system_args(args))
end