ats 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 226e424b41b47a9bed3a8e3e02daa4c8e6747d44cd9c3c0d25e9bbf0f7b977d3
4
- data.tar.gz: d67d968d01a44e95a75d1c2541a29319c19d1d7b2d1b05c924c03479ec533c9c
3
+ metadata.gz: 1f2fe2728729b93415b0a3207e83702f05b99d6bdd4171881cd92b3c7e135549
4
+ data.tar.gz: a078e537c475aca4ecb294278f862aba09964e5067793e84b4747b057f1e0666
5
5
  SHA512:
6
- metadata.gz: 6e8e7e9a31b025f787681b847fc1d41f08c634ba579facd07d3dd9e468dcaac90a5c0337a7afff9ebadfa7ede6f4d086177ea20400a9879aeb668835c023c840
7
- data.tar.gz: 57eababf9c32f5749f6d43a237f7e04ecc3a235e442700449cb36aed4cfea50b4c7764aa1120d4f053fa6658fcdbe804b2858ac23fe111fe834a43e16c8d71bc
6
+ metadata.gz: 36443b75271928b0cc6adc098a064b39b554b4d53b677b91b7569e7330ef010ecfacf8e641e8234eb5e59eac97c4ffbf0592ce2fd526faccf01462b18b58ac75
7
+ data.tar.gz: 3f0657e29f705f3076acef287c6984edf1a11d7a9618bc4b82feb9cd3a9ec6c15a4e38984aad34aba0029e89b0af0bde4aae40b7fa117baa2e4e052c0cd07889
@@ -1,6 +1,7 @@
1
1
  require 'ats'
2
2
  require 'thor'
3
3
  require 'ats/cli/command'
4
+ require 'ats/cli/setup'
4
5
  require 'ats/cli/threat_grid/organizations'
5
6
  require 'ats/cli/threat_grid/samples'
6
7
  require 'ats/cli/threat_grid/search'
@@ -24,46 +25,13 @@ module ATS
24
25
  desc 'amp4e SUBCOMMAND ...ARGS', 'interact with the AMP for Endpoints API'
25
26
  subcommand 'amp4e', AMP4E::Application
26
27
 
28
+ desc 'setup', 'setup'
29
+ subcommand :setup, ATS::CLI::Setup
30
+
27
31
  desc 'version', 'Display the current version'
28
32
  def version
29
33
  say ATS::VERSION
30
34
  end
31
-
32
- desc 'setup', 'Initialize the .atsrc file.'
33
- def setup(configuration = ATS.configuration)
34
- say "Current Configuration:", :green
35
- say JSON.pretty_generate(configuration.to_h), :green
36
-
37
- configuration.config_files.each do |file|
38
- if File.exist?(file)
39
- say "Found #{file}. Nothing to do. Good bye!", :green
40
- exit 0
41
- end
42
- end
43
-
44
- say "Configuration file not found."
45
- new_file = configuration.config_files.first
46
- say "New file created at #{new_file}."
47
- yaml = YAML.dump({
48
- default: {
49
- amp4e: {
50
- client_id: '',
51
- client_secret: '',
52
- host: 'api.amp.cisco.com',
53
- port: 443,
54
- scheme: 'https',
55
- },
56
- threatgrid: {
57
- api_key: '',
58
- host: 'panacea.threatgrid.com',
59
- port: 443,
60
- scheme: 'https',
61
- },
62
- }
63
- })
64
- say yaml, :yellow
65
- IO.write(new_file, yaml)
66
- end
67
35
  end
68
36
  end
69
37
  end
@@ -0,0 +1,49 @@
1
+ module ATS
2
+ module CLI
3
+ class Setup < Command
4
+ default_command :setup
5
+
6
+ desc 'setup', 'Initialize the .atsrc file.'
7
+ def setup
8
+ say "Current Configuration:", :green
9
+ say JSON.pretty_generate(configuration.to_h), :green
10
+
11
+ configuration.config_files.each do |file|
12
+ if File.exist?(file)
13
+ say "Found #{file}. Nothing to do. Good bye!", :green
14
+ exit 0
15
+ end
16
+ end
17
+
18
+ say "Configuration file not found."
19
+ new_file = configuration.config_files.first
20
+ say "New file created at #{new_file}."
21
+ yaml = YAML.dump(default_settings)
22
+ say yaml, :yellow
23
+ IO.write(new_file, yaml)
24
+ end
25
+
26
+ private
27
+
28
+ def default_settings
29
+ {
30
+ default: {
31
+ amp4e: {
32
+ client_id: '',
33
+ client_secret: '',
34
+ host: 'api.amp.cisco.com',
35
+ port: 443,
36
+ scheme: 'https',
37
+ },
38
+ threatgrid: {
39
+ api_key: '',
40
+ host: 'panacea.threatgrid.com',
41
+ port: 443,
42
+ scheme: 'https',
43
+ },
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module ATS
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - mokha
@@ -93,6 +93,7 @@ files:
93
93
  - lib/ats/cli/amp4e/groups.rb
94
94
  - lib/ats/cli/amp4e/policies.rb
95
95
  - lib/ats/cli/command.rb
96
+ - lib/ats/cli/setup.rb
96
97
  - lib/ats/cli/threat_grid/application.rb
97
98
  - lib/ats/cli/threat_grid/organizations.rb
98
99
  - lib/ats/cli/threat_grid/samples.rb