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
- #after_conjure! ⇒ Object
- #conjure! ⇒ Object
- #conjure_commit_message ⇒ Object
- #path ⇒ Object
- #upstream_version ⇒ Object
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
#after_conjure! ⇒ Object
27 28 29 30 31 |
# File 'lib/vendorificator/vendor/download.rb', line 27 def after_conjure! FileUtils.mv File.join(work_dir, 'content'), work_dir+'.content' Dir.rmdir work_dir FileUtils.mv work_dir+'.content', work_dir end |
#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 'content', 'w' do |outf| outf.write( open(url).read ) end @conjured_checksum = Digest::SHA256.file('content').hexdigest @conjured_filesize = File.size('content') end |
#conjure_commit_message ⇒ Object
37 38 39 40 41 |
# File 'lib/vendorificator/vendor/download.rb', line 37 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
33 34 35 |
# File 'lib/vendorificator/vendor/download.rb', line 33 def upstream_version conjured_checksum || Digest::SHA256.hexdigest( open(url).read ) end |