Class: Vagrant::Smartos::Zones::Util::Downloader
- Inherits:
-
Object
- Object
- Vagrant::Smartos::Zones::Util::Downloader
- Defined in:
- lib/vagrant/smartos/zones/util/downloader.rb
Constant Summary collapse
- GET_PARAMS =
{ 'wget' => '-qO', 'curl' => '--silent -o' }
- READ_PARAMS =
{ 'wget' => '-qO-', 'curl' => '--silent' }
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#utility ⇒ Object
readonly
Returns the value of attribute utility.
Class Method Summary collapse
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(url) ⇒ Downloader
constructor
A new instance of Downloader.
- #read ⇒ Object
Constructor Details
#initialize(url) ⇒ Downloader
Returns a new instance of Downloader.
18 19 20 21 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 18 def initialize(url) @url = url @utility = download_utility end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 6 def url @url end |
#utility ⇒ Object (readonly)
Returns the value of attribute utility.
6 7 8 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 6 def utility @utility end |
Class Method Details
.get(url, path) ⇒ Object
23 24 25 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 23 def self.get(url, path) new(url).get(path) end |
Instance Method Details
#get(path) ⇒ Object
27 28 29 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 27 def get(path) `#{utility} #{url} #{GET_PARAMS[utility]} #{path}` end |
#read ⇒ Object
31 32 33 |
# File 'lib/vagrant/smartos/zones/util/downloader.rb', line 31 def read `#{utility} #{url} #{READ_PARAMS[utility]}` end |