badgerbadgerbadger 0.7.5 → 0.8.0

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: 5c69f958d3d1db2bef57ccb39b2b355d4663518f
4
- data.tar.gz: 50004b604e1a88580500e3d2fd9dcf87a3a25ae4
3
+ metadata.gz: 8ae58ef80b784589eb8a771600e24964f2b7a175
4
+ data.tar.gz: 6dcc7fa5013a11f2b225db292aa084ba49b26e57
5
5
  SHA512:
6
- metadata.gz: c8a2646a748c17a58ae4cbc28a300087e15990e168839833346ab171e1ab8f1af2d82942dff6c3c34458862deb182097f82fd84b00ccd9080be753585e121434
7
- data.tar.gz: f99828aeba35cac9a48064e41ea42dafb4ebb5a3f100d7467cbc1e78fb4c3216279560e7ae210626b5c4095acf450390e77d5589831f5988714d09c5de1281dc
6
+ metadata.gz: cfea32ab36bebf314ccfee0807577dc7f182d5475f5d6aed023f7928f335533a8b64e356e5b776f9d04b16bb2f14f96c527c909444bbbdb3378669a021c23a68
7
+ data.tar.gz: d799173f26852c63c1b3fc98711b55c1e6a286c7dd6e6a11641bd6ac98d04f29b6dcab353b51dd37a0b88593c52dd6610e48e647ed2188c715b5f8cec18fcc61
data/config/config.yaml CHANGED
@@ -1,4 +1,5 @@
1
1
  badge_service: img.shields.io
2
2
  license_colour: blue
3
3
  bonus_badge_colour: ff6799
4
- bonus_badge_link: https://github.com/pikesley/badger
4
+ bonus_badge_link: https://github.com/pikesley/badger
5
+ badge_type: svg
@@ -0,0 +1,18 @@
1
+ Feature: Badge robot
2
+
3
+ Background:
4
+ Given git remote is "https://github.com/doge/wow"
5
+
6
+ @travis @gemnasium @coveralls @gemspec @mit
7
+ Scenario: One with everything
8
+ When I successfully run `badger badge /tmp/wow_repo --png `
9
+ Then the output should contain:
10
+ """
11
+ [![Build Status](http://img.shields.io/travis/doge/wow.png)](https://travis-ci.org/doge/wow)
12
+ [![Dependency Status](http://img.shields.io/gemnasium/doge/wow.png)](https://gemnasium.com/doge/wow)
13
+ [![Coverage Status](http://img.shields.io/coveralls/doge/wow.png)](https://coveralls.io/r/doge/wow)
14
+ [![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.png)](https://codeclimate.com/github/doge/wow)
15
+ [![Gem Version](http://img.shields.io/gem/v/suchgem.png)](https://rubygems.org/gems/suchgem)
16
+ [![License](http://img.shields.io/:license-mit-blue.png)](http://doge.mit-license.org)
17
+ [![Badges](http://img.shields.io/:badges-7/7-ff6799.png)](https://github.com/pikesley/badger)
18
+ """
data/lib/badger/badge.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  module Badger
2
2
  def Badger.badge text, badge_url, target_url
