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 +4 -4
- data/features/services.feature +4 -0
- data/lib/badger/cli.rb +1 -14
- data/lib/badger/helpers.rb +24 -4
- data/lib/badger/license.rb +3 -3
- data/lib/badger/version.rb +1 -1
- data/spec/badger_spec.rb +10 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 960c2166ccb9788e9af1d694f3144c56a2b3415c
|
4
|
+
data.tar.gz: 7d9ef2667dd72ba192a0ccc1ad70cae43de00dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09d9cca1eb89bf73a84dd6979ce25582c78298a01c95941e68d30b9908a1ec9c71b1e8adb668b06eee09e5533cb6d09a9f989a9eda04d6c82274ba71bb286f04
|
7
|
+
data.tar.gz: 85cf59f9b49b9b35ff923536860e82c3f52630c25ead8227176ce1af1099cbba3d3239d6c89a8de29042a1715931d7f795f9b4aa47fc5a57d970dd2fc65b0118
|
data/features/services.feature
CHANGED
@@ -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
|
-
|
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
|
data/lib/badger/helpers.rb
CHANGED
@@ -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
|
51
|
-
params[:rubygem]
|
52
|
-
l
|
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
|
|
data/lib/badger/license.rb
CHANGED
data/lib/badger/version.rb
CHANGED
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
|
-
|
10
|
-
|
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
|
}
|