Class: Ufo::Docker::Variables
- Inherits:
-
Object
- Object
- Ufo::Docker::Variables
- Defined in:
- lib/ufo/docker/variables.rb
Constant Summary collapse
Instance Method Summary collapse
- #current_data ⇒ Object
-
#initialize(full_image_name, options = {}) ⇒ Variables
constructor
A new instance of Variables.
- #update ⇒ Object
Constructor Details
#initialize(full_image_name, options = {}) ⇒ Variables
Returns a new instance of Variables.
5 6 7 |
# File 'lib/ufo/docker/variables.rb', line 5 def initialize(full_image_name, ={}) @full_image_name, @options = full_image_name, end |
Instance Method Details
#current_data ⇒ Object
22 23 24 |
# File 'lib/ufo/docker/variables.rb', line 22 def current_data File.exist?(@@variables_path) ? YAML.load_file(@@variables_path) : {} end |
#update ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ufo/docker/variables.rb', line 9 def update data = current_data data[Ufo.env] ||= {} data[Ufo.env]["base_image"] = @full_image_name pretty_path = @@variables_path.sub("#{Ufo.root}/", "") IO.write(@@variables_path, YAML.dump(data)) unless @options[:mute] puts "The #{pretty_path} base_image has been updated with the latest base image:".color(:green) puts " #{@full_image_name}".color(:green) end end |