Class: ATS::CLI::Setup

Inherits:
Command
  • Object
show all
Defined in:
lib/ats/cli/setup.rb

Instance Method Summary collapse

Methods inherited from Command

printable_commands

Instance Method Details

#setupObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ats/cli/setup.rb', line 7

def setup
  say "Default Configuration:", :green
  yaml = YAML.dump(default_settings)
  say yaml, :yellow

  say "Current Configuration:", :green
  say JSON.pretty_generate(configuration.to_h), :green

  configuration.config_files.each do |file|
    if File.exist?(file)
      say "Found #{file}. Nothing to do. Good bye!", :green
      exit 0
    end
  end

  say "Configuration file not found."
  new_file = configuration.config_files.first
  say "New file created at #{new_file}."
  IO.write(new_file, yaml)
  File.chmod(0600, new_file)
end