Class: RubyAudit::CLI
- Inherits:
-
Thor
- Object
- Thor
- RubyAudit::CLI
- Defined in:
- lib/ruby_audit/cli.rb
Instance Method Summary collapse
Instance Method Details
#check ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_audit/cli.rb', line 12 def check update unless [:no_update] scanner = Scanner.new vulnerable = false scanner.scan(ignore: [:ignore]) do |result| vulnerable = true print_advisory result.gem, result.advisory end if vulnerable say 'Vulnerabilities found!', :red exit 1 else say 'No vulnerabilities found', :green end end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby_audit/cli.rb', line 32 def update say 'Updating ruby-advisory-db ...' case Database.update! when true say 'Updated ruby-advisory-db', :green when false say 'Failed updating ruby-advisory-db!', :red exit 1 when nil say 'Skipping update', :yellow end database = Database.new puts "ruby-advisory-db: #{database.size} advisories, " \ "last updated #{database.last_updated_at.utc}" end |