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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3485c8ffd28bdd32ae9a4e42bbb32aa4fa1bad99
4
- data.tar.gz: 79fb67b4e0ba61450275c3ceba1a5c79733d1870
3
+ metadata.gz: 20d17195725b29294f5856fe41ca79a9a5a8d40e
4
+ data.tar.gz: e074f95da2feee548aa73ad4360d851091ca5de0
5
5
  SHA512:
6
- metadata.gz: 66ceff7a709d8034c19e2963c48d94af212e24936ccdd2882e44da808dc4e47fbf2bbc810fefe2f87a302ea70d81116748274a158ba36e6b4630aa2aaa9833d9
7
- data.tar.gz: ab7fd3b07922f3354b7fd54a8027437e938bd6324ef242074ba5f2fcad4c73e409cff6914df32902ac7b0207fb18b3b96f1852f6d57aae9861aa2db52d20e515
6
+ metadata.gz: 5f3dd2b3dee49f29a1bd4a1bc8b8b9d43520ad67ec6643f86588407c9794dfa4777b6a31afb377e0832e79568b8852f5859b679b9e8890c030fe7b22b729f4f2
7
+ data.tar.gz: d909197dda9e0af3ca08dd7afd82129abb28586e90f647c752df8724af01192e288d8fbff0933ed6156f02069c404ef5488ea1539a273131d50649a550cb6877
@@ -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].each do |license_type|
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)
@@ -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('spec.', '')
75
- l = eval (gs.grep /licenses?/)[0].sub('spec.', '')
76
- params[:licenses] = l.class.name == 'Array' ? l : [l]
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
@@ -1,3 +1,3 @@
1
1
  module Badger
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
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.2
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-05 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor