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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e682c69de61ad736e0f3f3ffbc44dd429054cfd1
4
- data.tar.gz: 281099bff9ad2c4b89b5acfe16a9239d98270ca2
3
+ metadata.gz: 873cfc9ef679bf35d9023e872441d326cef2e62c
4
+ data.tar.gz: eddf2189cf54fc5c48f016fbde2f6353512ced7d
5
5
  SHA512:
6
- metadata.gz: d6b159898c555ba7324d825203a4a511d9e0ba9edd6e2d2a8a4849bf0a93883b99b4ea37fe55f37e77114dae59f8b1bdb335efd3090f6e36f2e583f7e489153a
7
- data.tar.gz: 4cb5adf1d1e3893a60c81708a288340f6dc31add67c8743833609320edd7bdc27f27f69301ada907edf3ae2917f55de49e081e0f969c8932a13dcae3a1da26bc
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
- ### RSpec
33
+ ### Test
34
34
 
35
35
  ```ruby
36
- require 'brakecheck/rspec'
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("brakeman").to be_the_latest_version
44
+ expect(Brakecheck.compare('brakeman')).to include(true)
45
45
  end
46
46
 
47
47
  after do
@@ -3,7 +3,7 @@ require 'brakecheck'
3
3
  abort "Need gem name as only argument" unless ARGV.size == 1
4
4
  gem_name = ARGV[0]
5
5
 
6
- success, message = Brakecheck::Core.compare(gem_name)
6
+ success, message = Brakecheck.compare(gem_name)
7
7
  if success
8
8
  puts message
9
9
  else
@@ -3,31 +3,29 @@ require "open-uri"
3
3
  require "bundler"
4
4
 
5
5
  module Brakecheck
6
- class Core
7
- RUBYGEMS_HOST = "https://rubygems.org"
8
- LOCK = Bundler.default_lockfile
6
+ RUBYGEMS_HOST = "https://rubygems.org"
7
+ LOCK = Bundler.default_lockfile
9
8
 
10
- def self.latest(gem_name)
11
- open("#{RUBYGEMS_HOST}/api/v1/versions/#{gem_name}/latest.json").read[/"version":"(.+?)"/, 1]
12
- rescue StandardError
13
- nil
14
- end
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
- def self.local(gem_name)
17
- lock = Bundler::LockfileParser.new(Bundler.read_file(LOCK))
18
- return unless spec = lock.specs.detect { |s| s.name == gem_name }
19
- spec.version.to_s
20
- end
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
- def self.compare(gem_name)
23
- return [false, "#{gem_name} not found in #{LOCK.basename}"] unless local = local(gem_name)
24
- return [false, "#{gem_name} not found on #{RUBYGEMS_HOST}"] unless latest = latest(gem_name)
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
- if latest == local
27
- [true, "Latest #{gem_name} #{latest} installed"]
28
- else
29
- [false, "Local version #{local} of #{gem_name} is not the latest version #{latest}"]
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
@@ -1,3 +1,3 @@
1
1
  module Brakecheck
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.1"
3
3
  end
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.9
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-06 00:00:00.000000000 Z
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:
@@ -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