badgerbadgerbadger 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/rubygems.feature +22 -0
- data/features/support/hooks/rubygems.rb +33 -0
- data/lib/badger/cli.rb +3 -1
- data/lib/badger/helpers.rb +6 -3
- data/lib/badger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d17195725b29294f5856fe41ca79a9a5a8d40e
|
4
|
+
data.tar.gz: e074f95da2feee548aa73ad4360d851091ca5de0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f3dd2b3dee49f29a1bd4a1bc8b8b9d43520ad67ec6643f86588407c9794dfa4777b6a31afb377e0832e79568b8852f5859b679b9e8890c030fe7b22b729f4f2
|
7
|
+
data.tar.gz: d909197dda9e0af3ca08dd7afd82129abb28586e90f647c752df8724af01192e288d8fbff0933ed6156f02069c404ef5488ea1539a273131d50649a550cb6877
|
data/features/rubygems.feature
CHANGED
@@ -22,3 +22,25 @@ Feature: Get rubygems badge
|
|
22
22
|
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
|
23
23
|
[![License](http://img.shields.io/:license-gpl3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html)
|
24
24
|
"""
|
25
|
+
|
26
|
+
@gemspecnolicense
|
27
|
+
Scenario: Handle a gemspec *without* a license
|
28
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
29
|
+
Then the output should contain:
|
30
|
+
"""
|
31
|
+
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
32
|
+
"""
|
33
|
+
|
34
|
+
And the output should not contain:
|
35
|
+
"""
|
36
|
+
License
|
37
|
+
"""
|
38
|
+
|
39
|
+
@gemspecwiths
|
40
|
+
Scenario: Handle a gemspec with 's' not 'spec'
|
41
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
42
|
+
Then the output should contain:
|
43
|
+
"""
|
44
|
+
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
45
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
46
|
+
"""
|
@@ -27,6 +27,39 @@ Before '@gemspecmultilicense' do
|
|
27
27
|
end
|
28
28
|
EOF
|
29
29
|
|
30
|
+
f = File.open "#{$temp_repo}/suchgem.gemspec", 'w'
|
31
|
+
f.write fakespec
|
32
|
+
f.close
|
33
|
+
end
|
34
|
+
|
35
|
+
Before '@gemspecnolicense' do
|
36
|
+
fakespec = <<EOF
|
37
|
+
# coding: utf-8
|
38
|
+
lib = File.expand_path('../lib', __FILE__)
|
39
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
40
|
+
|
41
|
+
Gem::Specification.new do |spec|
|
42
|
+
spec.name = 'suchgem'
|
43
|
+
end
|
44
|
+
EOF
|
45
|
+
|
46
|
+
f = File.open "#{$temp_repo}/suchgem.gemspec", 'w'
|
47
|
+
f.write fakespec
|
48
|
+
f.close
|
49
|
+
end
|
50
|
+
|
51
|
+
Before '@gemspecwiths' do
|
52
|
+
fakespec = <<EOF
|
53
|
+
# coding: utf-8
|
54
|
+
lib = File.expand_path('../lib', __FILE__)
|
55
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
56
|
+
|
57
|
+
Gem::Specification.new do |s|
|
58
|
+
s.name = 'suchgem'
|
59
|
+
s.licenses = ['MIT', 'apache']
|
60
|
+
end
|
61
|
+
EOF
|
62
|
+
|
30
63
|
f = File.open "#{$temp_repo}/suchgem.gemspec", 'w'
|
31
64
|
f.write fakespec
|
32
65
|
f.close
|
data/lib/badger/cli.rb
CHANGED
@@ -26,9 +26,11 @@ module Badger
|
|
26
26
|
|
27
27
|
if gemspec_params = Badger.search_gemspec(dir)
|
28
28
|
@badger.rubygem gemspec_params[:rubygem]
|
29
|
-
gemspec_params[:licenses]
|
29
|
+
if gemspec_params[:licenses]
|
30
|
+
gemspec_params[:licenses].each do |license_type|
|
30
31
|
@badger.license license_type
|
31
32
|
end
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
if license_type = Badger.find_license(dir)
|
data/lib/badger/helpers.rb
CHANGED
@@ -71,9 +71,12 @@ module Badger
|
|
71
71
|
if spec_file
|
72
72
|
params = {}
|
73
73
|
gs = File.readlines(File.join(dir, spec_file))
|
74
|
-
params[:rubygem] = eval (gs.grep /\.name /)[0].sub(
|
75
|
-
|
76
|
-
|
74
|
+
params[:rubygem] = eval (gs.grep /\.name /)[0].sub(/^\s.*\./, '')
|
75
|
+
lines = (gs.grep /licenses?/)
|
76
|
+
if lines.any?
|
77
|
+
l = eval (lines[0]).sub(/^\s.*\./, '')
|
78
|
+
params[:licenses] = l.class.name == 'Array' ? l : [l]
|
79
|
+
end
|
77
80
|
end
|
78
81
|
|
79
82
|
params || nil
|
data/lib/badger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: badgerbadgerbadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|