badge 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +32 -3
- data/assets/beta_badge_dark.png +0 -0
- data/assets/beta_badge_light.png +0 -0
- data/bin/badge +2 -1
- data/lib/badge/base.rb +11 -1
- data/lib/badge/runner.rb +4 -4
- metadata +4 -3
- data/assets/beta_badge.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ee2703b12fc01896725fa15aa2674f10db25e7f
|
4
|
+
data.tar.gz: a1181524ea6309e364c091c0dcdb12221513eadf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b2b5786709b71d53280eb64ec35ca54cec38f4d1c36c9feb762f5d05b1bccd7b45be4adfad133169838641b80bfd8519e6d6f76e61e3ff7960bf2757f3ada3
|
7
|
+
data.tar.gz: 639b3ebbfcb2b29da54e2774fc26946277732a3ace8db862d3e12bf0b04e99d7e33e7b081160e1bba0e38e2ed17fca8702355399a429191d9df30ed1363f02c4
|
data/README.md
CHANGED
@@ -16,7 +16,11 @@ It's built to easily integrate with [fastlane](https://github.com/fastlane/fastl
|
|
16
16
|
|
17
17
|
becomes
|
18
18
|
|
19
|
-
 
|
20
|
+
|
21
|
+
or with ```--dark```
|
22
|
+
|
23
|
+
 
|
20
24
|
|
21
25
|
# Installation
|
22
26
|
|
@@ -30,18 +34,43 @@ Call ```badge``` in your iOS projects root folder
|
|
30
34
|
|
31
35
|
badge
|
32
36
|
|
33
|
-
It will search all subfolders for your asset catalog app icon set and add the badge to the icon.
|
37
|
+
It will search all subfolders for your asset catalog app icon set and add the badge to the icon.
|
38
|
+
*Be careful, it actually overwrites the icon files because this gem is meant to be used in and automated build environment.*
|
39
|
+
|
40
|
+
Here is the dark option:
|
41
|
+
|
42
|
+
badge --dark
|
34
43
|
|
35
44
|
You can also use your custom overlay/badge image
|
36
45
|
|
37
46
|
badge --custom="path_to/custom_badge.png"
|
38
47
|
|
48
|
+
# Usage with fastlane
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
lane :appstore do
|
52
|
+
increment_build_number
|
53
|
+
cocoapods
|
54
|
+
|
55
|
+
sh "badge --dark"
|
56
|
+
|
57
|
+
xctool
|
58
|
+
snapshot
|
59
|
+
sigh
|
60
|
+
deliver
|
61
|
+
sh "./customScript.sh"
|
62
|
+
|
63
|
+
slack
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
|
39
68
|
## Uninstall
|
40
69
|
|
41
70
|
sudo gem uninstall badge
|
42
71
|
|
43
72
|
# Thanks
|
44
|
-
[@KrauseFx](https://twitter.com/KrauseFx) [fastlane](https://github.com/fastlane/fastlane)
|
73
|
+
[@ThomasMirnig](https://twitter.com/ThomasMirnig) [@KrauseFx](https://twitter.com/KrauseFx) [fastlane](https://github.com/fastlane/fastlane)
|
45
74
|
|
46
75
|
# License
|
47
76
|
This project is licensed under the terms of the MIT license. See the LICENSE file.
|
Binary file
|
Binary file
|
data/bin/badge
CHANGED
@@ -25,10 +25,11 @@ class BadgeApplication
|
|
25
25
|
command :existing_project do |c|
|
26
26
|
c.syntax = 'badge'
|
27
27
|
c.description = "adds a beta badge to your app icon"
|
28
|
+
c.option '--dark', 'adds a dark badge instead of the white'
|
28
29
|
c.option '--custom STRING', String, 'overlay a custom image on your icon'
|
29
30
|
|
30
31
|
c.action do |args, options|
|
31
|
-
Badge::Runner.new.run('.', options.custom)
|
32
|
+
Badge::Runner.new.run('.', options.dark, options.custom)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
data/lib/badge/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Badge
|
2
|
-
|
2
|
+
|
3
|
+
VERSION = "0.0.2"
|
3
4
|
DESCRIPTION = "Add a badge overlay to your app icon"
|
4
5
|
|
5
6
|
def self.root
|
@@ -9,4 +10,13 @@ module Badge
|
|
9
10
|
def self.assets
|
10
11
|
File.join root, 'assets'
|
11
12
|
end
|
13
|
+
|
14
|
+
def self.light_badge
|
15
|
+
File.join assets, 'beta_badge_light.png'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.dark_badge
|
19
|
+
File.join assets, 'beta_badge_dark.png'
|
20
|
+
end
|
21
|
+
|
12
22
|
end
|
data/lib/badge/runner.rb
CHANGED
@@ -4,7 +4,7 @@ require 'mini_magick'
|
|
4
4
|
module Badge
|
5
5
|
class Runner
|
6
6
|
|
7
|
-
def run(path, custom_badge)
|
7
|
+
def run(path, dark_badge, custom_badge)
|
8
8
|
app_icons = Dir.glob("#{path}/**/*.appiconset/*.{png,PNG}")
|
9
9
|
|
10
10
|
if app_icons.count > 0
|
@@ -13,19 +13,19 @@ module Badge
|
|
13
13
|
app_icons.each do |full_path|
|
14
14
|
Helper.log.info "'#{full_path}'"
|
15
15
|
icon_path = Pathname.new(full_path)
|
16
|
-
icon
|
16
|
+
icon = MiniMagick::Image.new(full_path)
|
17
17
|
|
18
18
|
if custom_badge && File.exist?(custom_badge) # check if custom image is provided
|
19
19
|
badge = MiniMagick::Image.open(custom_badge)
|
20
20
|
else
|
21
|
-
badge = MiniMagick::Image.open(
|
21
|
+
badge = MiniMagick::Image.open(dark_badge ? Badge.dark_badge : Badge.light_badge)
|
22
22
|
end
|
23
23
|
|
24
24
|
badge.resize "#{icon.width}x#{icon.height}"
|
25
25
|
result = icon.composite(badge) do |c|
|
26
26
|
c.compose "Over"
|
27
27
|
end
|
28
|
-
result.write
|
28
|
+
result.write full_path
|
29
29
|
end
|
30
30
|
|
31
31
|
Helper.log.info "Badged \\o/!".green
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Griesser
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 4.0.2
|
61
|
-
description: 0.0.
|
61
|
+
description: 0.0.2
|
62
62
|
email:
|
63
63
|
- daniel.griesser.86@gmail.com
|
64
64
|
executables:
|
@@ -72,7 +72,8 @@ files:
|
|
72
72
|
- bin/badge
|
73
73
|
- README.md
|
74
74
|
- LICENSE
|
75
|
-
- assets/
|
75
|
+
- assets/beta_badge_dark.png
|
76
|
+
- assets/beta_badge_light.png
|
76
77
|
homepage: https://github.com/HazAT/badge
|
77
78
|
licenses:
|
78
79
|
- MIT
|
data/assets/beta_badge.png
DELETED
Binary file
|