Class: Vendorificator::Vendor::Download
- Inherits:
-
Vendorificator::Vendor
- Object
- Vendorificator::Vendor
- Vendorificator::Vendor::Download
- Defined in:
- lib/vendorificator/vendor/download.rb
Instance Attribute Summary collapse
-
#conjured_checksum ⇒ Object
readonly
Returns the value of attribute conjured_checksum.
-
#conjured_filesize ⇒ Object
readonly
Returns the value of attribute conjured_filesize.
Attributes inherited from Vendorificator::Vendor
#args, #block, #environment, #name, #segment
Instance Method Summary collapse
Methods inherited from Vendorificator::Vendor
#===, arg_reader, #before_conjure!, #compute_dependencies!, #git_add_extra_paths, #group, #initialize, #inspect, #metadata, #version
Constructor Details
This class inherits a constructor from Vendorificator::Vendor
Instance Attribute Details
#conjured_checksum ⇒ Object (readonly)
Returns the value of attribute conjured_checksum.
11 12 13 |
# File 'lib/vendorificator/vendor/download.rb', line 11 def conjured_checksum @conjured_checksum end |
#conjured_filesize ⇒ Object (readonly)
Returns the value of attribute conjured_filesize.
11 12 13 |
# File 'lib/vendorificator/vendor/download.rb', line 11 def conjured_filesize @conjured_filesize end |
Instance Method Details
#conjure! ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/vendorificator/vendor/download.rb', line 17 def conjure! say_status :default, :download, url File.open name, 'w' do |outf| outf.write( open(url).read ) end @conjured_checksum = Digest::SHA256.file(name).hexdigest @conjured_filesize = File.size(name) end |
#conjure_commit_message ⇒ Object
31 32 33 34 35 |
# File 'lib/vendorificator/vendor/download.rb', line 31 def rv = "Conjured #{name} from #{url}\nChecksum: #{conjured_checksum}" rv << "Version: #{args[:version]}" if args[:version] rv end |
#path ⇒ Object
13 14 15 |
# File 'lib/vendorificator/vendor/download.rb', line 13 def path args[:path] || group end |
#upstream_version ⇒ Object
27 28 29 |
# File 'lib/vendorificator/vendor/download.rb', line 27 def upstream_version conjured_checksum || Digest::SHA256.hexdigest( open(url).read ) end |