badge 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/badge/base.rb +1 -1
- data/lib/badge/runner.rb +23 -11
- 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: 822c906789564ef26e5abed06f3e8845404e1f68
|
4
|
+
data.tar.gz: 7f095560ba04b4dec08b23ab2aeb38cc6794f9d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 442d51f3e18a91b18f3943c1f083bbfe940f685e1e1c5afa5638b0e1436408aff766118abf72f3de0058e33187a68ba20df9b536b8d79cae8afe5580ecc2bd9f
|
7
|
+
data.tar.gz: 2f1950e78e67c15e030165dce7e16f97511365f445da152e9dafb200fc61e9a976ed7ea50902739a1a396c11a41a6e49f01600cb0a58ee65029781398d2140d1
|
data/lib/badge/base.rb
CHANGED
data/lib/badge/runner.rb
CHANGED
@@ -6,6 +6,7 @@ require 'curb'
|
|
6
6
|
module Badge
|
7
7
|
class Runner
|
8
8
|
@@retry_count = Badge.shield_io_retries
|
9
|
+
@@rsvg_enabled = true
|
9
10
|
|
10
11
|
def run(path, options)
|
11
12
|
check_tools!
|
@@ -91,21 +92,31 @@ module Badge
|
|
91
92
|
UI.message "'#{icon.path}'"
|
92
93
|
UI.verbose "Adding shield.io image ontop of icon".blue
|
93
94
|
|
94
|
-
new_path = "#{shield.path}.png"
|
95
95
|
shield_scale = shield_scale ? shield_scale.to_f : 1.0
|
96
96
|
|
97
|
-
if
|
98
|
-
|
97
|
+
if @@rsvg_enabled
|
98
|
+
new_path = "#{shield.path}.png"
|
99
|
+
if shield_no_resize
|
100
|
+
`rsvg-convert #{shield.path} -z #{shield_scale} -o #{new_path}`
|
101
|
+
else
|
102
|
+
`rsvg-convert #{shield.path} -w #{(icon.width * shield_scale).to_i} -a -o #{new_path}`
|
103
|
+
end
|
104
|
+
new_shield = MiniMagick::Image.open(new_path)
|
99
105
|
else
|
100
|
-
|
106
|
+
new_shield = MiniMagick::Image.open(shield.path)
|
107
|
+
if icon.width > new_shield.width && !shield_no_resize
|
108
|
+
new_shield.resize "#{(icon.width * shield_scale).to_i}x#{icon.height}<"
|
109
|
+
else
|
110
|
+
new_shield.resize "#{icon.width}x#{icon.height}>"
|
111
|
+
end
|
101
112
|
end
|
102
113
|
|
103
|
-
result = composite(result,
|
114
|
+
result = composite(result, new_shield, alpha_channel, shield_gravity || "north", shield_geometry)
|
104
115
|
end
|
105
116
|
|
106
117
|
def load_shield(shield_string)
|
107
|
-
url = Badge.shield_base_url + Badge.shield_path + shield_string + ".svg"
|
108
|
-
file_name = shield_string + ".svg"
|
118
|
+
url = Badge.shield_base_url + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
119
|
+
file_name = shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
109
120
|
|
110
121
|
UI.verbose "Trying to load image from shield.io. Timeout: #{Badge.shield_io_timeout}s".blue
|
111
122
|
UI.verbose "URL: #{url}".blue
|
@@ -117,11 +128,12 @@ module Badge
|
|
117
128
|
|
118
129
|
def check_tools!
|
119
130
|
if !`which rsvg-convert`.include?('rsvg-convert')
|
120
|
-
UI.
|
121
|
-
UI.
|
122
|
-
UI.
|
131
|
+
UI.important("Install RSVG to get better results for shields ontop of your icon")
|
132
|
+
UI.important("")
|
133
|
+
UI.important("Install it using (RSVG):")
|
123
134
|
UI.command("brew install librsvg")
|
124
|
-
UI.
|
135
|
+
UI.important("")
|
136
|
+
@@rsvg_enabled = false
|
125
137
|
end
|
126
138
|
return if `which convert`.include?('convert')
|
127
139
|
return if `which gm`.include?('gm')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: badge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Griesser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.5'
|
69
|
-
description: 0.8.
|
69
|
+
description: 0.8.4
|
70
70
|
email:
|
71
71
|
- daniel.griesser.86@gmail.com
|
72
72
|
executables:
|