Class: WssAgent::CLI

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

Instance Method Summary collapse

Instance Method Details

#check_policiesObject



45
46
47
48
49
# File 'lib/wss_agent/cli.rb', line 45

def check_policies
  WssAgent.enable_debug! if options['verbose']
  result = Specifications.check_policies(options)
  (result.success? && result.policy_violations?) ? exit(1) : exit(0)
end

#configObject



4
5
6
7
8
9
# File 'lib/wss_agent/cli.rb', line 4

def config
  File.open(File.join(Dir.pwd, Configure::CURRENT_CONFIG_FILE), 'w') do |f|
    f << File.read(Configure.custom_default_path)
  end
  ap 'Created the config file: wss_agent.yml'
end

#listObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/wss_agent/cli.rb', line 16

def list
  WssAgent.enable_debug! if options['verbose']
  results = Specifications.list(options)
  ap results
rescue Bundler::GemfileNotFound => ex
  ap ex.message, color: { string: :red }
rescue Bundler::GemNotFound => ex
  ap ex.message, color: { string: :red }
  ap "Could you execute 'bundle install' before", color: { string: :red }
end

#updateObject



33
34
35
36
37
38
39
40
# File 'lib/wss_agent/cli.rb', line 33

def update
  WssAgent.enable_debug! if options['verbose']
  result = Specifications.update(options)
  result.success? ? exit(0) : exit(1)
rescue => ex
  ap ex.message, color: { string: :red }
  abort
end

#versionObject



52
53
54
# File 'lib/wss_agent/cli.rb', line 52

def version
  puts WssAgent::VERSION
end