badgerbadgerbadger 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/README.md +2 -3
- data/badger.gemspec +1 -1
- data/bin/badger +0 -1
- data/config/licenses.yaml +2 -2
- data/config/services.yaml +16 -23
- data/features/badger.feature +7 -77
- data/features/licenses.feature +10 -2
- data/features/rubygems.feature +13 -0
- data/features/services.feature +49 -0
- data/features/step_definitions/badger_steps.rb +1 -1
- data/features/support/env.rb +2 -1
- data/features/support/hooks/hooks.rb +16 -0
- data/features/support/hooks/licenses.rb +32 -0
- data/features/support/hooks/rubygems.rb +16 -0
- data/features/support/hooks/services.rb +17 -0
- data/lib/badger.rb +4 -3
- data/lib/badger/badger.rb +20 -88
- data/lib/badger/cli.rb +24 -34
- data/lib/badger/config.rb +27 -0
- data/lib/badger/helpers.rb +53 -0
- data/lib/badger/license.rb +13 -15
- data/lib/badger/rubygem.rb +11 -0
- data/lib/badger/service.rb +13 -3
- data/lib/badger/version.rb +1 -1
- data/spec/badger_spec.rb +47 -52
- metadata +31 -5
- data/RUBYGEMBADGE +0 -1
- data/features/support/hooks.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c2275056d6d78d8d187ba9513cf496220319068
|
4
|
+
data.tar.gz: 2f7b3f8cd6908965911ad8d13dbf311d89c3aedc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e731e86ee1b73e6ca3acfb56ce8c430aac671fe9f00cc5b5c94e6293afb265046fea654090f5ee21dcb298247c4f421fc7654e05f2df8e978b67249bf4ba31
|
7
|
+
data.tar.gz: 400f85d23d2a15c7b39bac6cbf505b73aff2f862a809f72811f4bf9291cc49ec4d36679fc15105a2dd256a5d2d8f5c641a94673d1c9cc29fc7f59a4f586e55cb
|
data/.travis.yml
CHANGED
@@ -7,6 +7,6 @@ deploy:
|
|
7
7
|
secure: Fq5ig8hiOsHDA+uC1rWMUTQPljH1hIRzsbWo1aYQxE+ldNXrMjPOtwApTPTeY1lJ2MqZEXONNbH/XTmStGssWc7jl1o0JlprlHIH11kXANpjgkhq4eR30abZLt8+FJdIKpE44fGjk5USVu8xAqqkZxa5/SUbJezBsooFCcsN1Bg=
|
8
8
|
gemspec: badger.gemspec
|
9
9
|
gem: badgerbadgerbadger
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
on:
|
11
|
+
repo: pikesley/badger
|
12
|
+
tags: true
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
#Badger
|
9
9
|
|
10
|
-
Because I grow weary of copy-n-pasting the badge URLs into the README of every project, and the [
|
10
|
+
Because I grow weary of copy-n-pasting the badge URLs into the README of every project, and the [img.shields.io](http://img.shields.io) API now supports all of the services I use
|
11
11
|
|
12
12
|
##Usage
|
13
13
|
|
@@ -30,14 +30,13 @@ Then
|
|
30
30
|
[![Gem Version](http://img.shields.io/gem/v/badgerbadgerbadger.svg)](https://rubygems.org/gems/badgerbadgerbadger)
|
31
31
|
[![License](http://img.shields.io/:license-mit-blue.svg)](http://pikesley.mit-license.org)
|
32
32
|
|
33
|
-
|
34
33
|
ready to paste into the top of your README (with the correct URLs for your repo (hopefully)).
|
35
34
|
|
36
35
|
Try
|
37
36
|
|
38
37
|
badger help badge
|
39
38
|
|
40
|
-
|
39
|
+
to read about Badger's Opinions
|
41
40
|
|
42
41
|
If you're on a Mac, pipe the output into `pbcopy` to add the stuff directly to your clipboard:
|
43
42
|
|
data/badger.gemspec
CHANGED
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'rspec-pride', '~> 2.3'
|
28
28
|
spec.add_development_dependency 'cucumber', '~> 1.3'
|
29
29
|
spec.add_development_dependency 'aruba', '~> 0.5'
|
30
|
-
# spec.add_development_dependency 'aruba-doubles', '~> 1.2'
|
31
30
|
spec.add_development_dependency 'guard', '~> 2.3'
|
32
31
|
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
33
32
|
spec.add_development_dependency 'guard-cucumber', '~> 1.4'
|
33
|
+
spec.add_development_dependency 'terminal-notifier-guard'
|
34
34
|
spec.add_development_dependency 'coveralls', '~> 0.7'
|
35
35
|
spec.add_development_dependency 'webmock', '~> 1.17'
|
36
36
|
end
|
data/bin/badger
CHANGED
data/config/licenses.yaml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
mit:
|
7
7
|
url: http://%s.mit-license.org
|
8
|
-
regex:
|
8
|
+
regex: MIT License
|
9
9
|
|
10
10
|
apache:
|
11
11
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
@@ -19,4 +19,4 @@ gpl-2.0:
|
|
19
19
|
gpl-3.0:
|
20
20
|
url: http://www.gnu.org/licenses/gpl-3.0.html
|
21
21
|
badge_text: gpl3
|
22
|
-
regex: GNU GENERAL PUBLIC LICENSE.*Version 3
|
22
|
+
regex: GNU GENERAL PUBLIC LICENSE.*Version 3
|
data/config/services.yaml
CHANGED
@@ -1,26 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
badge_slug: travis
|
1
|
+
travis:
|
2
|
+
alt_text: Build Status
|
3
|
+
url: travis-ci.org
|
4
|
+
badge_slug: travis
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
coveralls:
|
7
|
+
alt_text: Coverage Status
|
8
|
+
url: coveralls.io/r
|
9
|
+
badge_slug: coveralls
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
gemnasium:
|
12
|
+
alt_text: Dependency Status
|
13
|
+
url: gemnasium.com
|
14
|
+
badge_slug: gemnasium
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
extras:
|
23
|
-
mit:
|
24
|
-
alt_text: License
|
25
|
-
badge_path: ":license-mit-blue.svg"
|
26
|
-
url: http://%s.mit-license.org
|
16
|
+
codeclimate:
|
17
|
+
alt_text: Code Climate
|
18
|
+
url: codeclimate.com/github
|
19
|
+
badge_slug: codeclimate/github
|
data/features/badger.feature
CHANGED
@@ -1,95 +1,25 @@
|
|
1
|
-
Feature: Badge
|
1
|
+
Feature: Badge robot
|
2
2
|
|
3
3
|
Background:
|
4
4
|
Given git remote is "https://github.com/doge/wow.git"
|
5
5
|
|
6
|
-
|
6
|
+
@travis @gemnasium @coveralls @gemspec @mit
|
7
|
+
Scenario: One with everything
|
7
8
|
When I successfully run `badger badge /tmp/wow_repo`
|
8
9
|
Then the output should contain:
|
9
10
|
"""
|
10
11
|
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
11
|
-
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
12
12
|
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
13
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
14
|
-
"""
|
15
|
-
And the output should not contain:
|
16
|
-
"""
|
17
|
-
![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
18
|
-
"""
|
19
|
-
And the output should not contain:
|
20
|
-
"""
|
21
|
-
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
22
|
-
"""
|
23
|
-
|
24
|
-
Scenario: Generate only a subset of badges
|
25
|
-
When I successfully run `badger badge --not travis /tmp/wow_repo`
|
26
|
-
Then the output should contain:
|
27
|
-
"""
|
28
13
|
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
29
|
-
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
30
14
|
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
15
|
+
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
16
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
31
17
|
"""
|
32
18
|
And the output should not contain:
|
33
19
|
"""
|
34
|
-
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
35
|
-
"""
|
36
|
-
|
37
|
-
Scenario: Generate a small subset of badges
|
38
|
-
When I successfully run `badger badge --not coveralls,codeclimate /tmp/wow_repo`
|
39
|
-
Then the output should contain:
|
40
|
-
"""
|
41
|
-
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
42
|
-
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
43
|
-
"""
|
44
|
-
And the output should not contain:
|
45
|
-
"""
|
46
|
-
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
47
|
-
"""
|
48
|
-
And the output should not contain:
|
49
|
-
"""
|
50
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
51
|
-
"""
|
52
|
-
|
53
|
-
Scenario: Generate only certain badges
|
54
|
-
When I successfully run `badger badge --only coveralls,codeclimate /tmp/wow_repo`
|
55
|
-
Then the output should contain:
|
56
|
-
"""
|
57
|
-
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
58
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
59
|
-
"""
|
60
|
-
|
61
|
-
# Scenario: Generate additional badges
|
62
|
-
# When I successfully run `badger badge --also mit /tmp/wow_repo`
|
63
|
-
# Then the output should contain:
|
64
|
-
# """
|
65
|
-
#[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
66
|
-
#[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
67
|
-
#[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
68
|
-
#[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
69
|
-
#[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
70
|
-
# """
|
71
|
-
|
72
|
-
@gemspec
|
73
|
-
Scenario: Generate badges based on gemspec
|
74
|
-
When I successfully run `badger badge /tmp/wow_repo`
|
75
|
-
Then the output should contain:
|
76
|
-
"""
|
77
|
-
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
78
|
-
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
79
|
-
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
80
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
81
|
-
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
82
20
|
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
83
|
-
|
84
|
-
|
85
|
-
# @gemspec
|
86
|
-
# Scenario: gemspec and --also mit
|
87
|
-
# Given I successfully run `badger badge --also mit /tmp/wow_repo`
|
88
|
-
# Then the output should not contain:
|
89
|
-
# """
|
90
|
-
#[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
91
|
-
#[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
92
|
-
# """
|
21
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
22
|
+
"""
|
93
23
|
|
94
24
|
Scenario: handle a non-git-repo gracefully
|
95
25
|
When I run `badger badge /tmp`
|
data/features/licenses.feature
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Get license badges
|
2
2
|
|
3
3
|
Background:
|
4
4
|
Given git remote is "https://github.com/doge/wow.git"
|
@@ -42,4 +42,12 @@ GPL
|
|
42
42
|
And the output should not contain:
|
43
43
|
"""
|
44
44
|
MIT
|
45
|
-
"""
|
45
|
+
"""
|
46
|
+
|
47
|
+
@license @doge-license
|
48
|
+
Scenario: Attempt to generate an unknown license type
|
49
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
50
|
+
Then the output should not contain:
|
51
|
+
"""
|
52
|
+
License
|
53
|
+
"""
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Get rubygems badge
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given git remote is "https://github.com/doge/wow.git"
|
5
|
+
|
6
|
+
@gemspec
|
7
|
+
Scenario: Get rubygems badge
|
8
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
9
|
+
Then the output should contain:
|
10
|
+
"""
|
11
|
+
[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)
|
12
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
13
|
+
"""
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: Get service badges
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given git remote is "https://github.com/doge/wow.git"
|
5
|
+
|
6
|
+
@travis
|
7
|
+
Scenario: Generate travis badge
|
8
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
9
|
+
Then the output should contain:
|
10
|
+
"""
|
11
|
+
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
12
|
+
"""
|
13
|
+
And the output should not contain:
|
14
|
+
"""
|
15
|
+
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
16
|
+
"""
|
17
|
+
And the output should not contain:
|
18
|
+
"""
|
19
|
+
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
20
|
+
"""
|
21
|
+
|
22
|
+
@gemnasium
|
23
|
+
Scenario: Generate gemnasium badge
|
24
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
25
|
+
Then the output should contain:
|
26
|
+
"""
|
27
|
+
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
28
|
+
"""
|
29
|
+
|
30
|
+
@coveralls
|
31
|
+
Scenario: Generate coveralls badge
|
32
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
33
|
+
Then the output should contain:
|
34
|
+
"""
|
35
|
+
[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)
|
36
|
+
[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)
|
37
|
+
"""
|
38
|
+
And the output should not contain:
|
39
|
+
"""
|
40
|
+
[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
41
|
+
"""
|
42
|
+
|
43
|
+
@codeclimate
|
44
|
+
Scenario: Generate codeclimate badge
|
45
|
+
When I successfully run `badger badge /tmp/wow_repo`
|
46
|
+
Then the output should contain:
|
47
|
+
"""
|
48
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
49
|
+
"""
|
data/features/support/env.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
Before do
|
2
|
+
FileUtils.mkpath $temp_repo
|
3
|
+
end
|
4
|
+
|
5
|
+
After do
|
6
|
+
FileUtils.remove_dir $temp_repo, :force => true
|
7
|
+
end
|
8
|
+
|
9
|
+
Before '@no-remote' do
|
10
|
+
Git.init '/tmp/not_wow'
|
11
|
+
end
|
12
|
+
|
13
|
+
After '@no-remote' do
|
14
|
+
FileUtils.remove_dir '/tmp/not_wow', :force => true
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Before '@mit' do
|
2
|
+
f = File.open "#{$temp_repo}/LICENSE.md", 'w'
|
3
|
+
f.write "The MIT License (MIT)\n"
|
4
|
+
f.close
|
5
|
+
end
|
6
|
+
|
7
|
+
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
|
12
|
+
end
|
13
|
+
|
14
|
+
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
|
19
|
+
end
|
20
|
+
|
21
|
+
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
|
26
|
+
end
|
27
|
+
|
28
|
+
Before '@doge-license' do
|
29
|
+
f = File.open "#{$temp_repo}/LICENSE.md", 'w'
|
30
|
+
f.write "WOW SUCH LICENSE\n"
|
31
|
+
f.close
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Before '@gemspec' do
|
2
|
+
fakespec = <<EOF
|
3
|
+
# coding: utf-8
|
4
|
+
lib = File.expand_path('../lib', __FILE__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'suchgem'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
end
|
11
|
+
EOF
|
12
|
+
|
13
|
+
f = File.open "#{$temp_repo}/suchgem.gemspec", 'w'
|
14
|
+
f.write fakespec
|
15
|
+
f.close
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Before '@travis' do
|
2
|
+
FileUtils.touch "#{$temp_repo}/.travis.yml"
|
3
|
+
end
|
4
|
+
|
5
|
+
Before '@gemnasium' do
|
6
|
+
FileUtils.touch "#{$temp_repo}/Gemfile"
|
7
|
+
end
|
8
|
+
|
9
|
+
Before '@coveralls' do
|
10
|
+
f = File.open "#{$temp_repo}/Gemfile", 'w'
|
11
|
+
f.write 'gem "coveralls"'
|
12
|
+
f.close
|
13
|
+
end
|
14
|
+
|
15
|
+
Before '@codeclimate' do
|
16
|
+
FileUtils.touch "#{$temp_repo}/.travis.yml"
|
17
|
+
end
|
data/lib/badger.rb
CHANGED
data/lib/badger/badger.rb
CHANGED
@@ -1,111 +1,43 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
1
|
module Badger
|
4
|
-
class Badger
|
5
|
-
attr_reader :
|
2
|
+
class Badger < Array
|
3
|
+
attr_reader :github_slug, :owner
|
6
4
|
|
7
5
|
def initialize url
|
8
|
-
@
|
9
|
-
@blacklist = []
|
10
|
-
|
11
|
-
@licenses = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/licenses.yaml')))
|
12
|
-
yaml = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/services.yaml')))
|
13
|
-
@services = yaml['defaults']
|
14
|
-
@extras = yaml['extras']
|
15
|
-
@config = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/config.yaml')))
|
16
|
-
|
17
|
-
@badge_service = @config['badge_service']
|
18
|
-
|
19
|
-
@extra_badges = []
|
6
|
+
@url = url
|
20
7
|
end
|
21
8
|
|
22
|
-
def github_slug
|
23
|
-
@github_slug ||= /.*github\.com.(.*)\.git/.match(url)[1]
|
9
|
+
def github_slug
|
10
|
+
@github_slug ||= /.*github\.com.(.*)\.git/.match(@url)[1]
|
24
11
|
end
|
25
12
|
|
26
13
|
def owner
|
27
|
-
@owner ||=
|
14
|
+
@owner ||= github_slug.split('/')[0]
|
28
15
|
end
|
29
16
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
unless @blacklist.include? k.to_s
|
34
|
-
s << "[![%s](http://%s/%s/%s.svg)](https://%s/%s)" % [
|
35
|
-
h['alt_text'],
|
36
|
-
@badge_service,
|
37
|
-
h['badge_slug'],
|
38
|
-
@github_slug,
|
39
|
-
h['url'],
|
40
|
-
@github_slug
|
41
|
-
]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
s += @extra_badges
|
45
|
-
|
46
|
-
s.uniq
|
17
|
+
def add service
|
18
|
+
self << Service.badge(service, github_slug)
|
19
|
+
self.delete nil
|
47
20
|
end
|
48
21
|
|
49
22
|
def license type
|
50
|
-
|
51
|
-
|
23
|
+
self << License.badge(type, owner)
|
24
|
+
self.delete nil
|
52
25
|
end
|
53
26
|
|
54
|
-
def
|
55
|
-
|
56
|
-
items.each do |item|
|
57
|
-
@services.delete item
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def only items
|
62
|
-
items = [items] unless items.class.name == 'Array'
|
63
|
-
s = {}
|
64
|
-
items.each do |item|
|
65
|
-
s[item] = @services[item]
|
66
|
-
end
|
67
|
-
|
68
|
-
@services = s
|
27
|
+
def rubygem name
|
28
|
+
self << Rubygem.badge(name)
|
69
29
|
end
|
70
30
|
|
71
|
-
def
|
72
|
-
|
73
|
-
s = ''
|
74
|
-
items.each do |item|
|
75
|
-
if @licenses[item]
|
76
|
-
@license = License.new self, item
|
77
|
-
s << @license.badge
|
78
|
-
end
|
79
|
-
@extra_badges << s
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def gemspec lines
|
84
|
-
rg = ''
|
85
|
-
rubygem = (lines.select { |l| /\.name\s/.match l })[0].split(/\s/)[-1][1..-2]
|
86
|
-
rg << "[![Gem Version](http://%s/gem/v/%s.svg)](https://rubygems.org/gems/%s)" % [
|
87
|
-
@badge_service,
|
88
|
-
rubygem,
|
89
|
-
rubygem
|
90
|
-
]
|
91
|
-
|
92
|
-
@extra_badges << rg
|
93
|
-
|
94
|
-
spec_license = (lines.select { |l| /license/.match l })[0].split(/\s/)[-1][1..-2]
|
31
|
+
def to_s
|
32
|
+
self.uniq!
|
95
33
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
34
|
+
s = ''
|
35
|
+
self.each do |badge|
|
36
|
+
s << badge
|
37
|
+
s << "\n"
|
100
38
|
end
|
101
39
|
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
def to_s
|
106
|
-
badge.each do |b|
|
107
|
-
b
|
108
|
-
end
|
40
|
+
s
|
109
41
|
end
|
110
42
|
end
|
111
43
|
end
|
data/lib/badger/cli.rb
CHANGED
@@ -1,42 +1,39 @@
|
|
1
|
-
require 'thor'
|
2
1
|
require 'badger'
|
3
2
|
|
4
3
|
module Badger
|
5
4
|
class CLI < Thor
|
5
|
+
|
6
6
|
desc 'badge', 'Generate badge markdown'
|
7
7
|
long_desc <<-LONGDESC
|
8
|
-
|
8
|
+
Highly-opinionated badge generator for Github READMEs:
|
9
9
|
|
10
|
-
|
10
|
+
* If it finds a .travis.yml, it generates a Travis-CI Build-Status Badge
|
11
11
|
|
12
|
-
|
12
|
+
* If it finds a Gemfile or a gemspec, it generates a Gemnasium Dependency Status Badge
|
13
13
|
|
14
|
-
|
14
|
+
* If it finds 'coveralls' in a Gemfile or gemspec, it generates a Coveralls Coverage Status Badge
|
15
15
|
|
16
|
-
|
16
|
+
* If it's generated at least one of the above, it generates a Code Climate Status Badge
|
17
17
|
|
18
|
-
|
18
|
+
In addition, if it finds a gemspec, it will use it to generate:
|
19
19
|
|
20
|
-
|
20
|
+
* A Rubygems Version Badge
|
21
21
|
|
22
|
-
|
22
|
+
* A License Badge
|
23
23
|
|
24
|
-
|
24
|
+
And if a license file is found, a License Badge will be generated. Currently supported licenses are:
|
25
25
|
|
26
|
-
|
26
|
+
* MIT
|
27
27
|
|
28
|
-
|
28
|
+
* Apache
|
29
29
|
|
30
|
-
|
30
|
+
* GPL-2
|
31
31
|
|
32
|
-
|
32
|
+
* GPL-3
|
33
33
|
|
34
34
|
The supported license details are in https://github.com/pikesley/badger/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.
|
35
35
|
|
36
|
-
|
37
36
|
LONGDESC
|
38
|
-
option :not, desc: 'Exclude these services (comma-separated list)'
|
39
|
-
option :only, desc: 'Generate for *only* these services (comma-separated list)'
|
40
37
|
|
41
38
|
def badge dir = '.'
|
42
39
|
begin
|
@@ -51,28 +48,21 @@ The supported license details are in https://github.com/pikesley/badger/blob/mas
|
|
51
48
|
puts 'This repo does not appear to have a github remote'
|
52
49
|
exit 2
|
53
50
|
end
|
54
|
-
@badger = Badger.new @r
|
55
51
|
|
56
|
-
@badger
|
57
|
-
@badger.only options[:only].split(',') if options[:only]
|
58
|
-
@badger.also options[:also].split(',') if options[:also]
|
52
|
+
@badger = Badger.new @r
|
59
53
|
|
60
|
-
|
54
|
+
@badger.add 'travis' if Badger.has_travis? dir
|
55
|
+
@badger.add 'gemnasium' if Badger.has_gemfile? dir
|
56
|
+
@badger.add 'coveralls' if Badger.has_coveralls? dir
|
57
|
+
@badger.add 'codeclimate' if @badger.any?
|
61
58
|
|
62
|
-
if
|
63
|
-
|
64
|
-
@badger.
|
59
|
+
if gemspec_params = Badger.search_gemspec(dir)
|
60
|
+
@badger.rubygem gemspec_params[:rubygem]
|
61
|
+
@badger.license gemspec_params[:license]
|
65
62
|
end
|
66
63
|
|
67
|
-
|
68
|
-
|
69
|
-
if license_file
|
70
|
-
words = File.open(File.join(dir, license_file), 'r').read
|
71
|
-
@badger.licenses.each_pair do |k, v|
|
72
|
-
if /#{v['regex']}/im.match words
|
73
|
-
@badger.license k
|
74
|
-
end
|
75
|
-
end
|
64
|
+
if license_type = Badger.find_license(dir)
|
65
|
+
@badger.license license_type
|
76
66
|
end
|
77
67
|
|
78
68
|
puts @badger.to_s
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
module Badger
|
5
|
+
class Config
|
6
|
+
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@config = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/config.yaml')))
|
11
|
+
@services = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/services.yaml')))
|
12
|
+
@licenses = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/licenses.yaml')))
|
13
|
+
end
|
14
|
+
|
15
|
+
def services
|
16
|
+
@services
|
17
|
+
end
|
18
|
+
|
19
|
+
def licenses
|
20
|
+
@licenses
|
21
|
+
end
|
22
|
+
|
23
|
+
def badge_service
|
24
|
+
@config['badge_service']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Badger
|
2
|
+
def Badger.has_travis? dir
|
3
|
+
((Dir.entries dir).select { |i| '.travis.yml' == i }).any?
|
4
|
+
end
|
5
|
+
|
6
|
+
def Badger.has_gemfile? dir
|
7
|
+
gemfiles(dir).any?
|
8
|
+
end
|
9
|
+
|
10
|
+
def Badger.has_coveralls? dir
|
11
|
+
lines = []
|
12
|
+
gemfiles(dir).each do |gemfile|
|
13
|
+
lines += File.readlines(File.join(dir, gemfile))
|
14
|
+
end
|
15
|
+
|
16
|
+
lines.grep(/coveralls/).any?
|
17
|
+
end
|
18
|
+
|
19
|
+
def Badger.gemfiles dir
|
20
|
+
targets = []
|
21
|
+
targets += (Dir.entries dir).select { |i| /Gemfile/.match i }
|
22
|
+
targets += (Dir.entries dir).select { |i| /gemspec/.match i }
|
23
|
+
targets
|
24
|
+
end
|
25
|
+
|
26
|
+
def Badger.find_license dir
|
27
|
+
license_file = (Dir.entries dir).select { |i| /LICENSE/i.match i }[0]
|
28
|
+
|
29
|
+
if license_file
|
30
|
+
words = File.open(File.join(dir, license_file), 'r').read
|
31
|
+
Config.instance.licenses.each_pair do |k, v|
|
32
|
+
if /#{v['regex']}/im.match words
|
33
|
+
return k
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def Badger.search_gemspec dir
|
42
|
+
spec_file = (Dir.entries dir).select { |i| /gemspec/.match i }[0]
|
43
|
+
|
44
|
+
if spec_file
|
45
|
+
params = {}
|
46
|
+
gs = File.readlines(File.join(dir, spec_file))
|
47
|
+
params[:rubygem] = (gs.grep /\.name /)[0].split('=')[-1].strip[1..-2]
|
48
|
+
params[:license] = (gs.grep /\.license /)[0].split('=')[-1].strip[1..-2]
|
49
|
+
end
|
50
|
+
|
51
|
+
params || nil
|
52
|
+
end
|
53
|
+
end
|
data/lib/badger/license.rb
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
module Badger
|
2
2
|
class License
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def badge
|
9
|
-
return nil unless config = @badger.licenses[@type]
|
3
|
+
def self.badge type, owner
|
4
|
+
type = type.downcase
|
5
|
+
return nil unless params = Config.instance.licenses[type]
|
10
6
|
|
11
|
-
|
12
|
-
if /%s/.match
|
13
|
-
|
7
|
+
url = params['url']
|
8
|
+
if /%s/.match url
|
9
|
+
url = url % owner
|
14
10
|
end
|
15
11
|
|
16
|
-
badge_text =
|
12
|
+
badge_text = type unless badge_text = params['badge_text']
|
17
13
|
|
18
|
-
|
19
|
-
|
14
|
+
"[![License](http://%s/:license-%s-blue.svg)](%s)" % [
|
15
|
+
Config.instance.badge_service,
|
20
16
|
badge_text,
|
21
|
-
|
17
|
+
url
|
22
18
|
]
|
19
|
+
end
|
23
20
|
|
24
|
-
|
21
|
+
def self.licenses
|
22
|
+
@@licenses
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
data/lib/badger/service.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
module Badger
|
2
|
-
class Service
|
3
|
-
def
|
4
|
-
|
2
|
+
class Service
|
3
|
+
def self.badge name, github_slug
|
4
|
+
return nil unless params = Config.instance.services[name]
|
5
|
+
params = Config.instance.services[name]
|
6
|
+
|
7
|
+
"[![%s](http://%s/%s/%s.svg)](https://%s/%s)" % [
|
8
|
+
params['alt_text'],
|
9
|
+
Config.instance.badge_service,
|
10
|
+
params['badge_slug'],
|
11
|
+
github_slug,
|
12
|
+
params['url'],
|
13
|
+
github_slug
|
14
|
+
]
|
5
15
|
end
|
6
16
|
end
|
7
17
|
end
|
data/lib/badger/version.rb
CHANGED
data/spec/badger_spec.rb
CHANGED
@@ -6,88 +6,83 @@ module Badger
|
|
6
6
|
@badger = Badger.new "https://github.com/doge/wow.git"
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
@badger.github_slug('https://github.com/doge/wow.git').should eql('doge/wow')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'for an ssh url' do
|
15
|
-
@badger.github_slug('git@github.com:doge/wow.git').should eql('doge/wow')
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should have the owner' do
|
19
|
-
@badger.owner.should eql 'doge'
|
20
|
-
end
|
9
|
+
it 'should have no badges by default' do
|
10
|
+
@badger.length.should == 0
|
21
11
|
end
|
22
12
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@badger.badge[3].should == "[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)"
|
28
|
-
end
|
13
|
+
context 'get the user and repo' do
|
14
|
+
it 'extracts from an https url' do
|
15
|
+
@badger.github_slug.should eql('doge/wow')
|
16
|
+
end
|
29
17
|
|
30
|
-
|
31
|
-
|
32
|
-
@badger.remove 'travis'
|
33
|
-
@badger.badge[0].should == "[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)"
|
34
|
-
@badger.badge[1].should == "[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)"
|
35
|
-
@badger.badge[2].should == "[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)"
|
18
|
+
it 'extracts from an ssh url' do
|
19
|
+
@badger.github_slug.should eql('doge/wow')
|
36
20
|
end
|
37
21
|
|
38
|
-
it '
|
39
|
-
@badger.
|
40
|
-
@badger.badge[0].should == "[![Coverage Status](http://img.shields.io/coveralls/doge/wow.svg)](https://coveralls.io/r/doge/wow)"
|
41
|
-
@badger.badge[1].should == "[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)"
|
42
|
-
@badger.badge.length.should == 2
|
22
|
+
it 'extracts the owner' do
|
23
|
+
@badger.owner.should eql 'doge'
|
43
24
|
end
|
44
25
|
end
|
45
26
|
|
46
|
-
context '
|
47
|
-
it 'should have
|
48
|
-
@badger.
|
49
|
-
@badger
|
50
|
-
@badger.badge.length.should == 1
|
27
|
+
context 'service badges' do
|
28
|
+
it 'should have a travis badge' do
|
29
|
+
@badger.add 'travis'
|
30
|
+
@badger[0].should == "[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)"
|
51
31
|
end
|
52
|
-
end
|
53
32
|
|
54
|
-
|
55
|
-
|
56
|
-
@badger.
|
57
|
-
@badger
|
33
|
+
it 'should have a travis badge and a gemnasium badge' do
|
34
|
+
@badger.add 'travis'
|
35
|
+
@badger.add 'gemnasium'
|
36
|
+
@badger[0].should == "[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)"
|
37
|
+
@badger[1].should == "[![Dependency Status](http://img.shields.io/gemnasium/doge/wow.svg)](https://gemnasium.com/doge/wow)"
|
38
|
+
@badger.length.should == 2
|
58
39
|
end
|
59
|
-
end
|
60
40
|
|
61
|
-
|
62
|
-
|
63
|
-
@badger.
|
64
|
-
"spec.name 'suchgem'",
|
65
|
-
"spec.license 'MIT'"
|
66
|
-
]
|
67
|
-
@badger.badge[4].should == "[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)"
|
68
|
-
@badger.badge[5].should == "[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)"
|
41
|
+
it 'should handle an unknown service gracefully' do
|
42
|
+
@badger.add 'doge-service'
|
43
|
+
@badger.length.should == 0
|
69
44
|
end
|
70
45
|
end
|
71
46
|
|
72
47
|
context 'licenses' do
|
73
48
|
it 'should generate an MIT badge' do
|
74
49
|
@badger.license 'mit'
|
75
|
-
@badger
|
50
|
+
@badger[0].should == "[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)"
|
76
51
|
end
|
77
52
|
|
78
53
|
it 'should generate an Apache badge' do
|
79
54
|
@badger.license 'apache'
|
80
|
-
@badger
|
55
|
+
@badger[0].should == "[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)"
|
81
56
|
end
|
82
57
|
|
83
58
|
it 'should generate a GPL3 badge' do
|
84
59
|
@badger.license 'gpl-3.0'
|
85
|
-
@badger
|
60
|
+
@badger[0].should == "[![License](http://img.shields.io/:license-gpl3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html)"
|
86
61
|
end
|
87
62
|
|
88
63
|
it 'should generate nothing for an unknown license' do
|
89
64
|
@badger.license 'doge-license'
|
90
|
-
@badger.
|
65
|
+
@badger.length.should == 0
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'rubygems' do
|
70
|
+
it 'should have a rubygems badge' do
|
71
|
+
@badger.rubygem 'suchgem'
|
72
|
+
@badger[0].should == "[![Gem Version](http://img.shields.io/gem/v/suchgem.svg)](https://rubygems.org/gems/suchgem)"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'output' do
|
77
|
+
it 'should produce some lines of text' do
|
78
|
+
@badger.add 'travis'
|
79
|
+
@badger.add 'codeclimate'
|
80
|
+
@badger.license 'mit'
|
81
|
+
@badger.to_s.should ==
|
82
|
+
%{[![Build Status](http://img.shields.io/travis/doge/wow.svg)](https://travis-ci.org/doge/wow)
|
83
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/doge/wow.svg)](https://codeclimate.com/github/doge/wow)
|
84
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
|
85
|
+
}
|
91
86
|
end
|
92
87
|
end
|
93
88
|
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.
|
4
|
+
version: 0.5.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-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: terminal-notifier-guard
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: coveralls
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,7 +221,6 @@ files:
|
|
207
221
|
- Guardfile
|
208
222
|
- LICENSE.md
|
209
223
|
- README.md
|
210
|
-
- RUBYGEMBADGE
|
211
224
|
- Rakefile
|
212
225
|
- badger.gemspec
|
213
226
|
- bin/badger
|
@@ -216,13 +229,21 @@ files:
|
|
216
229
|
- config/services.yaml
|
217
230
|
- features/badger.feature
|
218
231
|
- features/licenses.feature
|
232
|
+
- features/rubygems.feature
|
233
|
+
- features/services.feature
|
219
234
|
- features/step_definitions/badger_steps.rb
|
220
235
|
- features/support/env.rb
|
221
|
-
- features/support/hooks.rb
|
236
|
+
- features/support/hooks/hooks.rb
|
237
|
+
- features/support/hooks/licenses.rb
|
238
|
+
- features/support/hooks/rubygems.rb
|
239
|
+
- features/support/hooks/services.rb
|
222
240
|
- lib/badger.rb
|
223
241
|
- lib/badger/badger.rb
|
224
242
|
- lib/badger/cli.rb
|
243
|
+
- lib/badger/config.rb
|
244
|
+
- lib/badger/helpers.rb
|
225
245
|
- lib/badger/license.rb
|
246
|
+
- lib/badger/rubygem.rb
|
226
247
|
- lib/badger/service.rb
|
227
248
|
- lib/badger/version.rb
|
228
249
|
- spec/badger_spec.rb
|
@@ -255,8 +276,13 @@ summary: Badge-Driven Development made easy. Generate a set of Github badges for
|
|
255
276
|
test_files:
|
256
277
|
- features/badger.feature
|
257
278
|
- features/licenses.feature
|
279
|
+
- features/rubygems.feature
|
280
|
+
- features/services.feature
|
258
281
|
- features/step_definitions/badger_steps.rb
|
259
282
|
- features/support/env.rb
|
260
|
-
- features/support/hooks.rb
|
283
|
+
- features/support/hooks/hooks.rb
|
284
|
+
- features/support/hooks/licenses.rb
|
285
|
+
- features/support/hooks/rubygems.rb
|
286
|
+
- features/support/hooks/services.rb
|
261
287
|
- spec/badger_spec.rb
|
262
288
|
- spec/spec_helper.rb
|
data/RUBYGEMBADGE
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
http://b.adge.me/gem/v/badgerbadgerbadger.svg
|
data/features/support/hooks.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
Before do
|
2
|
-
FileUtils.mkpath '/tmp/wow_repo'
|
3
|
-
end
|
4
|
-
|
5
|
-
After do
|
6
|
-
FileUtils.remove_dir '/tmp/wow_repo', :force => true
|
7
|
-
end
|
8
|
-
|
9
|
-
Before '@gemspec' do
|
10
|
-
f = File.open('/tmp/wow_repo/suchgem.gemspec', 'w')
|
11
|
-
[
|
12
|
-
"spec.name 'suchgem'",
|
13
|
-
"spec.license 'MIT'"
|
14
|
-
].each do |line|
|
15
|
-
f.write line
|
16
|
-
f.write "\n"
|
17
|
-
end
|
18
|
-
f.close
|
19
|
-
end
|
20
|
-
|
21
|
-
Before '@no-remote' do
|
22
|
-
Git.init '/tmp/not_wow'
|
23
|
-
end
|
24
|
-
|
25
|
-
After '@no-remote' do
|
26
|
-
FileUtils.remove_dir '/tmp/not_wow', :force => true
|
27
|
-
end
|
28
|
-
|
29
|
-
Before '@mit' do
|
30
|
-
f = File.open '/tmp/wow_repo/LICENSE.md', 'w'
|
31
|
-
f.write "The MIT License (MIT)\n"
|
32
|
-
f.close
|
33
|
-
end
|
34
|
-
|
35
|
-
Before '@apache' do
|
36
|
-
f = File.open '/tmp/wow_repo/LICENSE.md', 'w'
|
37
|
-
f.write "Apache License\n"
|
38
|
-
f.write "Version 2.0\n"
|
39
|
-
f.close
|
40
|
-
end
|
41
|
-
|
42
|
-
Before '@gpl2' do
|
43
|
-
f = File.open '/tmp/wow_repo/LICENSE.md', 'w'
|
44
|
-
f.write "GNU GENERAL PUBLIC LICENSE\n"
|
45
|
-
f.write "Version 2\n"
|
46
|
-
f.close
|
47
|
-
end
|
48
|
-
|
49
|
-
Before '@gpl3' do
|
50
|
-
f = File.open '/tmp/wow_repo/LICENSE.md', 'w'
|
51
|
-
f.write "GNU GENERAL PUBLIC LICENSE\n"
|
52
|
-
f.write "Version 3\n"
|
53
|
-
f.close
|
54
|
-
end
|