Class: ATS::CLI::Application

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

Instance Method Summary collapse

Instance Method Details

#setup(configuration = ATS.configuration) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ats/cli.rb', line 20

def setup(configuration = ATS.configuration)
  say "Current Configuration:", :green
  say JSON.pretty_generate(configuration.configuration), :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}."
  yaml = YAML.dump({
    default: {
      threat_grid: {
        api_host: 'https://example.com',
        api_key: 'secret'
      }
    }
  })
  say yaml, :yellow
  IO.write(new_file, yaml)
end

#versionObject



15
16
17
# File 'lib/ats/cli.rb', line 15

def version
  say ATS::VERSION
end