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



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
63
64
65
66
# File 'lib/ats/cli.rb', line 33

def setup(configuration = ATS.configuration)
  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}."
  yaml = YAML.dump({
    default: {
      amp4e: {
        client_id: '',
        client_secret: '',
        host: 'api.amp.cisco.com',
        port: 443,
        scheme: 'https',
      },
      threatgrid: {
        api_key: '',
        host: 'panacea.threatgrid.com',
        port: 443,
        scheme: 'https',
      },
    }
  })
  say yaml, :yellow
  IO.write(new_file, yaml)
end

#versionObject



28
29
30
# File 'lib/ats/cli.rb', line 28

def version
  say ATS::VERSION
end