inch-badge 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/badge-default.svg.erb +7 -0
- data/assets/badge-flat-square.svg.erb +7 -0
- data/assets/badge-flat.svg.erb +7 -0
- data/lib/inch/badge/image/svg.rb +10 -13
- data/lib/inch/badge/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4f76d06f2e51d74a72933c3053f8f600654a30f
|
4
|
+
data.tar.gz: 85d04e777e95af164c18059aec7de198b59a4e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88146faa90b97c46f155634ead003e2efaacff6d21920f926d9d9bf150491937a5289ada0b2baacd8e1c6a364c4723c28703beef95a3c2ee993b297b1005aba6
|
7
|
+
data.tar.gz: 130a8acb0860f8e3522bd522d5f1ccc35432152519d39b208b65815a64fa84776d9728da56dc23a855ebde56286eba855ef37d431de11710989987228c9d9da7
|
@@ -35,6 +35,13 @@
|
|
35
35
|
<stop offset=".9" stop-color="#6a598d" />
|
36
36
|
<stop offset="1" stop-color="#5f4f7d" />
|
37
37
|
</linearGradient>
|
38
|
+
<linearGradient id="gradN" x2="0" y2="100%">
|
39
|
+
<stop offset="0" stop-color="#9B9B9B" />
|
40
|
+
<stop offset=".1" stop-color="#9B9B9B" />
|
41
|
+
<stop offset=".5" stop-color="#9B9B9B" />
|
42
|
+
<stop offset=".9" stop-color="#9B9B9B" />
|
43
|
+
<stop offset="1" stop-color="#9B9B9B" />
|
44
|
+
</linearGradient>
|
38
45
|
|
39
46
|
<%
|
40
47
|
bar_x = 34 + 3
|
@@ -31,6 +31,13 @@
|
|
31
31
|
<stop offset=".9" stop-color="#7a67a0" />
|
32
32
|
<stop offset="1" stop-color="#7a67a0" />
|
33
33
|
</linearGradient>
|
34
|
+
<linearGradient id="gradN" x2="0" y2="100%">
|
35
|
+
<stop offset="0" stop-color="#9B9B9B" />
|
36
|
+
<stop offset=".1" stop-color="#9B9B9B" />
|
37
|
+
<stop offset=".5" stop-color="#9B9B9B" />
|
38
|
+
<stop offset=".9" stop-color="#9B9B9B" />
|
39
|
+
<stop offset="1" stop-color="#9B9B9B" />
|
40
|
+
</linearGradient>
|
34
41
|
|
35
42
|
<%
|
36
43
|
bar_x = 33 + 3
|
data/assets/badge-flat.svg.erb
CHANGED
@@ -31,6 +31,13 @@
|
|
31
31
|
<stop offset=".9" stop-color="#7a67a0" />
|
32
32
|
<stop offset="1" stop-color="#7a67a0" />
|
33
33
|
</linearGradient>
|
34
|
+
<linearGradient id="gradN" x2="0" y2="100%">
|
35
|
+
<stop offset="0" stop-color="#9B9B9B" />
|
36
|
+
<stop offset=".1" stop-color="#9B9B9B" />
|
37
|
+
<stop offset=".5" stop-color="#9B9B9B" />
|
38
|
+
<stop offset=".9" stop-color="#9B9B9B" />
|
39
|
+
<stop offset="1" stop-color="#9B9B9B" />
|
40
|
+
</linearGradient>
|
34
41
|
|
35
42
|
<%
|
36
43
|
bar_x = 33 + 3
|
data/lib/inch/badge/image/svg.rb
CHANGED
@@ -5,32 +5,29 @@ module Inch
|
|
5
5
|
module Image
|
6
6
|
class SVG < Base
|
7
7
|
def save
|
8
|
+
add_n_grade! if empty_badge?
|
9
|
+
|
8
10
|
template_content = File.read( Config.image_path(badge_template) )
|
9
11
|
renderer = ERB.new(template_content)
|
10
12
|
output = renderer.result(binding)
|
11
13
|
|
12
14
|
File.open(@filename, 'w') {|f| f.write(output) }
|
13
|
-
return
|
14
|
-
|
15
|
-
x = 0
|
16
|
-
@grades.each do |grade|
|
17
|
-
grade.width.times do |i|
|
18
|
-
if x < grade.section_width
|
19
|
-
badge = load_image( Config.image_path("grade-#{grade.name}-#{grade.prefix(x)}.png") )
|
20
|
-
base_image.compose!(badge, 34+x, 0)
|
21
|
-
end
|
22
|
-
x += 1
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
15
|
end
|
27
16
|
|
28
17
|
private
|
29
18
|
|
19
|
+
def add_n_grade!
|
20
|
+
@grades << GradeSection.new('N', '#9B9B9B', 100, 100)
|
21
|
+
end
|
22
|
+
|
30
23
|
def badge_template
|
31
24
|
"badge-#{style}.svg.erb"
|
32
25
|
end
|
33
26
|
|
27
|
+
def empty_badge?
|
28
|
+
@numbers == [0,0,0,0]
|
29
|
+
end
|
30
|
+
|
34
31
|
def load_image(filename)
|
35
32
|
@cache ||= {}
|
36
33
|
@cache[filename] ||= ChunkyPNG::Image.from_file(filename)
|
data/lib/inch/badge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inch-badge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.4.3
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Rubygem used to generate badges for Inch
|