Class: Lono::Upgrade::Upgrade42

Inherits:
Sequence
  • Object
show all
Defined in:
lib/lono/upgrade/upgrade42.rb

Instance Method Summary collapse

Methods inherited from Sequence

source_root, template_name

Instance Method Details

#update_settings_yamlObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lono/upgrade/upgrade42.rb', line 17

def update_settings_yaml
  path = "config/settings.yml"
  puts "Updating #{path}."
  data = YAML.load_file(path)

  if data["base"].has_key?("randomize_stack_name")
    randomize = data["base"]["randomize_stack_name"]
    if randomize
      data["base"]["stack_name_suffix"] = "random"
    end

    data["base"].delete("randomize_stack_name")
    puts "Updated randomize_stack_name with stack_name_suffix."
  end

  text = YAML.dump(data)
  IO.write(path, text)
end

#upsert_gitignoreObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/lono/upgrade/upgrade42.rb', line 6

def upsert_gitignore
  text =<<-EOL
.lono/current
EOL
  if File.exist?(".gitignore")
    append_to_file ".gitignore", text
  else
    create_file ".gitignore", text
  end
end