badge 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/badge.rb +1 -1
- data/lib/badge/base.rb +1 -1
- data/lib/badge/runner.rb +21 -21
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6e7be74490391b278353a104c112c35e79c34f
|
4
|
+
data.tar.gz: 46e3549960cdac887b7b021881461bf1f696050f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a847598a6267a7d239febb141a3f918bcec7517256619878123e0f5da56e67406b62672a3faf1b251a38df7da42642dbb8e0cba3262fdfb674a8230f01ce6f69
|
7
|
+
data.tar.gz: a931a652cbe50b3dd3955162b2007bffcb303846d9a15aafbc482f7d29d4bbfe88b55938b7be13060e2750301c8a467979333064b82233701d222babe5b54974
|
data/README.md
CHANGED
@@ -79,7 +79,7 @@ Sometimes the response from shield.io takes a long time and can timeout. You can
|
|
79
79
|
|
80
80
|
`--shield_gravity=North` changes the postion of the shield on the icon. Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.
|
81
81
|
|
82
|
-
In version
|
82
|
+
In version [0.4.0](https://github.com/HazAT/badge/releases/tag/0.4.0) the default behavior of the shield graphic has been changed. The shield graphic will always be resized to **aspect fill** the icon instead of just adding the shield on the icon. The disable to new behaviour use `--shield_no_resize` which now only puts the shield on the icon again.
|
83
83
|
|
84
84
|
Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
|
85
85
|
|
@@ -114,7 +114,10 @@ end
|
|
114
114
|
If Jenkins has problems finding imagemagick on your mac add following env variable to your job:
|
115
115
|
|
116
116
|
PATH=$PATH:/usr/local/bin
|
117
|
+
|
118
|
+
Make sure you have imagemagick installed on your machine e.g. for Mac its:
|
117
119
|
|
120
|
+
brew install imagemagick
|
118
121
|
|
119
122
|
## Uninstall
|
120
123
|
|
data/lib/badge.rb
CHANGED
data/lib/badge/base.rb
CHANGED
data/lib/badge/runner.rb
CHANGED
@@ -8,11 +8,11 @@ module Badge
|
|
8
8
|
|
9
9
|
def run(path, options)
|
10
10
|
glob = "/**/*.appiconset/*.{png,PNG}"
|
11
|
-
glob = options[:glob]
|
11
|
+
glob = options[:glob] if options[:glob]
|
12
12
|
|
13
13
|
app_icons = Dir.glob("#{path}#{glob}")
|
14
|
-
|
15
|
-
|
14
|
+
UI.verbose "Verbose active...".blue
|
15
|
+
UI.verbose "Parameters: #{options.inspect}".blue
|
16
16
|
|
17
17
|
alpha_channel = false
|
18
18
|
if options[:alpha_channel]
|
@@ -20,29 +20,29 @@ module Badge
|
|
20
20
|
end
|
21
21
|
|
22
22
|
if app_icons.count > 0
|
23
|
-
|
23
|
+
UI.message "Start adding badges...".green
|
24
24
|
|
25
25
|
shield = nil
|
26
26
|
response_error = false
|
27
27
|
begin
|
28
28
|
timeout = Badge.shield_io_timeout
|
29
|
-
timeout = options[:shield_io_timeout]
|
29
|
+
timeout = options[:shield_io_timeout] if options[:shield_io_timeout]
|
30
30
|
Timeout.timeout(timeout.to_i) do
|
31
|
-
shield = load_shield(options[:shield])
|
31
|
+
shield = load_shield(options[:shield]) if options[:shield]
|
32
32
|
end
|
33
33
|
rescue Timeout::Error
|
34
|
-
|
34
|
+
UI.error "Error loading image from shield.io timeout reached. Skipping Shield. Use --verbose for more info".red
|
35
35
|
rescue OpenURI::HTTPError => error
|
36
36
|
response = error.io
|
37
|
-
|
38
|
-
|
37
|
+
UI.error "Error loading image from shield.io response Error. Skipping Shield. Use --verbose for more info".red
|
38
|
+
UI.error response.status if $verbose
|
39
39
|
response_error = true
|
40
40
|
end
|
41
41
|
|
42
42
|
if @@retry_count <= 0
|
43
|
-
|
43
|
+
UI.error "Cannot load image from shield.io skipping it...".red
|
44
44
|
elsif response_error
|
45
|
-
|
45
|
+
UI.message "Waiting for #{timeout.to_i}s and retry to load image from shield.io tries remaining: #{@@retry_count}".red
|
46
46
|
sleep timeout.to_i
|
47
47
|
@@retry_count -= 1
|
48
48
|
return run(path, options)
|
@@ -70,18 +70,18 @@ module Badge
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
if icon_changed
|
73
|
-
|
73
|
+
UI.message "Badged \\o/!".green
|
74
74
|
else
|
75
|
-
|
75
|
+
UI.message "Did nothing... Enable --verbose for more info.".red
|
76
76
|
end
|
77
77
|
else
|
78
|
-
|
78
|
+
UI.error "Could not find any app icons...".red
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_resize)
|
83
|
-
|
84
|
-
|
83
|
+
UI.message "'#{icon.path}'"
|
84
|
+
UI.verbose "Adding shield.io image ontop of icon".blue
|
85
85
|
|
86
86
|
current_shield = MiniMagick::Image.open(shield.path)
|
87
87
|
|
@@ -93,7 +93,7 @@ module Badge
|
|
93
93
|
|
94
94
|
result = result.composite(current_shield, 'png') do |c|
|
95
95
|
c.compose "Over"
|
96
|
-
c.alpha 'On'
|
96
|
+
c.alpha 'On' if alpha_channel
|
97
97
|
if shield_gravity
|
98
98
|
c.gravity shield_gravity
|
99
99
|
else
|
@@ -106,8 +106,8 @@ module Badge
|
|
106
106
|
url = Badge.shield_base_url + Badge.shield_path + shield_string + ".png"
|
107
107
|
file_name = shield_string + ".png"
|
108
108
|
|
109
|
-
|
110
|
-
|
109
|
+
UI.verbose "Trying to load image from shield.io. Timeout: #{Badge.shield_io_timeout}s".blue
|
110
|
+
UI.verbose "URL: #{url}".blue
|
111
111
|
|
112
112
|
shield = Tempfile.new(file_name).tap do |file|
|
113
113
|
file.binmode
|
@@ -117,8 +117,8 @@ module Badge
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def add_badge(custom_badge, dark_badge, icon, alpha_badge, alpha_channel)
|
120
|
-
|
121
|
-
|
120
|
+
UI.message "'#{icon.path}'"
|
121
|
+
UI.verbose "Adding badge image ontop of icon".blue
|
122
122
|
if custom_badge && File.exist?(custom_badge) # check if custom image is provided
|
123
123
|
badge = MiniMagick::Image.open(custom_badge)
|
124
124
|
else
|
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Griesser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.44.0
|
20
20
|
- - <
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.44.0
|
30
30
|
- - <
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 4.5.1
|
61
|
-
description: 0.4.
|
61
|
+
description: 0.4.2
|
62
62
|
email:
|
63
63
|
- daniel.griesser.86@gmail.com
|
64
64
|
executables:
|