Class: GemFast::CurlDownloadStrategy
- Inherits:
-
AbstractDownloadStrategy
- Object
- AbstractDownloadStrategy
- GemFast::CurlDownloadStrategy
- Defined in:
- lib/gem-fast/remote_fetcher.rb
Direct Known Subclasses
CurlPostDownloadStrategy, CurlUnsafeDownloadStrategy, NoUnzipCurlDownloadStrategy
Instance Attribute Summary collapse
-
#tarball_path ⇒ Object
readonly
Returns the value of attribute tarball_path.
Instance Method Summary collapse
-
#_fetch ⇒ Object
Private method, can be overridden if needed.
- #cached_location ⇒ Object
- #fetch ⇒ Object
-
#initialize(url, name) ⇒ CurlDownloadStrategy
constructor
A new instance of CurlDownloadStrategy.
Methods inherited from AbstractDownloadStrategy
#expand_safe_system_args, #quiet_safe_system
Methods included from Util
#curl, #not_install_curl, #safe_system, #system
Constructor Details
#initialize(url, name) ⇒ CurlDownloadStrategy
Returns a new instance of CurlDownloadStrategy.
79 80 81 82 83 84 85 86 |
# File 'lib/gem-fast/remote_fetcher.rb', line 79 def initialize url, name super if @unique_token @tarball_path=File.join(RUBYGEMPLUS_CACHE,@unique_token) else @tarball_path=File.join(RUBYGEMPLUS_CACHE,File.basename(@url.to_s)) end end |
Instance Attribute Details
#tarball_path ⇒ Object (readonly)
Returns the value of attribute tarball_path.
77 78 79 |
# File 'lib/gem-fast/remote_fetcher.rb', line 77 def tarball_path @tarball_path end |
Instance Method Details
#_fetch ⇒ Object
Private method, can be overridden if needed.
93 94 95 |
# File 'lib/gem-fast/remote_fetcher.rb', line 93 def _fetch curl @url, '-o', @tarball_path end |
#cached_location ⇒ Object
88 89 90 |
# File 'lib/gem-fast/remote_fetcher.rb', line 88 def cached_location @tarball_path end |
#fetch ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/gem-fast/remote_fetcher.rb', line 98 def fetch if fetch_lastest_specs return @tarball_path end say "Downloading #{@url}" unless File.exist?(@tarball_path) begin _fetch rescue Exception # ignore_interrupts { @tarball_path.unlink if @tarball_path.exist? } raise end else puts "File already downloaded and cached to #{RUBYGEMPLUS_CACHE}" end return @tarball_path # thus performs checksum verification end |