mrjoy-bundler-audit 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6b9ab49f8c28f5409240c762d440a51472ed981
4
- data.tar.gz: e9befa665dd527051744e7edd7706cbece60d636
3
+ metadata.gz: 3960f49194360e5a5f36eec308bab61e5345e3bc
4
+ data.tar.gz: 65196e264e5b6d57fa4b614aabe3186bc21b3fdf
5
5
  SHA512:
6
- metadata.gz: d64dfbf30d2801b6c89be762b840cd9b676a26355883dc3eab09ed6b4d2721e0184457c8372407f50b4962b4f488690fe49d7a558fd6a8acb24e1ea8f5b7dd2f
7
- data.tar.gz: c090e2cc9dc19c62564aa3d56a3aa2a7cac6a6606dca9440bfcef2b1f12a0d2507a5051b911382e31022ffc19ccaa2e69def3bf9223222717fdc3e2cebfee0c8
6
+ metadata.gz: 234b6d8519148b7678e6054f254a0424ad5e8afdb1692a30960f69da57fcbe336db9a1a7ad6466e4660d0498fd1ae74749188241897d0d58e7f40f447f78c270
7
+ data.tar.gz: 54ee313243314ce7605c7d794d955adbadb694288308248faaa1d8d5e7fb8a44b2b690a3d73430644bc3a0f3351ccf51fc7fadd742e23f72979d07fe022e367a
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### mrjoy-0.3.5 / 2014-04-16
2
+
3
+ * Improve user experience when no vulnerability DB has been downloaded.
4
+ * Slight improvement to code coverage.
5
+
1
6
  ### mrjoy-0.3.4 / 2014-04-16
2
7
 
3
8
  * Integrate upstream changes from `gut_vendored_db`. This eliminates the
@@ -36,7 +36,12 @@ module Bundler
36
36
  method_option :ignore, :type => :array, :aliases => '-i'
37
37
 
38
38
  def check
39
- scanner = Scanner.new
39
+ begin
40
+ scanner = Scanner.new
41
+ rescue ArgumentError
42
+ print_setup_instructions
43
+ exit 1
44
+ end
40
45
  vulnerable = false
41
46
 
42
47
  # attempt update the database before doing a scan
@@ -71,9 +76,20 @@ module Bundler
71
76
 
72
77
  desc 'version', 'Prints the bundler-audit version'
73
78
  def version
74
- database = Database.new
79
+ cmd = File.basename($0)
80
+ advisories = nil
81
+ begin
82
+ database = Database.new
83
+ advisories = " (advisories: #{database.size})"
84
+ rescue ArgumentError
85
+ # Don't have a database yet.
86
+ end
75
87
 
76
- puts "#{File.basename($0)} #{VERSION} (advisories: #{database.size})"
88
+ say "#{cmd} #{VERSION}#{advisories}", :bold
89
+ if advisories.nil?
90
+ print_setup_instructions
91
+ exit 1
92
+ end
77
93
  end
78
94
 
79
95
  protected
@@ -106,6 +122,16 @@ module Bundler
106
122
  end
107
123
 
108
124
  protected
125
+
126
+ def print_setup_instructions
127
+ say ""
128
+ print_warning "You don't have a copy of the Ruby vulnerabilities database yet."
129
+ print_warning "To get the database, please run:"
130
+ say ""
131
+ print_warning " #{$0} update"
132
+ say ""
133
+ end
134
+
109
135
  def print_affected_gem(gem)
110
136
  say "Name: ", :red
111
137
  say gem.name
@@ -20,6 +20,6 @@
20
20
  module Bundler
21
21
  module Audit
22
22
  # bundler-audit version
23
- VERSION = '0.3.4'
23
+ VERSION = '0.3.5'
24
24
  end
25
25
  end
@@ -60,6 +60,27 @@ Solution: upgrade to ((~>|=>) \d+.\d+.\d+, )*(~>|=>) \d+.\d+.\d+[\s\n]*?)+/
60
60
  end
61
61
  end
62
62
 
63
+ context "when displaying bundler-audit version" do
64
+ let(:bundle) { 'unpatched_gems' }
65
+ let(:directory) { File.join('spec','bundle',bundle) }
66
+
67
+ let(:command) do
68
+ File.expand_path('../bundle/wrapper.rb', __FILE__) + " version"
69
+ end
70
+
71
+ subject do
72
+ # Ignoring failure here as bundle-audit version seems to return a
73
+ # non-zero status, and
74
+ Dir.chdir(directory) { sh(command, :fail => false) }
75
+ end
76
+
77
+ it "should show the version and number of known advisories" do
78
+ # It prints a name based on $0, so our wrapper mucks up the display in a
79
+ # predictable way.
80
+ subject.should match(/^wrapper\.rb #{Regexp.quote('0.3.4')} \(advisories: \d+\)/)
81
+ end
82
+ end
83
+
63
84
  context "when auditing a bundle with ignored gems" do
64
85
  let(:bundle) { 'unpatched_gems' }
65
86
  let(:directory) { File.join('spec','bundle',bundle) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrjoy-bundler-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern