lib/bundler/audit/cli.rb in bundler-audit-0.4.0 vs lib/bundler/audit/cli.rb in bundler-audit-0.5.0

- old
+ new

@@ -1,7 +1,7 @@ # -# Copyright (c) 2013-2015 Hal Brodigan (postmodern.mod3 at gmail.com) +# Copyright (c) 2013-2016 Hal Brodigan (postmodern.mod3 at gmail.com) # # bundler-audit is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -30,12 +30,15 @@ map '--version' => :version desc 'check', 'Checks the Gemfile.lock for insecure dependencies' method_option :verbose, :type => :boolean, :aliases => '-v' method_option :ignore, :type => :array, :aliases => '-i' + method_option :update, :type => :boolean, :aliases => '-u' def check + update if options[:update] + scanner = Scanner.new vulnerable = false scanner.scan(:ignore => options.ignore) do |result| vulnerable = true @@ -58,10 +61,19 @@ desc 'update', 'Updates the ruby-advisory-db' def update say "Updating ruby-advisory-db ..." - Database.update! + 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 + puts "ruby-advisory-db: #{Database.new.size} advisories" end desc 'version', 'Prints the bundler-audit version' def version