badge 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c6ec35356aef97660149f9ca8d347281f49d1f1
4
- data.tar.gz: 640f410e232eff57730c0ee0601e2d20d6d43886
3
+ metadata.gz: 21eb824c67cbeb34f07eaa6fd066c65a90bea9e2
4
+ data.tar.gz: 5dfe6b6ef8c1775850e6ae4726a4c328ad28dfa7
5
5
  SHA512:
6
- metadata.gz: 3ef3497ec0dbe826ac158b8c3defe52161ed54d4313927aa7f6996d95f4372c8a3883cf5074b4f9bed87e9a3c7b00a11d9f6afc44ff39180c861a3efc9062897
7
- data.tar.gz: c71234d740996950a01650f0c984bf019dac0f92359bd18e90320895bf1e905714b307e231307a006d56cd8f5f715aa51317a34c941689fd2da4adfd121b7afb
6
+ metadata.gz: 9d4f89b2482d91487ac9b8cb6774b8b646e026c51b0cfcc01b189e0856eccb74d927f0426dd7ceab4b09142f271888850be37971f3bd22f70d5da3dfbef1f82f
7
+ data.tar.gz: 844a0553e6b460f6f957d7361045597a5d046f232489ff7ac5ba2eabc38303a4a9cf2dc307b10ddc3857bf76b0c4b461a2d33e0a10647821db6334c359c0cf75
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- badge - add a badge to your iOS app icon
1
+ badge - add a badge to your iOS/Android app icon
2
2
  ============
3
3
 
4
4
  [![Twitter: @DanielGri](https://img.shields.io/badge/contact-@DanielGri-blue.svg?style=flat)](https://twitter.com/DanielGri)
@@ -7,7 +7,7 @@ badge - add a badge to your iOS app icon
7
7
 
8
8
  # Features
9
9
 
10
- This gem helps to add a badge to your iOS app icon.
10
+ This gem helps to add a badge to your iOS/Android app icon.
11
11
 
12
12
  Yes that's it.
13
13
  It's built to easily integrate with [fastlane](https://github.com/fastlane/fastlane).
@@ -46,8 +46,14 @@ Call ```badge``` in your iOS projects root folder
46
46
 
47
47
  badge
48
48
 
49
- It will search all subfolders for your asset catalog app icon set and add the badge to the icon.
50
- *Be careful, it actually overwrites the icon files because this gem is meant to be used in and automated build environment.*
49
+ It will search all subfolders for your asset catalog app icon set and add the badge to the icons.
50
+
51
+ But you can also run badge on your Android icons.
52
+ You have to use the `--glob="/**/*.appiconset/*.{png,PNG}"` parameter to adjust where to find your icons.
53
+
54
+ The keep the alpha channel in the icons use `--alpha_channel`
55
+
56
+ *Be careful, it actually overwrites the icon files.*
51
57
 
52
58
  Here is the dark option (also available in combination with ```--alpha```):
53
59
 
@@ -61,8 +67,11 @@ Add a shield at the top of your icon for all possibilites head over to: [shields
61
67
 
62
68
  badge --shield="Version-0.0.3-blue"
63
69
 
70
+ 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.
71
+
64
72
  Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
65
73
 
74
+
66
75
  # Usage with fastlane
67
76
 
68
77
  ```ruby
data/bin/badge CHANGED
@@ -29,6 +29,7 @@ class BadgeApplication
29
29
  c.description = "Adds a badge to your ios app icon"
30
30
  c.option '--dark', 'Adds a dark badge instead of the white'
31
31
  c.option '--alpha', 'Uses the word alpha instead of beta'
32
+ c.option '--alpha_channel', 'Keeps/Adds an alpha channel to the icons'
32
33
  c.option '--custom STRING', String, 'Overlay a custom image on your icon'
33
34
  c.option '--no_badge', 'Removes the beta badge'
34
35
  c.option '--shield STRING', String, 'Overlay a shield from shield.io on your icon, eg: Version-1.2-green'
@@ -44,6 +45,7 @@ class BadgeApplication
44
45
  params[:shield_io_timeout] = options.shield_io_timeout
45
46
  params[:alpha] = options.alpha
46
47
  params[:glob] = options.glob
48
+ params[:alpha_channel] = options.alpha_channel
47
49
  Badge::Runner.new.run('.', params)
48
50
  end
49
51
  end
@@ -1,6 +1,6 @@
1
1
  module Badge
2
2
 
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  DESCRIPTION = "Add a badge overlay to your ios app icon"
5
5
 
6
6
  def self.root
@@ -13,6 +13,11 @@ module Badge
13
13
  Helper.log.info "Verbose active...".blue unless not $verbose
14
14
  Helper.log.info "Parameters: #{options.inspect}".blue unless not $verbose
15
15
 
16
+ alpha_channel = false
17
+ if options[:alpha_channel]
18
+ alpha_channel = true
19
+ end
20
+
16
21
  if app_icons.count > 0
17
22
  Helper.log.info "Start adding badges...".green
18
23
 
@@ -35,11 +40,11 @@ module Badge
35
40
  result = MiniMagick::Image.new(full_path)
36
41
 
37
42
  if !options[:no_badge]
38
- result = add_badge(options[:custom], options[:dark], icon, options[:alpha])
43
+ result = add_badge(options[:custom], options[:dark], icon, options[:alpha], alpha_channel)
39
44
  icon_changed = true
40
45
  end
41
46
  if shield
42
- result = add_shield(icon, result, shield)
47
+ result = add_shield(icon, result, shield, alpha_channel)
43
48
  icon_changed = true
44
49
  end
45
50
 
@@ -58,14 +63,15 @@ module Badge
58
63
  end
59
64
  end
60
65
 
61
- def add_shield(icon, result, shield)
66
+ def add_shield(icon, result, shield, alpha_channel)
62
67
  Helper.log.info "'#{icon.path}'"
63
68
  Helper.log.info "Adding shield.io image ontop of icon".blue unless not $verbose
64
69
 
65
70
  current_shield = MiniMagick::Image.open(shield.path)
66
71
  current_shield.resize "#{icon.width}x#{icon.height}>"
67
- result = result.composite(current_shield) do |c|
72
+ result = result.composite(current_shield, 'png') do |c|
68
73
  c.compose "Over"
74
+ c.alpha 'On' unless !alpha_channel
69
75
  c.gravity "north"
70
76
  end
71
77
  end
@@ -84,7 +90,7 @@ module Badge
84
90
  end
85
91
  end
86
92
 
87
- def add_badge(custom_badge, dark_badge, icon, alpha_badge)
93
+ def add_badge(custom_badge, dark_badge, icon, alpha_badge, alpha_channel)
88
94
  Helper.log.info "'#{icon.path}'"
89
95
  Helper.log.info "Adding badge image ontop of icon".blue unless not $verbose
90
96
  if custom_badge && File.exist?(custom_badge) # check if custom image is provided
@@ -98,8 +104,9 @@ module Badge
98
104
  end
99
105
 
100
106
  badge.resize "#{icon.width}x#{icon.height}"
101
- result = icon.composite(badge) do |c|
107
+ result = icon.composite(badge, 'png') do |c|
102
108
  c.compose "Over"
109
+ c.alpha 'On' unless !alpha_channel
103
110
  end
104
111
  end
105
112
  end
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.2.0
4
+ version: 0.3.0
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-02-12 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -58,7 +58,7 @@ dependencies:
58
58
  - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  version: 4.0.2
61
- description: 0.2.0
61
+ description: 0.3.0
62
62
  email:
63
63
  - daniel.griesser.86@gmail.com
64
64
  executables: