badge 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -15
- data/lib/badge/base.rb +8 -4
- data/lib/badge/options.rb +3 -3
- data/lib/badge/runner.rb +16 -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: 105dd6560b16aab0e4fdd0e00cf06d280464e3d8
|
4
|
+
data.tar.gz: 186182b62f9f9be3d815c5d77ba8b9df737592e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f5a3c1506fbd9022c13d527d195cafe8ef0bdc474e59966ab0531283dd13d9450e3e1867a17c0532525910f4da1571fe9db2ad452b244197e209ae6934132e
|
7
|
+
data.tar.gz: 6c54a968cc0be8ab75428253077af888f705571699c7f2321b10509741f6547dca82e685d5100c5023912e4e1a4615a6d8cd3411cef8dc56e24243fba8efc14e
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ badge --shield "Version-0.0.3-blue" --dark --shield_geometry "+0+25%" --shield_s
|
|
57
57
|
|
58
58
|
![assets/icon175x175_shield_Version-0.0.3-blue-geo-scale.png](assets/icon175x175_shield_Version-0.0.3-blue-geo-scale.png?raw=1) ![assets/icon175x175_fitrack_shield_Version-0.0.3-blue-geo-scale.png](assets/icon175x175_fitrack_shield_Version-0.0.3-blue-geo-scale.png?raw=1)
|
59
59
|
---
|
60
|
-
|
60
|
+
|
61
61
|
# Installation
|
62
62
|
|
63
63
|
Install the gem
|
@@ -70,16 +70,16 @@ Install the gem
|
|
70
70
|
Call ```badge``` in your projects root folder
|
71
71
|
|
72
72
|
badge
|
73
|
-
|
74
|
-
It will search all subfolders for your asset catalog app icon set and add the badge to the icons.
|
73
|
+
|
74
|
+
It will search all subfolders for your asset catalog app icon set and add the badge to the icons.
|
75
75
|
|
76
76
|
You can also run badge on your Android, tvOS icons, or any other iconset.
|
77
|
-
You have to use the `--glob "/**/*.appiconset/*.{png,PNG}"` parameter to adjust where to find your icons.
|
77
|
+
You have to use the `--glob "/**/*.appiconset/*.{png,PNG}"` parameter to adjust where to find your icons.
|
78
78
|
|
79
79
|
:warning: Note that you have to use a `/` in the beginning of the custom path, even if you're not starting from the root path, f.ex. if your icons are in `res/ios/beta/Appicon/*`, your badge call would be `badge --glob "/res/ios/beta/Appicon/*"`
|
80
80
|
|
81
81
|
The keep the alpha channel in the icons use `--alpha_channel`
|
82
|
-
|
82
|
+
|
83
83
|
*Be careful, it actually overwrites the icon files.*
|
84
84
|
|
85
85
|
Here is the dark option (also available in combination with ```--alpha```):
|
@@ -89,35 +89,36 @@ Here is the dark option (also available in combination with ```--alpha```):
|
|
89
89
|
You can also use your custom overlay/badge image
|
90
90
|
|
91
91
|
badge --custom "path_to/custom_badge.png"
|
92
|
-
|
92
|
+
|
93
93
|
Add a shield at the top of your icon for all possibilites head over to: [shields.io](http://shields.io/). You just have to add the string of shield (copied from the URL)
|
94
94
|
|
95
95
|
badge --shield "Version-0.0.3-blue"
|
96
96
|
|
97
|
-
Sometimes the response from
|
97
|
+
Sometimes the response from shields.io takes a long time and can timeout. You can adjust the timeout to shields.io with `--shield_io_timeout 10` accordingly.
|
98
98
|
|
99
99
|
`--shield_gravity North` changes the postion of the shield on the icon. Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.
|
100
100
|
|
101
101
|
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.
|
102
102
|
|
103
|
-
Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
|
103
|
+
Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
|
104
104
|
|
105
105
|
Use `badge --help` to get list all possible parameters.
|
106
106
|
|
107
107
|
# Usage with fastlane
|
108
108
|
|
109
|
-
|
109
|
+
Please use the fastlane plugin: https://github.com/HazAT/fastlane-plugin-badge
|
110
|
+
It has the same parameters as this gem.
|
110
111
|
|
111
112
|
```ruby
|
112
113
|
lane :appstore do
|
113
114
|
increment_build_number
|
114
115
|
cocoapods
|
115
116
|
|
116
|
-
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
|
117
|
+
add_badge(dark: true) #or
|
118
|
+
#add_badge(alpha: true) #or
|
119
|
+
#add_badge(custom: "/Users/HazA/Desktop/badge.png") #or
|
120
|
+
#add_badge(shield: "Version-0.0.3-blue", no_badge: true)
|
121
|
+
|
121
122
|
xctool
|
122
123
|
snapshot
|
123
124
|
sigh
|
@@ -133,7 +134,7 @@ end
|
|
133
134
|
If Jenkins has problems finding imagemagick on your mac add following env variable to your job:
|
134
135
|
|
135
136
|
PATH=$PATH:/usr/local/bin
|
136
|
-
|
137
|
+
|
137
138
|
Make sure you have imagemagick installed on your machine e.g. for Mac its:
|
138
139
|
|
139
140
|
brew install imagemagick
|
data/lib/badge/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Badge
|
2
2
|
|
3
|
-
VERSION = "0.8.
|
3
|
+
VERSION = "0.8.6"
|
4
4
|
DESCRIPTION = "Add a badge overlay to your app icon"
|
5
5
|
|
6
6
|
def self.root
|
@@ -27,7 +27,11 @@ module Badge
|
|
27
27
|
File.join assets, 'alpha_badge_dark.png'
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.
|
30
|
+
def self.shield_service_name
|
31
|
+
'shields.io'
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.shield_serveice_base_url
|
31
35
|
'https://img.shields.io'
|
32
36
|
end
|
33
37
|
|
@@ -35,11 +39,11 @@ module Badge
|
|
35
39
|
'/badge/'
|
36
40
|
end
|
37
41
|
|
38
|
-
def self.
|
42
|
+
def self.shield_service_timeout
|
39
43
|
10
|
40
44
|
end
|
41
45
|
|
42
|
-
def self.
|
46
|
+
def self.shield_service_retries
|
43
47
|
10
|
44
48
|
end
|
45
49
|
|
data/lib/badge/options.rb
CHANGED
@@ -33,11 +33,11 @@ module Badge
|
|
33
33
|
optional: true),
|
34
34
|
|
35
35
|
FastlaneCore::ConfigItem.new(key: :shield,
|
36
|
-
description: "Overlay a shield from
|
36
|
+
description: "Overlay a shield from #{Badge.shield_service_name} on your icon, eg: Version-1.2-green",
|
37
37
|
optional: true),
|
38
38
|
|
39
|
-
FastlaneCore::ConfigItem.new(key: :
|
40
|
-
description: "The timeout in seconds we should wait the get a response from
|
39
|
+
FastlaneCore::ConfigItem.new(key: :shield_service_timeout,
|
40
|
+
description: "The timeout in seconds we should wait the get a response from #{Badge.shield_service_name}",
|
41
41
|
type: Integer,
|
42
42
|
optional: true),
|
43
43
|
|
data/lib/badge/runner.rb
CHANGED
@@ -17,6 +17,11 @@ module Badge
|
|
17
17
|
UI.verbose "Verbose active... VERSION: #{Badge::VERSION}".blue
|
18
18
|
UI.verbose "Parameters: #{options.values.inspect}".blue
|
19
19
|
|
20
|
+
if options[:custom] && !File.exist?(options[:custom])
|
21
|
+
UI.error("Could not find custom badge image")
|
22
|
+
UI.user_error!("Specify a valid custom badge image path!")
|
23
|
+
end
|
24
|
+
|
20
25
|
alpha_channel = false
|
21
26
|
if options[:alpha_channel]
|
22
27
|
alpha_channel = true
|
@@ -27,29 +32,29 @@ module Badge
|
|
27
32
|
|
28
33
|
shield = nil
|
29
34
|
begin
|
30
|
-
timeout = Badge.
|
31
|
-
timeout = options[:
|
35
|
+
timeout = Badge.shield_service_timeout
|
36
|
+
timeout = options[:shield_service_timeout] if options[:shield_service_timeout]
|
32
37
|
Timeout.timeout(timeout.to_i) do
|
33
38
|
shield = load_shield(options[:shield]) if options[:shield]
|
34
39
|
end
|
35
40
|
rescue Timeout::Error
|
36
|
-
UI.error "Error loading image from
|
41
|
+
UI.error "Error loading image from #{Badge.shield_service_name} timeout reached. Use --verbose for more info".red
|
37
42
|
rescue Curl::Err::CurlError => error
|
38
43
|
response = error.io
|
39
|
-
UI.error "Error loading image from
|
44
|
+
UI.error "Error loading image from #{Badge.shield_service_name} response Error. Use --verbose for more info".red
|
40
45
|
UI.verbose response.status if FastlaneCore::Globals.verbose?
|
41
46
|
rescue MiniMagick::Invalid
|
42
|
-
UI.error "Error validating image from
|
47
|
+
UI.error "Error validating image from #{Badge.shield_service_name}. Use --verbose for more info".red
|
43
48
|
rescue Exception => error
|
44
49
|
UI.error "Other error occured. Use --verbose for more info".red
|
45
50
|
UI.verbose error if FastlaneCore::Globals.verbose?
|
46
51
|
end
|
47
52
|
|
48
53
|
if options[:shield] && shield == nil
|
49
|
-
if @@retry_attemps >= Badge.
|
50
|
-
UI.error "Cannot load image from
|
54
|
+
if @@retry_attemps >= Badge.shield_service_retries
|
55
|
+
UI.error "Cannot load image from #{Badge.shield_service_name} skipping it...".red
|
51
56
|
else
|
52
|
-
UI.message "Waiting for #{timeout.to_i}s and retry to load image from
|
57
|
+
UI.message "Waiting for #{timeout.to_i}s and retry to load image from #{Badge.shield_service_name} tries remaining: #{Badge.shield_service_retries - @@retry_attemps}".red
|
53
58
|
sleep timeout.to_i
|
54
59
|
@@retry_attemps += 1
|
55
60
|
return run(path, options)
|
@@ -95,7 +100,7 @@ module Badge
|
|
95
100
|
|
96
101
|
def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_resize, shield_scale, shield_geometry)
|
97
102
|
UI.message "'#{icon.path}'"
|
98
|
-
UI.verbose "Adding
|
103
|
+
UI.verbose "Adding #{Badge.shield_service_name} image ontop of icon".blue
|
99
104
|
|
100
105
|
shield_scale = shield_scale ? shield_scale.to_f : 1.0
|
101
106
|
|
@@ -120,10 +125,10 @@ module Badge
|
|
120
125
|
end
|
121
126
|
|
122
127
|
def load_shield(shield_string)
|
123
|
-
url = Badge.
|
128
|
+
url = Badge.shield_serveice_base_url + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
124
129
|
file_name = shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
125
130
|
|
126
|
-
UI.verbose "Trying to load image from
|
131
|
+
UI.verbose "Trying to load image from #{Badge.shield_service_name}. Timeout: #{Badge.shield_service_timeout}s".blue
|
127
132
|
UI.verbose "URL: #{url}".blue
|
128
133
|
|
129
134
|
Curl::Easy.download(url, file_name)
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Griesser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-08 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.6
|
70
70
|
email:
|
71
71
|
- daniel.griesser.86@gmail.com
|
72
72
|
executables:
|