Class: Promote::EnvironmentFile
- Inherits:
-
Object
- Object
- Promote::EnvironmentFile
- Defined in:
- lib/promote/environment_file.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #cookbook_versions ⇒ Object
- #file_path ⇒ Object
-
#initialize(environment_name, config) ⇒ EnvironmentFile
constructor
A new instance of EnvironmentFile.
- #overrides ⇒ Object
- #write_cookbook_versions(versions) ⇒ Object
Constructor Details
#initialize(environment_name, config) ⇒ EnvironmentFile
Returns a new instance of EnvironmentFile.
7 8 9 10 |
# File 'lib/promote/environment_file.rb', line 7 def initialize(environment_name, config) @name = environment_name @config = config end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/promote/environment_file.rb', line 5 def name @name end |
Instance Method Details
#cookbook_versions ⇒ Object
20 21 22 |
# File 'lib/promote/environment_file.rb', line 20 def cookbook_versions content['cookbook_versions'] || {} end |
#file_path ⇒ Object
12 13 14 |
# File 'lib/promote/environment_file.rb', line 12 def file_path File.join(@config.environment_directory, "#{name}.json") end |
#overrides ⇒ Object
16 17 18 |
# File 'lib/promote/environment_file.rb', line 16 def overrides content['override_attributes'] || {} end |
#write_cookbook_versions(versions) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/promote/environment_file.rb', line 24 def write_cookbook_versions(versions) content['cookbook_versions'] = versions File.open(file_path, 'w') do |out| out << JSON.pretty_generate(content) end end |