Method: Pantry::Commands::EditApplication#perform

Defined in:
lib/pantry/commands/edit_application.rb

#perform(message) ⇒ Object

Read or create a new config file for the given application and return the contents of this config file, which will always be a YAML document



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pantry/commands/edit_application.rb', line 31

def perform(message)
  application = message.body[0]

  config_file = Pantry.root.join("applications", application, "config.yml")
  FileUtils.mkdir_p(File.dirname(config_file))

  if File.exists?(config_file)
    [File.read(config_file)]
  else
    [{"name" => application}.to_yaml]
  end
end