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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ats/cli.rb', line 29

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: {
      amp4e: {
        client_id: '',
        client_secret: '',
        host: 'api.amp.cisco.com',
        port: 443,
        scheme: 'https',
      },
      threat_grid: {
        api_key: '',
        host: 'panacea.threatgrid.com',
        port: 443,
        scheme: 'https',
      },
    }
  })
  say yaml, :yellow
  IO.write(new_file, yaml)
end

#versionObject



24
25
26
# File 'lib/ats/cli.rb', line 24

def version
  say ATS::VERSION
end