Class: Tara::Fetcher
- Inherits:
-
Object
- Object
- Tara::Fetcher
- Defined in:
- lib/tara/fetcher.rb
Instance Method Summary collapse
- #fetch_native_gem(name, version) ⇒ Object
- #fetch_ruby ⇒ Object
-
#initialize(download_dir, target, tr_version, options = {}) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #setup ⇒ Object
Constructor Details
#initialize(download_dir, target, tr_version, options = {}) ⇒ Fetcher
Returns a new instance of Fetcher.
9 10 11 12 13 14 15 16 |
# File 'lib/tara/fetcher.rb', line 9 def initialize(download_dir, target, tr_version, ={}) @download_dir = download_dir @target = target @tr_version = tr_version @ruby_version = [:ruby_version] || RUBY_VERSION @release_url = [:tr_release_url] || 'https://d6r77u77i8pq3.cloudfront.net/releases' @shell = [:shell] || Shell end |
Instance Method Details
#fetch_native_gem(name, version) ⇒ Object
28 29 30 31 32 |
# File 'lib/tara/fetcher.rb', line 28 def fetch_native_gem(name, version) remote_uri = native_gem_remote_uri(name, version) local_uri = %(#{@download_dir}/#{name}-#{version}-#{@tr_version}-#{@ruby_version}-#{@target}.tar.gz) fetch(remote_uri, local_uri) end |
#fetch_ruby ⇒ Object
23 24 25 26 |
# File 'lib/tara/fetcher.rb', line 23 def fetch_ruby local_uri = %(#{@download_dir}/ruby-#{@tr_version}-#{@ruby_version}-#{@target}.tar.gz) fetch(ruby_remote_uri, local_uri) end |
#setup ⇒ Object
18 19 20 21 |
# File 'lib/tara/fetcher.rb', line 18 def setup FileUtils.mkdir_p(@download_dir) self end |