Class: Bosh::Bootstrap::PublicStemcell
- Inherits:
-
Object
- Object
- Bosh::Bootstrap::PublicStemcell
- Defined in:
- lib/bosh-bootstrap/public_stemcell.rb
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(key, size) ⇒ PublicStemcell
constructor
A new instance of PublicStemcell.
- #legacy? ⇒ Boolean
- #name ⇒ Object
-
#stemcell_name ⇒ String
light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz into bosh-aws-xen-ubuntu-trusty-go_agent.
- #url ⇒ Object
- #variety ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(key, size) ⇒ PublicStemcell
Returns a new instance of PublicStemcell.
5 6 7 8 9 10 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 5 def initialize(key, size) @key = key @size = size @parsed_version = key.scan(/[\d]*_?[\d]+/).first end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
3 4 5 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 3 def size @size end |
Instance Method Details
#legacy? ⇒ Boolean
37 38 39 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 37 def legacy? @key.include?('legacy') end |
#name ⇒ Object
12 13 14 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 12 def name File.basename(@key) end |
#stemcell_name ⇒ String
light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz into bosh-aws-xen-ubuntu-trusty-go_agent
26 27 28 29 30 31 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 26 def stemcell_name name. gsub(/(.tgz)|(#{@parsed_version})/, ''). gsub(/^.*bosh-stemcell-/, 'bosh-'). split('-').reject { |c| c.empty? }.join('-') end |
#url ⇒ Object
33 34 35 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 33 def url "#{PublicStemcells::PUBLIC_STEMCELLS_BASE_URL}/#{@key}" end |
#variety ⇒ Object
20 21 22 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 20 def variety name.gsub(/(.tgz)|(bosh-stemcell-)|(#{@parsed_version})/, '').split('-').reject { |c| c.empty? }.join('-') end |
#version ⇒ Object
16 17 18 |
# File 'lib/bosh-bootstrap/public_stemcell.rb', line 16 def version @parsed_version.gsub('_', '.') end |