Class: Ufo::Upgrade::Upgrade43to45

Inherits:
Object
  • Object
show all
Defined in:
lib/ufo/upgrade/upgrade43to45.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Upgrade43to45

Returns a new instance of Upgrade43to45.



6
7
8
# File 'lib/ufo/upgrade/upgrade43to45.rb', line 6

def initialize(options)
  @options = options
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ufo/upgrade/upgrade43to45.rb', line 10

def run
  settings_path = ".ufo/settings.yml"
  settings = YAML.load_file(settings_path)
  if settings.dig("base", "stack_naming") == "append_ufo_env"
    puts "Detected stack_naming in the #{settings_path}. Already upgraded to v4.5"
    return
  end

  puts "Upgrading to ufo v4.5..."
  settings["base"] ||= {}
  settings["base"]["stack_naming"] = "append_ufo_env"
  text = YAML.dump(settings)
  IO.write(settings_path, text)
  puts "Updated .ufo/settings.yml"
end