class Dawn::Cli::Kb
This class is responsible for the “dawn kb” command and related subcommands.
Public Instance Methods
find(string)
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 21 def find(string) init_globals kb = Dawn::KnowledgeBase.instance kb.find(string) end
init_globals()
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 14 def init_globals $debug = true if options[:debug] $verbose = true if options[:verbose] end
lint()
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 28 def lint init_globals kb = Dawn::KnowledgeBase.instance kb.load(true) end
list(gem_name, gem_version=nil)
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 63 def list(gem_name, gem_version=nil) init_globals to_check="#{gem_name}" to_check += ":#{gem_version}" unless gem_version.nil? Dawn::KnowledgeBase.enabled_checks=[:bulletin] kb = Dawn::KnowledgeBase.instance kb.load if kb.security_checks.empty? $logger.error(kb.error) end issues = kb.find_issues_by_gem(to_check) issues.each do |issue| puts "#{issue.name} " end end
status()
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 45 def status init_globals $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
unpack()
click to toggle source
# File lib/dawn/cli/dawn_cli.rb, line 35 def unpack init_globals $logger.helo APPNAME, Dawn::VERSION kb = Dawn::KnowledgeBase.instance kb.unpack $logger.bye Kernel.exit(0) end