badgerbadgerbadger 0.6.1 → 0.6.3

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: 4ec7710cd5d4ef7c1241f118046e64b48c2d9d05
4
- data.tar.gz: ae51cb87093ec657c6ab2a3722dab3bb354720a0
3
+ metadata.gz: 960c2166ccb9788e9af1d694f3144c56a2b3415c
4
+ data.tar.gz: 7d9ef2667dd72ba192a0ccc1ad70cae43de00dd1
5
5
  SHA512:
6
- metadata.gz: a4f2b08424a3c9f284811befdb5f924ebf228a24e2623828ffd106f96cf025a18934059a4b81f07765c6d635bb93c42510d5a5919e37f76f2b62bdfaf6a411fe
7
- data.tar.gz: 1deda617e2d5f783a3b48987d7e96189e519aa9cc0c267a12a92b7da8e9619467f90063bc83243557e783b57215e8c48bd6a7c7f66560ed3b51991809643f1d5
6
+ metadata.gz: 09d9cca1eb89bf73a84dd6979ce25582c78298a01c95941e68d30b9908a1ec9c71b1e8adb668b06eee09e5533cb6d09a9f989a9eda04d6c82274ba71bb286f04
7
+ data.tar.gz: 85cf59f9b49b9b35ff923536860e82c3f52630c25ead8227176ce1af1099cbba3d3239d6c89a8de29042a1715931d7f795f9b4aa47fc5a57d970dd2fc65b0118
@@ -18,6 +18,10 @@ Feature: Get service badges
18
18
  """
19
19
  [![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
20
20
  """
21
+ And the output should not contain:
22
+ """
23
+ [![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
24
+ """
21
25
 
22
26
  @gemnasium
23
27
  Scenario: Generate gemnasium badge
data/lib/badger/cli.rb CHANGED
@@ -36,20 +36,7 @@ The supported license details are in https://github.com/pikesley/badger/blob/mas
36
36
  LONGDESC
37
37
 
38
38
  def badge dir = '.'
39
- begin
40
- @g = Git.open(dir)
41
- rescue ArgumentError
42
- puts 'Run this from inside a git repo'
43
- exit 1
44
- end
45
-
46
- @r = @g.remote.url
47
- if @r.nil?
48
- puts 'This repo does not appear to have a github remote'
49
- exit 2
50
- end
51
-
52
- @badger = Badger.new @r
39
+ @badger = Badger.new Badger.git_remote dir
53
40
 
54
41
  @badger.add 'travis' if Badger.has_travis? dir
55
42
  @badger.add 'gemnasium' if Badger.has_gemfile? dir
@@ -1,4 +1,24 @@
1
1
  module Badger
2
+
3
+ def Badger.is_repo? dir
4
+ begin
5
+ Git.open(dir)
6
+ rescue ArgumentError
7
+ puts 'Run this from inside a git repo'
8
+ exit 1
9
+ end
10
+ end
11
+
12
+ def Badger.git_remote dir
13
+ remote = is_repo?(dir).remote.url
14
+ if remote.nil?
15
+ puts 'This repo does not appear to have a github remote'
16
+ exit 2
17
+ end
18
+
19
+ remote
20
+ end
21
+
2
22
  def Badger.has_travis? dir
3
23
  ((Dir.entries dir).select { |i| '.travis.yml' == i }).any?
4
24
  end
@@ -46,10 +66,10 @@ module Badger
46
66
  spec_file = spec_files(dir)[0]
47
67
 
48
68
  if spec_file
49
- params = {}
50
- gs = File.readlines(File.join(dir, spec_file))
51
- params[:rubygem] = eval (gs.grep /\.name /)[0].sub('spec.', '')
52
- l = eval (gs.grep /licenses?/)[0].sub('spec.', '')
69
+ params = {}
70
+ gs = File.readlines(File.join(dir, spec_file))
71
+ params[:rubygem] = eval (gs.grep /\.name /)[0].sub('spec.', '')
72
+ l = eval (gs.grep /licenses?/)[0].sub('spec.', '')
53
73
  params[:licenses] = l.class.name == 'Array' ? l : [l]
54
74
  end
55
75
 
@@ -19,8 +19,8 @@ module Badger
19
19
  Badger.badge 'License', badge_url, target_url
20
20
  end
21
21
 
22
- def self.licenses
23
- @@licenses
24
- end
22
+ # def self.licenses
23
+ # @@licenses
24
+ # end
25
25
  end
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module Badger
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.3"
3
3
  end
data/spec/badger_spec.rb CHANGED
@@ -6,8 +6,10 @@ module Badger
6
6
  @badger = Badger.new "https://github.com/doge/wow.git"
7
7
  end
8
8
 
9
- it 'should have no badges by default' do
10
- @badger.length.should == 0
9
+ context 'initialisation' do
10
+ it 'should have no badges by default' do
11
+ @badger.length.should == 0
12
+ end
11
13
  end
12
14
 
13
15
  context 'get the user and repo' do
@@ -15,13 +17,14 @@ module Badger
15
17
  @badger.github_slug.should eql('doge/wow')
16
18
  end
17
19
 
18
- it 'extracts from an ssh url' do
19
- @badger.github_slug.should eql('doge/wow')
20
- end
21
-
22
20
  it 'extracts the owner' do
23
21
  @badger.owner.should eql 'doge'
24
22
  end
23
+
24
+ it 'extracts from an ssh url' do
25
+ @badger = Badger.new "git@github.com:doge/wow.git"
26
+ @badger.github_slug.should eql('doge/wow')
27
+ end
25
28
  end
26
29
 
27
30
  context 'service badges' do
@@ -86,7 +89,7 @@ module Badger
86
89
  @badger.add 'codeclimate'
87
90
  @badger.license 'mit'
88
91
  @badger.to_s.should ==
89
- %{[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
92
+ %{[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
90
93
  [![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
91
94
  [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
92
95
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: badgerbadgerbadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - pikesley