Skip to content

Commit 603312d

Browse files
authored
Merge pull request #34 from mikesaelim/cleanup-database
Remove check for stale database that is no longer effective
2 parents 7b2a8a6 + 1c383da commit 603312d

File tree

4 files changed

+14
-36
lines changed

4 files changed

+14
-36
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased]
77

8+
### Removed
9+
10+
* [#34](https://github.com/civisanalytics/ruby_audit/pull/34)
11+
Removed check for stale database that no longer does anything
12+
813
### Fixed
914

1015
* [#35](https://github.com/civisanalytics/ruby_audit/pull/35)

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ $ ruby-audit check -n
5757

5858
After checking out the repo, run `bin/setup` to install dependencies.
5959
You'll also want to run `git submodule update --init` to populate the ruby-advisory-db
60-
submodule used for testing. Then, run `rake spec` to run the tests.
60+
submodule in `/vendor` that is used for testing. Then, run `rake spec` to run the tests.
6161
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
6262

63+
The database in `/vendor/ruby-advisory-db` is only used as a fixture for unit tests.
64+
By default, the database used for actual vulnerability checks is stored at `~/.local/share/ruby-advisory-db`.
65+
6366
To install this gem onto your local machine, run `bundle exec rake install`.
6467
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
6568

lib/ruby_audit/cli.rb

+5-17
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class CLI < ::Thor
1212
def check
1313
update unless options[:no_update]
1414

15-
check_for_stale_database
16-
1715
scanner = Scanner.new
1816
vulnerable = false
1917

@@ -30,7 +28,6 @@ def check
3028
end
3129
end
3230

33-
# Copied from bundler-audit master. Not present in 0.4.0.
3431
desc 'update', 'Updates the ruby-advisory-db'
3532
def update
3633
say 'Updating ruby-advisory-db ...'
@@ -45,14 +42,16 @@ def update
4542
say 'Skipping update', :yellow
4643
end
4744

48-
puts "ruby-advisory-db: #{Database.new.size} advisories"
45+
database = Database.new
46+
puts "ruby-advisory-db: #{database.size} advisories, " \
47+
"last updated #{database.last_updated_at.utc}"
4948
end
5049

5150
desc 'version', 'Prints the ruby-audit version'
5251
def version
5352
database = Database.new
54-
puts "#{File.basename($PROGRAM_NAME)} #{VERSION} "\
55-
"(advisories: #{database.size})"
53+
puts "#{File.basename($PROGRAM_NAME)} #{VERSION} " \
54+
"(advisories: #{database.size}, last updated: #{database.last_updated_at.utc})"
5655
end
5756

5857
private
@@ -122,16 +121,5 @@ def print_advisory(gem, advisory)
122121
# rubocop:enable Metrics/MethodLength
123122
# rubocop:enable Metrics/CyclomaticComplexity
124123
# rubocop:enable Metrics/AbcSize
125-
126-
def check_for_stale_database
127-
database = Database.new
128-
return unless database.size == 89
129-
130-
# bundler-audit 0.4.0 comes bundled with an old verison of
131-
# ruby-advisory-db that has 89 advisories and NO advisories for Ruby
132-
# or RubyGems. If #size == 89, the database has never been updated.
133-
say 'The database must be updated before using RubyAudit', :red
134-
exit 1
135-
end
136124
end
137125
end

spec/cli_spec.rb

-18
This file was deleted.

0 commit comments

Comments
 (0)