Class: Vara::Product
- Inherits:
-
Object
- Object
- Vara::Product
- Defined in:
- lib/vara/product.rb
Constant Summary collapse
- METADATA_DIR =
'metadata'.freeze
- METADATA_PARTS_DIR =
'metadata_parts'.freeze
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
Instance Method Summary collapse
- #bom_path ⇒ Object
- #build ⇒ Object
-
#initialize(base_dir, options = {}) ⇒ Product
constructor
A new instance of Product.
- #md5_path ⇒ Object
- #metadata_file ⇒ Object
- #metadata_ref ⇒ Object
- #path ⇒ Object
- #paths ⇒ Object
- #releases ⇒ Object
- #stemcell_version ⇒ Object
- #update_product_version(new_version) ⇒ Object
Constructor Details
#initialize(base_dir, options = {}) ⇒ Product
Returns a new instance of Product.
15 16 17 18 |
# File 'lib/vara/product.rb', line 15 def initialize(base_dir, = {}) @base_dir = base_dir @options = end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
13 14 15 |
# File 'lib/vara/product.rb', line 13 def base_dir @base_dir end |
Instance Method Details
#bom_path ⇒ Object
42 43 44 |
# File 'lib/vara/product.rb', line 42 def bom_path "#{path}.yml" end |
#build ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vara/product.rb', line 24 def build if .explicit_stemcell? && .stemcell_criteria? raise 'binaries.yml includes both stemcell and stemcell criteria keys' end ProductArtifactZipper.new(path, ProductContents.(), @options).zip! MD5Creator.md5(path) Materials.build(, path).save_to(bom_path) path end |
#md5_path ⇒ Object
46 47 48 |
# File 'lib/vara/product.rb', line 46 def md5_path "#{path}.md5" end |
#metadata_file ⇒ Object
20 21 22 |
# File 'lib/vara/product.rb', line 20 def @metadata_file ||= || raise('No metadata file found.') end |
#metadata_ref ⇒ Object
58 59 60 |
# File 'lib/vara/product.rb', line 58 def `cd #{base_dir} && git log -1 --format=format:%h` end |
#path ⇒ Object
38 39 40 |
# File 'lib/vara/product.rb', line 38 def path File.join(base_dir, "#{filename_components.join('-')}.pivotal") end |
#paths ⇒ Object
50 51 52 |
# File 'lib/vara/product.rb', line 50 def paths [path, bom_path, md5_path] end |
#releases ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/vara/product.rb', line 62 def releases ..map do || { 'name' => ['name'], 'version' => ['version'] } end end |
#stemcell_version ⇒ Object
54 55 56 |
# File 'lib/vara/product.rb', line 54 def stemcell_version ..version end |
#update_product_version(new_version) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/vara/product.rb', line 71 def update_product_version(new_version) = .hash ['product_version'] = new_version File.open(, 'w') do |out| YAML.dump(, out) end end |