Class: Dawn::Cli::Kb

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

Overview

This class is responsible for the “dawn kb” command and related subcommands.

Instance Method Summary collapse

Instance Method Details

#find(string) ⇒ Object



11
12
13
14
# File 'lib/dawn/cli/dawn_cli.rb', line 11

def find(string)
  kb = Dawn::KnowledgeBase.instance
  kb.find(string)
end

#lintObject



17
18
19
20
# File 'lib/dawn/cli/dawn_cli.rb', line 17

def lint
  kb = Dawn::KnowledgeBase.instance
  kb.load(true)
end

#statusObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dawn/cli/dawn_cli.rb', line 32

def status
  $logger.helo APPNAME, Dawn::VERSION
  Dawn::KnowledgeBase.enabled_checks=[:bulletin, :generic_check]
  kb = Dawn::KnowledgeBase.instance
  kb.load
  if kb.security_checks.empty?
    $logger.error(kb.error)
  end
  $logger.info("" + kb.security_checks.count.to_s + " security checks loaded")
  if kb.is_packed?
    $logger.error "The knowledge base is packed. It must be unpacked with the 'unpack' command before it can be used"
  end
  $logger.bye
  Kernel.exit(0)
end

#unpackObject



23
24
25
26
27
28
29
# File 'lib/dawn/cli/dawn_cli.rb', line 23

def unpack
  $logger.helo APPNAME, Dawn::VERSION
  kb = Dawn::KnowledgeBase.instance
  kb.unpack
  $logger.bye
  Kernel.exit(0)
end