3
- "[![%s](%s)](%s)" % [
3
+ "[![%s](%s.%s)](%s)" % [
4
4
  text,
5
5
  badge_url,
6
+ Config.instance.config['badge_type'],
6
7
  target_url
7
8
  ]
8
9
  end
data/lib/badger/badger.rb CHANGED
@@ -33,6 +33,10 @@ module Badger
33
33
  self << Bonus.badge(self)
34
34
  end
35
35
 
36
+ def badge_type type
37
+ Config.instance.config['badge_type'] = type
38
+ end
39
+
36
40
  def to_s
37
41
  self.uniq!
38
42
 
data/lib/badger/bonus.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Badger
2
2
  class Bonus
3
3
  def self.badge badger
4
- badge_url = 'http://%s/:badges-%d/%d-%s.svg' % [
4
+ badge_url = 'http://%s/:badges-%d/%d-%s' % [
5
5
  Config.instance.config['badge_service'],
6
6
  badger.length + 1,
7
7
  badger.length + 1,
data/lib/badger/cli.rb CHANGED
@@ -5,10 +5,13 @@ module Badger
5
5
 
6
6
  desc 'badge', 'Generate badge markdown'
7
7
  long_desc File.read File.join File.dirname( __FILE__), '..', '..', 'DESC.md'
8
+ method_option :png, :type => :boolean, :default => false, :desc => 'Generate PNG badges instead of the default SVG'
8
9
 
9
10
  def badge dir = '.'
10
11
  @badger = Badger.new Badger.git_remote dir
11
12
 
13
+ @badger.badge_type 'png' if options[:png]
14
+
12
15
  @badger.add 'travis' if Badger.has_travis? dir
13
16
  @badger.add 'gemnasium' if Badger.has_gemfile? dir
14
17
  @badger.add 'coveralls' if Badger.has_coveralls? dir
data/lib/badger/config.rb CHANGED
@@ -21,6 +21,10 @@ module Badger
21
21
  @config
22
22
  end
23
23
 
24
+ # def badge_type= type
25
+ # @config['badge_type'] = type
26
+ # end
27
+
24
28
  private
25
29
 
26
30
  def fetch_yaml file
@@ -10,7 +10,7 @@ module Badger
10
10
  end
11
11
 
12
12
  badge_text = type unless badge_text = params['badge_text']
13
- badge_url = 'http://%s/:license-%s-%s.svg' % [
13
+ badge_url = 'http://%s/:license-%s-%s' % [
14
14
  Config.instance.config['badge_service'],
15
15
  badge_text,
16
16
  Config.instance.config['license_colour']
@@ -1,7 +1,7 @@
1
1
  module Badger
2
2
  class Rubygem
3
3
  def self.badge name
4
- badge_url = 'http://%s/gem/v/%s.svg' % [
4
+ badge_url = 'http://%s/gem/v/%s' % [
5
5
  Config.instance.config['badge_service'],
6
6
  name
7
7
  ]
@@ -4,7 +4,7 @@ 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.svg' % [
7
+ badge_url = 'http://%s/%s/%s' % [
8
8
  Config.instance.config['badge_service'],
9
9
  params['badge_slug'],
10
10
  github_slug
@@ -1,3 +1,3 @@
1
1
  module Badger
2
- VERSION = "0.7.5"
2
+ VERSION = "0.8.0"
3
3
  end
data/spec/badger_spec.rb CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  module Badger
4
4
  describe Badger do
5
5
  before :each do
6
+ Config.instance.config['badge_type'] = 'svg'
6
7
  @badger = Badger.new "https://github.com/doge/wow"
7
8
  end
8
9
 
@@ -115,5 +116,11 @@ module Badger
115
116
  @badger.add 'travis'
116
117
  @badger[0].should == '[![Build Status](http://img.shields.io/travis/pikesley/diabetes-dashboard.svg)](https://travis-ci.org/pikesley/diabetes-dashboard)'
117
118
  end
119
+
120
+ it 'should let me choose a different badge type' do
121
+ @badger.badge_type 'png'
122
+ @badger.add 'travis'
123
+ @badger[0].should == '[![Build Status](http://img.shields.io/travis/doge/wow.png)](https://travis-ci.org/doge/wow)'
124
+ end
118
125
  end
119
126
  end
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.7.5
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pikesley
@@ -230,6 +230,7 @@ files:
230
230
  - config/services.yaml
231
231
  - features/badger.feature
232
232
  - features/licenses.feature
233
+ - features/png.feature
233
234
  - features/rubygems.feature
234
235
  - features/services.feature
235
236
  - features/ssh-remote.feature
@@ -280,6 +281,7 @@ summary: Badge-Driven Development made easy. Generate a set of Github badges for
280
281
  test_files:
281
282
  - features/badger.feature
282
283
  - features/licenses.feature
284
+ - features/png.feature
283
285
  - features/rubygems.feature
284
286
  - features/services.feature
285
287
  - features/ssh-remote.feature