lib/bundler/audit/cli.rb in mrjoy-bundler-audit-0.3.5 vs lib/bundler/audit/cli.rb in mrjoy-bundler-audit-0.3.6
- old
+ new
@@ -40,30 +40,41 @@
scanner = Scanner.new
rescue ArgumentError
print_setup_instructions
exit 1
end
- vulnerable = false
# attempt update the database before doing a scan
scanner.database.update!
+ unpatched_versions = false
+ insecure_sources = false
scanner.scan(:ignore => options.ignore) do |result|
- vulnerable = true
case result
when Scanner::InsecureSource
+ insecure_sources = true
print_warning "Insecure Source URI found: #{result.source}"
when Scanner::UnpatchedGem
+ unpatched_versions = true
print_advisory result.gem, result.advisory
end
end
- if vulnerable
+ if unpatched_versions
say "Unpatched versions found!", :red
- exit 1
else
say "No unpatched versions found", :green
+ end
+
+ if insecure_sources
+ say "Insecure sources found!", :red
+ else
+ say "No insecure sources found", :green
+ end
+
+ if unpatched_versions || insecure_sources
+ exit 1
end
end
desc 'update', 'Updates the ruby-advisory-db'
def update