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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6acfc4494a3c8e85fc4d8d0b19167d205ae50f3
4
- data.tar.gz: 78305f25e672aa1fa2b82fa0c882d78c50fd56f1
3
+ metadata.gz: 105dd6560b16aab0e4fdd0e00cf06d280464e3d8
4
+ data.tar.gz: 186182b62f9f9be3d815c5d77ba8b9df737592e5
5
5
  SHA512:
6
- metadata.gz: c9a9c38be73c5e278726f9e8ca2d088576b653e1afd0e640ce3781b232223f1ce359362825cb85a8513e62acb11b2745d4ea62277247126ca2a166782e40acb7
7
- data.tar.gz: 30a96b6ed74e0d954b47b7cb1682cf5c5acaa2e334b0184bae9a82bca54102407651466a92b53a6526e115ff70aa3ae5886433753c455ad4ed5d9195830f1744
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 shield.io takes a long time and can timeout. You can adjust the timeout to shield.io with `--shield_io_timeout 10` accordingly.
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
- I try to keep fastlane integration up-to-date with the gem version. So generally you can use every parameter with fastlane which is also available directly in the gem. It mainly depends how fast the pull requests get merged and a new version of fastlane is available. If there is a problem you can always fallback to the fastlane `sh "cd ..; badge --dark"` command to use everything like it is used in the command line.
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
- badge(dark: true) #or
117
- #badge(alpha: true) #or
118
- #badge(custom: "/Users/HazA/Desktop/badge.png") #or
119
- #badge(shield: "Version-0.0.3-blue", no_badge: true)
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
@@ -1,6 +1,6 @@
1
1
  module Badge
2
2
 
3
- VERSION = "0.8.5"
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.shield_base_url
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.shield_io_timeout
42
+ def self.shield_service_timeout
39
43
  10
40
44
  end
41
45
 
42
- def self.shield_io_retries
46
+ def self.shield_service_retries
43
47
  10
44
48
  end
45
49
 
@@ -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 shield.io on your icon, eg: Version-1.2-green",
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: :shield_io_timeout,
40
- description: "The timeout in seconds we should wait the get a response from shield.io",
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
 
@@ -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.shield_io_timeout
31
- timeout = options[:shield_io_timeout] if options[:shield_io_timeout]
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 shield.io timeout reached. Use --verbose for more info".red
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 shield.io response Error. Use --verbose for more info".red
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 shield.io. Use --verbose for more info".red
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.shield_io_retries
50
- UI.error "Cannot load image from shield.io skipping it...".red
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 shield.io tries remaining: #{Badge.shield_io_retries - @@retry_attemps}".red
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 shield.io image ontop of icon".blue
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.shield_base_url + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
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 shield.io. Timeout: #{Badge.shield_io_timeout}s".blue
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.5
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: 2017-08-22 00:00:00.000000000 Z
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.5
69
+ description: 0.8.6
70
70
  email:
71
71
  - daniel.griesser.86@gmail.com
72
72
  executables: