brakecheck 0.1.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/brakecheck +1 -1
- data/lib/brakecheck.rb +19 -21
- data/lib/brakecheck/version.rb +1 -1
- metadata +2 -3
- data/lib/brakecheck/rspec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 873cfc9ef679bf35d9023e872441d326cef2e62c
|
4
|
+
data.tar.gz: eddf2189cf54fc5c48f016fbde2f6353512ced7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbfa85bf619a516b93eaca15bdb06f415f8aed541c8555597ce4a310ab9d44fbc127cf1a14d5604f2c30c0686172a1fd6ddadfbb040d253c4c57f00e88e005bc
|
7
|
+
data.tar.gz: 73e7f068c63422f749ebf82888fdd4a61528d8715738a6df1454e5212bc671749f5eefee197ff13a532a91c3e58dad24c4d86c8a4fa6e90a52f70c985307bc57
|
data/README.md
CHANGED
@@ -30,10 +30,10 @@ gem install brakecheck
|
|
30
30
|
brakecheck rubocop
|
31
31
|
```
|
32
32
|
|
33
|
-
###
|
33
|
+
### Test
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
require 'brakecheck
|
36
|
+
require 'brakecheck'
|
37
37
|
|
38
38
|
describe "Brakeman" do
|
39
39
|
before do
|
@@ -41,7 +41,7 @@ describe "Brakeman" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "is up to date" do
|
44
|
-
expect(
|
44
|
+
expect(Brakecheck.compare('brakeman')).to include(true)
|
45
45
|
end
|
46
46
|
|
47
47
|
after do
|
data/bin/brakecheck
CHANGED
data/lib/brakecheck.rb
CHANGED
@@ -3,31 +3,29 @@ require "open-uri"
|
|
3
3
|
require "bundler"
|
4
4
|
|
5
5
|
module Brakecheck
|
6
|
-
|
7
|
-
|
8
|
-
LOCK = Bundler.default_lockfile
|
6
|
+
RUBYGEMS_HOST = "https://rubygems.org"
|
7
|
+
LOCK = Bundler.default_lockfile
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
def self.latest(gem_name)
|
10
|
+
open("#{RUBYGEMS_HOST}/api/v1/versions/#{gem_name}/latest.json").read[/"version":"(.+?)"/, 1]
|
11
|
+
rescue StandardError
|
12
|
+
nil
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def self.local(gem_name)
|
16
|
+
lock = Bundler::LockfileParser.new(Bundler.read_file(LOCK))
|
17
|
+
return unless spec = lock.specs.detect { |s| s.name == gem_name }
|
18
|
+
spec.version.to_s
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
def self.compare(gem_name)
|
22
|
+
return [false, "#{gem_name} not found in #{LOCK.basename}"] unless local = local(gem_name)
|
23
|
+
return [false, "#{gem_name} not found on #{RUBYGEMS_HOST}"] unless latest = latest(gem_name)
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
25
|
+
if latest == local
|
26
|
+
[true, "Latest #{gem_name} #{latest} installed"]
|
27
|
+
else
|
28
|
+
[false, "Local version #{local} of #{gem_name} is not the latest version #{latest}"]
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
data/lib/brakecheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brakecheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Panzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- bin/setup
|
102
102
|
- brakecheck.gemspec
|
103
103
|
- lib/brakecheck.rb
|
104
|
-
- lib/brakecheck/rspec.rb
|
105
104
|
- lib/brakecheck/version.rb
|
106
105
|
homepage: https://github.com/apanzerj/brakecheck
|
107
106
|
licenses:
|
data/lib/brakecheck/rspec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'brakecheck'
|
2
|
-
require 'rspec/expectations'
|
3
|
-
|
4
|
-
module Brakecheck
|
5
|
-
module RSpec
|
6
|
-
::RSpec::Matchers.define :be_the_latest_version do
|
7
|
-
match do |gem_name|
|
8
|
-
success, @message = Brakecheck::Core.compare(gem_name)
|
9
|
-
success
|
10
|
-
end
|
11
|
-
|
12
|
-
failure_message do |_gem_name|
|
13
|
-
@message
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|