diff --git a/DESC.md b/DESC.md index 32cc960..6742a7b 100644 --- a/DESC.md +++ b/DESC.md @@ -25,5 +25,3 @@ And if a license file is found, a License Badge will be generated. Currently sup * GPL-3 The supported license details are in `https://github.com/badges/badgerbadgerbadger/blob/master/config/licenses.yaml`, if you're using a different license, send a PR! And if your gemspec license conflicts with your LICENSE file, you should probably fix that. - -Use the `--pulls` flag to add badges for open Github issues and pull-requests. diff --git a/config/config.yaml b/config/config.yaml index db8ff3a..2e2b93f 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -2,4 +2,7 @@ badge_service: img.shields.io license_colour: blue bonus_badge_colour: ff6799 bonus_badge_link: https://github.com/badges/badgerbadgerbadger -badge_type: svg \ No newline at end of file +badge_type: svg +valid_styles: + - flat + - flat-square diff --git a/config/services.yaml b/config/services.yaml index 521988a..f28e4b0 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,23 +1,23 @@ travis: - alt_text: Build Status - scheme: https - url_path: travis-ci.org - badge_slug: travis + alt_text: Build Status + scheme: https + url_path: travis-ci.org + badge_slug: travis coveralls: - alt_text: Coverage Status - url_path: coveralls.io/r - badge_slug: coveralls + alt_text: Coverage Status + url_path: coveralls.io/r + badge_slug: coveralls gemnasium: - alt_text: Dependency Status - url_path: gemnasium.com - badge_slug: gemnasium + alt_text: Dependency Status + url_path: gemnasium.com + badge_slug: gemnasium codeclimate: - alt_text: Code Climate - url_path: codeclimate.com/github - badge_slug: codeclimate/github + alt_text: Code Climate + url_path: codeclimate.com/github + badge_slug: codeclimate/github pulls: alt_text: Pending Pull-Requests diff --git a/features/alternative-styles.feature b/features/alternative-styles.feature index 9d5229e..f360993 100644 --- a/features/alternative-styles.feature +++ b/features/alternative-styles.feature @@ -16,3 +16,10 @@ Feature: Alternative styles [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://doge.mit-license.org) [![Badges](http://img.shields.io/:badges-7/7-ff6799.svg?style=flat-square)](https://github.com/badges/badgerbadgerbadger) """ + Scenario: Invalid style choice + When I run `badger badge --style fluffy /tmp/wow_repo` + Then the output should contain: + """ + Invalid style choice 'fluffy' + """ + And the exit status should be 3 diff --git a/lib/badger/badger.rb b/lib/badger/badger.rb index 8e24dcc..bb81d35 100644 --- a/lib/badger/badger.rb +++ b/lib/badger/badger.rb @@ -38,6 +38,11 @@ def badge_type type end def style style + unless Config.instance.config['valid_styles'].include? style + puts "Invalid style choice '#{style}'" + exit 3 + end + Config.instance.config['badge_style'] = style end diff --git a/lib/badger/cli.rb b/lib/badger/cli.rb index 0d33abd..48d9276 100644 --- a/lib/badger/cli.rb +++ b/lib/badger/cli.rb @@ -14,12 +14,13 @@ def version long_desc File.read File.join File.dirname( __FILE__), '..', '..', 'DESC.md' method_option :png, :type => :boolean, :default => false, :desc => 'Generate PNG badges instead of the default SVG (because sometimes Github does caching things)' method_option :pulls, :type => :boolean, :default => false, :desc => 'Generate Github pull-request and issue-count badges' - method_option :style, :type => :string, :default => nil, :desc => "Choose a different badge style (currently supported: 'flat' or 'flat-square')" + method_option :style, :type => :string, :default => nil, :desc => "Choose a different badge style (currently supported: #{Config.instance.config['valid_styles'].join ', '})" def badge dir = '.' @badger = Badger.new Badger.git_remote dir @badger.badge_type 'png' if options[:png] + @badger.style options[:style] if options[:style] @badger.add 'travis' if Badger.has_travis? dir diff --git a/lib/badger/version.rb b/lib/badger/version.rb index db6e925..5690b56 100644 --- a/lib/badger/version.rb +++ b/lib/badger/version.rb @@ -1,3 +1,3 @@ module Badger - VERSION = "0.11.1" + VERSION = "0.11.2" end