Class: Cloudspin::Stack::Definition
- Inherits:
-
Object
- Object
- Cloudspin::Stack::Definition
- Defined in:
- lib/cloudspin/stack/definition.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source_path:, stack_name:, stack_version: '0') ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(source_path:, stack_name:, stack_version: '0') ⇒ Definition
11 12 13 14 15 |
# File 'lib/cloudspin/stack/definition.rb', line 11 def initialize(source_path:, stack_name:, stack_version: '0') @source_path = source_path @name = stack_name @version = stack_version end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/cloudspin/stack/definition.rb', line 7 def name @name end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
9 10 11 |
# File 'lib/cloudspin/stack/definition.rb', line 9 def source_path @source_path end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/cloudspin/stack/definition.rb', line 8 def version @version end |
Class Method Details
.from_file(specfile) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cloudspin/stack/definition.rb', line 17 def self.from_file(specfile) raise NoStackDefinitionConfigurationFile unless File.exists?(specfile) source_path = File.dirname(specfile) spec_hash = YAML.load_file(specfile) self.new( source_path: source_path, stack_name: spec_hash.dig('stack', 'name'), stack_version: spec_hash.dig('stack', 'version') ) end |
.from_folder(definition_folder) ⇒ Object
28 29 30 |
# File 'lib/cloudspin/stack/definition.rb', line 28 def self.from_folder(definition_folder) from_file("#{definition_folder}/stack-definition.yaml") end |