repo-small-badge 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/repo_small_badge/image.rb +7 -4
- data/lib/repo_small_badge/version.rb +1 -1
- data/script/travis.sh +8 -5
- data/spec/support/mocks.rb +4 -18
- metadata +4 -4
- data/badge_total.svg +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 081b83b761eb821172f027cc5e3c8deafb78248f0a98a1c71224a6e437d1d943
|
4
|
+
data.tar.gz: 5ff2a1c6ea4f411ed12bcf14ec7a189d35e14ce152fde779b48d8fb3f49f8809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a78046560831c4ee737039f3cf388c9918511c240b14088c672f4bb9fbab92921d5c18d09604083cc138583c2e0521ae199847c4b8af71b7c4536d40edc83778
|
7
|
+
data.tar.gz: cd715bafabfd8ed5d311c431b89dc6c985063cb504c02cddda2027d88e4c4c86ad0cf72367ff7f86dc27c1c74889f4b7bb70da64ba9d0563aa0b49c05ed7894f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ The text place and other configurable can be specified at instance time.
|
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
|
-
The badge creation is dependent on the [
|
13
|
+
The badge creation is dependent on the [Victor gem](https://github.com/DannyBen/victor) for creating the SVG formatted badge.
|
14
14
|
|
15
15
|
It can be installed in your Ruby library or rails app as part of the `Gemfile` as follows.
|
16
16
|
|
@@ -4,12 +4,17 @@ require 'victor'
|
|
4
4
|
|
5
5
|
module RepoSmallBadge
|
6
6
|
# :nodoc:
|
7
|
+
# rubocop:disable Metrics/ClassLength
|
7
8
|
class Image < Victor::SVGBase
|
8
9
|
# Create new instance.
|
9
10
|
# @config is a Hash of configurables. Keys are symbols.
|
10
11
|
def initialize(config = {})
|
11
12
|
@config = config
|
12
|
-
super(
|
13
|
+
super(template: :html, contentScriptType: 'text/ecmascript',
|
14
|
+
contentStyleType: 'text/css', preserveAspectRatio: 'xMidYMid meet',
|
15
|
+
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
16
|
+
xmlns: 'http://www.w3.org/2000/svg', version: '1.0',
|
17
|
+
height: badge_height)
|
13
18
|
end
|
14
19
|
|
15
20
|
# Creates the badge.
|
@@ -20,7 +25,6 @@ module RepoSmallBadge
|
|
20
25
|
svg_header
|
21
26
|
svg_boxes
|
22
27
|
svg_texts(title, value)
|
23
|
-
|
24
28
|
save(filename(name))
|
25
29
|
end
|
26
30
|
|
@@ -41,7 +45,6 @@ module RepoSmallBadge
|
|
41
45
|
|
42
46
|
def svg_boxes
|
43
47
|
middle = badge_width / 2
|
44
|
-
|
45
48
|
svg_rounded_box
|
46
49
|
|
47
50
|
element :g, 'clip-path' => 'url(#round)' do
|
@@ -64,7 +67,6 @@ module RepoSmallBadge
|
|
64
67
|
# rubocop:disable Metrics/AbcSize
|
65
68
|
def svg_texts(title, value)
|
66
69
|
middle = badge_width / 2
|
67
|
-
|
68
70
|
element :g, fill: title_color, 'text-anchor': 'middle',
|
69
71
|
'font-family': font, size: font_size do |_svg|
|
70
72
|
element :text, title(title), x: middle / 2, y: badge_height - 5,
|
@@ -136,4 +138,5 @@ module RepoSmallBadge
|
|
136
138
|
@config.fetch(:output_path, '.')
|
137
139
|
end
|
138
140
|
end
|
141
|
+
# rubocop:enable Metrics/ClassLength
|
139
142
|
end
|
data/script/travis.sh
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
RUBYCRITICLIMIT=${RUBYCRITICLIMIT:-"90.0"}
|
4
|
+
QUICK=${QUICK:-}
|
4
5
|
|
5
6
|
bundle exec rspec
|
6
7
|
bundle exec rubocop
|
7
|
-
|
8
|
-
gem install
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
if [ -z "$QUICK" ]; then
|
9
|
+
gem install bundler-audit && bundle-audit update && bundle-audit check
|
10
|
+
gem install rubycritic && rubycritic app lib config ${RUBYCRITICPARAMS} --format console --minimum-score ${RUBYCRITICLIMIT}
|
11
|
+
echo "Pushing badges upstream"
|
12
|
+
[ -d badges ] || mkdir badges
|
13
|
+
cp coverage/coverage_badge* badges/ 2>/dev/null || true
|
14
|
+
fi
|
data/spec/support/mocks.rb
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TestRepoSmallBadge
|
4
|
-
# rubocop:disable Metrics/MethodLength, Metrics/LineLength
|
4
|
+
# rubocop:disable Metrics/MethodLength, Metrics/LineLength
|
5
5
|
def default_svg_string
|
6
|
-
%(
|
7
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
8
|
-
|
9
|
-
<svg height="20" width="100%"
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
11
|
-
xmlns:xlink="http://www.w3.org/1999/xlink">
|
12
|
-
|
6
|
+
%(<svg contentScriptType="text/ecmascript" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.0" height="20" width="100%">
|
13
7
|
|
14
8
|
<linearGradient id="smooth" x2="0" y2="100%">
|
15
9
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
@@ -37,18 +31,11 @@ Total
|
|
37
31
|
100%
|
38
32
|
</text>
|
39
33
|
</g>
|
40
|
-
|
41
34
|
</svg>)
|
42
35
|
end
|
43
36
|
|
44
37
|
def not_rounded_svg_string
|
45
|
-
%(
|
46
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
47
|
-
|
48
|
-
<svg height="20" width="100%"
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
50
|
-
xmlns:xlink="http://www.w3.org/1999/xlink">
|
51
|
-
|
38
|
+
%(<svg contentScriptType="text/ecmascript" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.0" height="20" width="100%">
|
52
39
|
|
53
40
|
<linearGradient id="smooth" x2="0" y2="100%">
|
54
41
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
@@ -76,8 +63,7 @@ badge Total
|
|
76
63
|
100%
|
77
64
|
</text>
|
78
65
|
</g>
|
79
|
-
|
80
66
|
</svg>)
|
81
67
|
end
|
82
|
-
# rubocop:enable Metrics/MethodLength, Metrics/LineLength
|
68
|
+
# rubocop:enable Metrics/MethodLength, Metrics/LineLength
|
83
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repo-small-badge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Grimme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: victor
|
@@ -109,11 +109,11 @@ files:
|
|
109
109
|
- ".ruby-gemset"
|
110
110
|
- ".ruby-version"
|
111
111
|
- ".travis.yml"
|
112
|
+
- CHANGELOG.md
|
112
113
|
- Gemfile
|
113
114
|
- MIT-LICENSE
|
114
115
|
- README.md
|
115
116
|
- Rakefile
|
116
|
-
- badge_total.svg
|
117
117
|
- bin/console
|
118
118
|
- lib/repo_small_badge.rb
|
119
119
|
- lib/repo_small_badge/image.rb
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project: repo-small-badge
|
146
|
-
rubygems_version: 2.7.
|
146
|
+
rubygems_version: 2.7.7
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Small Badge generator to be used for different tools 4 ruby
|
data/badge_total.svg
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
-
|
4
|
-
<svg height="20" width="100%"
|
5
|
-
xmlns="http://www.w3.org/2000/svg"
|
6
|
-
xmlns:xlink="http://www.w3.org/1999/xlink">
|
7
|
-
|
8
|
-
|
9
|
-
<linearGradient id="smooth" x2="0" y2="100%">
|
10
|
-
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
11
|
-
<stop offset="1" stop-opacity=".1"/>
|
12
|
-
</linearGradient>
|
13
|
-
<clipPath id="round">
|
14
|
-
<rect height="20" width="120" rx="3" fill="#fff"/>
|
15
|
-
</clipPath>
|
16
|
-
<g clip-path="url(#round)">
|
17
|
-
<rect height="20" width="60" fill="#555"/>
|
18
|
-
<rect x="60" height="20" width="60" fill="#4c1"/>
|
19
|
-
<rect height="20" width="120" fill="url(#smooth)"/>
|
20
|
-
</g>
|
21
|
-
<g fill="#fff" text-anchor="middle" font-family="Verdana,sans-serif" size="11">
|
22
|
-
<text x="30" y="15" fill="#010101" fill-opacity="0.3">
|
23
|
-
Total
|
24
|
-
</text>
|
25
|
-
<text x="30" y="14">
|
26
|
-
Total
|
27
|
-
</text>
|
28
|
-
<text x="90" y="15" fill="#010101" fill-opacity="0.3">
|
29
|
-
100%
|
30
|
-
</text>
|
31
|
-
<text x="90" y="14">
|
32
|
-
100%
|
33
|
-
</text>
|
34
|
-
</g>
|
35
|
-
|
36
|
-
</svg>
|