badgerbadgerbadger 0.8.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ ##Copyright (c) 2013 Sam Pikesley
2
+
3
+ #MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,32 +1,19 @@
1
1
  Before '@mit' do
2
- f = File.open "#{$temp_repo}/LICENSE.md", 'w'
3
- f.write "The MIT License (MIT)\n"
4
- f.close
2
+ FileUtils.cp "#{$licenses_dir}/mit.md", "#{$temp_repo}/LICENSE.md"
5
3
  end
6
4
 
7
5
  Before '@apache' do
8
- f = File.open "#{$temp_repo}/LICENSE.md", 'w'
9
- f.write "Apache License\n"
10
- f.write "Version 2.0\n"
11
- f.close
6
+ FileUtils.cp "#{$licenses_dir}/apache.txt", "#{$temp_repo}/LICENSE.txt"
12
7
  end
13
8
 
14
9
  Before '@gpl2' do
15
- f = File.open "#{$temp_repo}/LICENSE.md", 'w'
16
- f.write "GNU GENERAL PUBLIC LICENSE\n"
17
- f.write "Version 2\n"
18
- f.close
10
+ FileUtils.cp "#{$licenses_dir}/gpl-2.0.txt", "#{$temp_repo}/LICENSE.txt"
19
11
  end
20
12
 
21
13
  Before '@gpl3' do
22
- f = File.open "#{$temp_repo}/LICENSE.md", 'w'
23
- f.write "GNU GENERAL PUBLIC LICENSE\n"
24
- f.write "Version 3\n"
25
- f.close
14
+ FileUtils.cp "#{$licenses_dir}/gpl-3.0.txt", "#{$temp_repo}/LICENSE.txt"
26
15
  end
27
16
 
28
17
  Before '@doge-license' do
29
- f = File.open "#{$temp_repo}/LICENSE.md", 'w'
30
- f.write "WOW SUCH LICENSE\n"
31
- f.close
18
+ FileUtils.cp "#{$licenses_dir}/doge.md", "#{$temp_repo}/LICENSE.txt"
32
19
  end
@@ -12,7 +12,7 @@ module Badger
12
12
 
13
13
  desc 'badge', 'Generate badge markdown'
14
14
  long_desc File.read File.join File.dirname( __FILE__), '..', '..', 'DESC.md'
15
- method_option :png, :type => :boolean, :default => false, :desc => 'Generate PNG badges instead of the default SVG'
15
+ method_option :png, :type => :boolean, :default => false, :desc => 'Generate PNG badges instead of the default SVG (because sometimes Github does caching things)'
16
16
 
17
17
  def badge dir = '.'
18
18
  @badger = Badger.new Badger.git_remote dir
@@ -4,9 +4,22 @@ module Badger
4
4
  return nil unless params = Config.instance.services[name]
5
5
  params = Config.instance.services[name]
6
6
 
