badge 0.8.6 → 0.8.7
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 +4 -8
- data/lib/badge/options.rb +3 -3
- data/lib/badge/runner.rb +11 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4690e5853b9ba97e9b5741603e278f27092de1b
|
4
|
+
data.tar.gz: 3ce2164672c0cf303563246a3fd866691171c8a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d425e77cb3315bb7fd1145462c6df28bf3050d312fee8ab2ebde6c3e837cfaa9d97d45219d9202fb78b35aedf2a2e85766ec4b176aae2775e5e5f297fb00fca6
|
7
|
+
data.tar.gz: dc4d29a721b0ec1e64d9681c16b7a67aac070967a1928e685062e7309ce95ed6eed24b657c58022749c70227f618f9d0e41007316976adc38fef68171c06a90a
|
data/lib/badge/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Badge
|
2
2
|
|
3
|
-
VERSION = "0.8.
|
3
|
+
VERSION = "0.8.7"
|
4
4
|
DESCRIPTION = "Add a badge overlay to your app icon"
|
5
5
|
|
6
6
|
def self.root
|
@@ -27,11 +27,7 @@ module Badge
|
|
27
27
|
File.join assets, 'alpha_badge_dark.png'
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.
|
31
|
-
'shields.io'
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.shield_serveice_base_url
|
30
|
+
def self.shield_base_url
|
35
31
|
'https://img.shields.io'
|
36
32
|
end
|
37
33
|
|
@@ -39,11 +35,11 @@ module Badge
|
|
39
35
|
'/badge/'
|
40
36
|
end
|
41
37
|
|
42
|
-
def self.
|
38
|
+
def self.shield_io_timeout
|
43
39
|
10
|
44
40
|
end
|
45
41
|
|
46
|
-
def self.
|
42
|
+
def self.shield_io_retries
|
47
43
|
10
|
48
44
|
end
|
49
45
|
|
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 shields.io 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_io_timeout,
|
40
|
+
description: "The timeout in seconds we should wait the get a response from shields.io",
|
41
41
|
type: Integer,
|
42
42
|
optional: true),
|
43
43
|
|
data/lib/badge/runner.rb
CHANGED
@@ -32,29 +32,29 @@ module Badge
|
|
32
32
|
|
33
33
|
shield = nil
|
34
34
|
begin
|
35
|
-
timeout = Badge.
|
36
|
-
timeout = options[:
|
35
|
+
timeout = Badge.shield_io_timeout
|
36
|
+
timeout = options[:shield_io_timeout] if options[:shield_io_timeout]
|
37
37
|
Timeout.timeout(timeout.to_i) do
|
38
38
|
shield = load_shield(options[:shield]) if options[:shield]
|
39
39
|
end
|
40
40
|
rescue Timeout::Error
|
41
|
-
UI.error "Error loading image from
|
41
|
+
UI.error "Error loading image from shields.io timeout reached. Use --verbose for more info".red
|
42
42
|
rescue Curl::Err::CurlError => error
|
43
43
|
response = error.io
|
44
|
-
UI.error "Error loading image from
|
44
|
+
UI.error "Error loading image from shields.io response Error. Use --verbose for more info".red
|
45
45
|
UI.verbose response.status if FastlaneCore::Globals.verbose?
|
46
46
|
rescue MiniMagick::Invalid
|
47
|
-
UI.error "Error validating image from
|
47
|
+
UI.error "Error validating image from shields.io. Use --verbose for more info".red
|
48
48
|
rescue Exception => error
|
49
49
|
UI.error "Other error occured. Use --verbose for more info".red
|
50
50
|
UI.verbose error if FastlaneCore::Globals.verbose?
|
51
51
|
end
|
52
52
|
|
53
53
|
if options[:shield] && shield == nil
|
54
|
-
if @@retry_attemps >= Badge.
|
55
|
-
UI.error "Cannot load image from
|
54
|
+
if @@retry_attemps >= Badge.shield_io_retries
|
55
|
+
UI.error "Cannot load image from shields.io skipping it...".red
|
56
56
|
else
|
57
|
-
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 shields.io tries remaining: #{Badge.shield_io_retries - @@retry_attemps}".red
|
58
58
|
sleep timeout.to_i
|
59
59
|
@@retry_attemps += 1
|
60
60
|
return run(path, options)
|
@@ -100,7 +100,7 @@ module Badge
|
|
100
100
|
|
101
101
|
def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_resize, shield_scale, shield_geometry)
|
102
102
|
UI.message "'#{icon.path}'"
|
103
|
-
UI.verbose "Adding
|
103
|
+
UI.verbose "Adding shields.io image ontop of icon".blue
|
104
104
|
|
105
105
|
shield_scale = shield_scale ? shield_scale.to_f : 1.0
|
106
106
|
|
@@ -125,10 +125,10 @@ module Badge
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def load_shield(shield_string)
|
128
|
-
url = Badge.
|
128
|
+
url = Badge.shield_base_url + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
129
129
|
file_name = shield_string + (@@rsvg_enabled ? ".svg" : ".png")
|
130
130
|
|
131
|
-
UI.verbose "Trying to load image from
|
131
|
+
UI.verbose "Trying to load image from shields.io. Timeout: #{Badge.shield_io_timeout}s".blue
|
132
132
|
UI.verbose "URL: #{url}".blue
|
133
133
|
|
134
134
|
Curl::Easy.download(url, file_name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Griesser
|
@@ -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.7
|
70
70
|
email:
|
71
71
|
- daniel.griesser.86@gmail.com
|
72
72
|
executables:
|