class Ufo::Upgrade::Upgrade43to45

Public Class Methods

new(options) click to toggle source
# File lib/ufo/upgrade/upgrade43to45.rb, line 6
def initialize(options)
  @options = options
end

Public Instance Methods

run() click to toggle source
# 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