7
- badge_url = 'http://%s/%s/%s' % [
8
- Config.instance.config['badge_service'],
9
- params['badge_slug'],
7
+ scheme = params['scheme'] ||= 'http'
8
+ case params['offers_svg']
9
+ when true
10
+ base_url = '%s://%s' % [
11
+ scheme,
12
+ params['url_path']
13
+ ]
14
+ else
15
+ base_url = 'http://%s/%s' % [
16
+ Config.instance.config['badge_service'],
17
+ params['badge_slug']
18
+ ]
19
+ end
20
+
21
+ badge_url = '%s/%s' % [
22
+ base_url,
10
23
  github_slug
11
24
  ]
12
25
  target_url = 'https://%s/%s' % [
@@ -1,3 +1,3 @@
1
1
  module Badger
2
- VERSION = "0.8.3"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -39,13 +39,13 @@ module Badger
39
39
  context 'service badges' do
40
40
  it 'should have a travis badge' do
41
41
  @badger.add 'travis'
42
- @badger[0].should == "[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)"
42
+ @badger[0].should == "[![Build Status](https://travis-ci.org/doge/wow.svg)](https://travis-ci.org/doge/wow)"
43
43
  end
44
44
 
45
45
  it 'should have a travis badge and a gemnasium badge' do
46
46
  @badger.add 'travis'
47
47
  @badger.add 'gemnasium'
48
- @badger[0].should == "[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)"
48
+ @badger[0].should == "[![Build Status](https://travis-ci.org/doge/wow.svg)](https://travis-ci.org/doge/wow)"
49
49
  @badger[1].should == "[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)"
50
50
  @badger.length.should == 2
51
51
  end
@@ -97,7 +97,7 @@ module Badger
97
97
  @badger.add 'travis'
98
98
  @badger.add 'coveralls'
99
99
  @badger.bonus
100
- @badger[2].should == "[![Badges](http://img.shields.io/:badges-3/3-ff6799.svg)](https://github.com/pikesley/badger)"
100
+ @badger[2].should == "[![Badges](http://img.shields.io/:badges-3/3-ff6799.svg)](https://github.com/badges/badgerbadgerbadger)"
101
101
  end
102
102
  end
103
103
 
@@ -107,7 +107,7 @@ module Badger
107
107
  @badger.add 'codeclimate'
108
108
  @badger.license 'mit'
109
109
  @badger.to_s.should ==
110
- %{[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
110
+ %{[![Build Status](https://travis-ci.org/doge/wow.svg)](https://travis-ci.org/doge/wow)
111
111
  [![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
112
112
  [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
113
113
  }
@@ -117,13 +117,13 @@ module Badger
117
117
  it 'should work with a "-" in the remote name' do
118
118
  @badger = Badger.new 'https://github.com/pikesley/diabetes-dashboard.git'
119
119
  @badger.add 'travis'
120
- @badger[0].should == '[![Build Status](http://img.shields.io/travis/pikesley/diabetes-dashboard.svg)](https://travis-ci.org/pikesley/diabetes-dashboard)'
120
+ @badger[0].should == '[![Build Status](https://travis-ci.org/pikesley/diabetes-dashboard.svg)](https://travis-ci.org/pikesley/diabetes-dashboard)'
121
121
  end
122
122
 
123
123
  it 'should let me choose a different badge type' do
124
124
  @badger.badge_type 'png'
125
125
  @badger.add 'travis'
126
- @badger[0].should == '[![Build Status](http://img.shields.io/travis/doge/wow.png)](https://travis-ci.org/doge/wow)'
126
+ @badger[0].should == '[![Build Status](https://travis-ci.org/doge/wow.png)](https://travis-ci.org/doge/wow)'
127
127
  end
128
128
  end
129
129
  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.3
4
+ version: 0.9.0
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-10 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -206,7 +206,7 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '1.17'
209
- description: Generate Github project badges
209
+ description: Generate Github project badges like a boss
210
210
  email:
211
211
  - sam@pikesley.org
212
212
  executables:
@@ -236,6 +236,11 @@ files:
236
236
  - features/ssh-remote.feature
237
237
  - features/step_definitions/badger_steps.rb
238
238
  - features/support/env.rb
239
+ - features/support/fixtures/licenses/apache.txt
240
+ - features/support/fixtures/licenses/doge.md
241
+ - features/support/fixtures/licenses/gpl-2.0.txt
242
+ - features/support/fixtures/licenses/gpl-3.0.txt
243
+ - features/support/fixtures/licenses/mit.md
239
244
  - features/support/hooks/hooks.rb
240
245
  - features/support/hooks/licenses.rb
241
246
  - features/support/hooks/rubygems.rb
@@ -253,7 +258,7 @@ files:
253
258
  - lib/badger/version.rb
254
259
  - spec/badger_spec.rb
255
260
  - spec/spec_helper.rb
256
- homepage: https://github.com/pikesley/badger
261
+ homepage: http://badges.github.io/badgerbadgerbadger/
257
262
  licenses:
258
263
  - MIT
259
264
  metadata: {}
@@ -287,6 +292,11 @@ test_files:
287
292
  - features/ssh-remote.feature
288
293
  - features/step_definitions/badger_steps.rb
289
294
  - features/support/env.rb
295
+ - features/support/fixtures/licenses/apache.txt
296
+ - features/support/fixtures/licenses/doge.md
297
+ - features/support/fixtures/licenses/gpl-2.0.txt
298
+ - features/support/fixtures/licenses/gpl-3.0.txt
299
+ - features/support/fixtures/licenses/mit.md
290
300
  - features/support/hooks/hooks.rb
291
301
  - features/support/hooks/licenses.rb
292
302
  - features/support/hooks/rubygems.rb