Class: MOSAIK::Commands::Init

Inherits:
MOSAIK::Command show all
Defined in:
lib/mosaik/commands/init.rb

Overview

Initialize a new configuration file

Instance Method Summary collapse

Methods inherited from MOSAIK::Command

#validate

Instance Method Details

#callObject

Raises:



11
12
13
14
15
16
17
18
19
# File 'lib/mosaik/commands/init.rb', line 11

def call
  configuration_file = File.join(options[:directory], "mosaik.yml")

  raise ConfigurationError, "Configuration file already exists at #{configuration_file}" if File.exist?(configuration_file)

  FileUtils.cp(MOSAIK.root.join("config/mosaik.yml"), configuration_file)

  info "Configuration written to #{configuration_file}"
end