badge 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -11
- data/bin/badge +2 -61
- data/lib/badge.rb +3 -2
- data/lib/badge/base.rb +2 -2
- data/lib/badge/commands_generator.rb +42 -0
- data/lib/badge/options.rb +60 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b46f3eef495959c6dc67ff0e930e55903220866
|
4
|
+
data.tar.gz: fc2086bdd034e043be5f69fc706da2dfd8e8babf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 524f2731b16854c3bbbbb8a84dde6c43561c88753350694ed2a050b57549f5dacd2cecf0d5a82c0893fb4e2efa2522fa5ea285c76a52a67108f773dfe1b0523a
|
7
|
+
data.tar.gz: bbb93e44d1c2e63a848e9ecb7a894e7fcf54eeefa4b13eff6db4bb6a0e0765b99cb8194593f6e9080e5573f5272d0f692627a30f85eb755904913cf38a592708
|
data/README.md
CHANGED
@@ -26,19 +26,19 @@ It's built to easily integrate with [fastlane](https://github.com/fastlane/fastl
|
|
26
26
|
|
27
27
|
![assets/icon175x175_alpha_light_badged.png](assets/icon175x175_alpha_light_badged.png?raw=1) ![assets/icon175x175_fitrack_alpha_light_badged.png](assets/icon175x175_fitrack_alpha_light_badged.png?raw=1)
|
28
28
|
|
29
|
-
badge --shield
|
29
|
+
badge --shield "1.2-2031-orange" --no_badge
|
30
30
|
|
31
31
|
![assets/icon175x175_shield_1.2-2031-orange.png](assets/icon175x175_shield_1.2-2031-orange.png?raw=1) ![assets/icon175x175_fitrack_shield_1.2-2031-orange.png](assets/icon175x175_fitrack_shield_1.2-2031-orange.png?raw=1)
|
32
32
|
|
33
|
-
badge --shield
|
33
|
+
badge --shield "1.2-2031-orange" --no_badge --shield_no_resize
|
34
34
|
|
35
35
|
![assets/icon175x175_shield_1.2-2031-orange-no-resize.png](assets/icon175x175_shield_1.2-2031-orange-no-resize.png?raw=1) ![assets/icon175x175_fitrack_shield_1.2-2031-orange-no-resize.png](assets/icon175x175_fitrack_shield_1.2-2031-orange-no-resize.png?raw=1)
|
36
36
|
|
37
|
-
badge --shield
|
37
|
+
badge --shield "Version-0.0.3-blue" --dark
|
38
38
|
|
39
39
|
![assets/icon175x175_shield_Version-0.0.3-blue.png](assets/icon175x175_shield_Version-0.0.3-blue.png?raw=1) ![assets/icon175x175_fitrack_shield_Version-0.0.3-blue.png](assets/icon175x175_fitrack_shield_Version-0.0.3-blue.png?raw=1)
|
40
40
|
|
41
|
-
badge --shield
|
41
|
+
badge --shield "Version-0.0.3-blue" --dark --shield_no_resize
|
42
42
|
|
43
43
|
![assets/icon175x175_shield_Version-0.0.3-blue-no-resize.png](assets/icon175x175_shield_Version-0.0.3-blue-no-resize.png?raw=1) ![assets/icon175x175_fitrack_shield_Version-0.0.3-blue-no-resize.png](assets/icon175x175_fitrack_shield_Version-0.0.3-blue-no-resize.png?raw=1)
|
44
44
|
# Installation
|
@@ -50,14 +50,14 @@ Install the gem
|
|
50
50
|
|
51
51
|
# Usage
|
52
52
|
|
53
|
-
Call ```badge``` in your
|
53
|
+
Call ```badge``` in your projects root folder
|
54
54
|
|
55
55
|
badge
|
56
56
|
|
57
57
|
It will search all subfolders for your asset catalog app icon set and add the badge to the icons.
|
58
58
|
|
59
59
|
But you can also run badge on your Android or tvOS icons.
|
60
|
-
You have to use the `--glob
|
60
|
+
You have to use the `--glob "/**/*.appiconset/*.{png,PNG}"` parameter to adjust where to find your icons.
|
61
61
|
|
62
62
|
The keep the alpha channel in the icons use `--alpha_channel`
|
63
63
|
|
@@ -69,21 +69,21 @@ Here is the dark option (also available in combination with ```--alpha```):
|
|
69
69
|
|
70
70
|
You can also use your custom overlay/badge image
|
71
71
|
|
72
|
-
badge --custom
|
72
|
+
badge --custom "path_to/custom_badge.png"
|
73
73
|
|
74
74
|
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)
|
75
75
|
|
76
|
-
badge --shield
|
76
|
+
badge --shield "Version-0.0.3-blue"
|
77
77
|
|
78
|
-
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
|
78
|
+
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 t 10` accordingly.
|
79
79
|
|
80
|
-
`--shield_gravity
|
80
|
+
`--shield_gravity North` changes the postion of the shield on the icon. Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.
|
81
81
|
|
82
82
|
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.
|
83
83
|
|
84
84
|
Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
|
85
85
|
|
86
|
-
Use `badge
|
86
|
+
Use `badge --help` to get list all possible parameters.
|
87
87
|
|
88
88
|
# Usage with fastlane
|
89
89
|
|
data/bin/badge
CHANGED
@@ -1,66 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
2
|
$:.push File.expand_path("../../lib", __FILE__)
|
4
3
|
|
5
4
|
require 'badge'
|
6
|
-
require '
|
7
|
-
|
8
|
-
HighLine.track_eof = false
|
9
|
-
|
10
|
-
class BadgeApplication
|
11
|
-
include Commander::Methods
|
12
|
-
|
13
|
-
def run
|
14
|
-
program :version, Badge::VERSION
|
15
|
-
program :description, 'Add a badge to your ios app icon'
|
16
|
-
program :help, 'Author', 'Daniel Griesser <daniel.griesser.86@gmail.com>'
|
17
|
-
program :help, 'Website', 'https://github.com/HazAT/badge'
|
18
|
-
program :help, 'GitHub', 'https://github.com/HazAT/badge'
|
19
|
-
program :help_formatter, :compact
|
20
|
-
|
21
|
-
global_option('--verbose', 'Shows a more verbose output') { $verbose = true }
|
22
|
-
|
23
|
-
always_trace!
|
24
|
-
|
25
|
-
default_command :existing_project
|
26
|
-
|
27
|
-
command :existing_project do |c|
|
28
|
-
c.syntax = 'badge'
|
29
|
-
c.description = "Adds a badge to your ios app icon"
|
30
|
-
c.option '--dark', 'Adds a dark badge instead of the white'
|
31
|
-
c.option '--alpha', 'Uses the word alpha instead of beta'
|
32
|
-
c.option '--alpha_channel', 'Keeps/Adds an alpha channel to the icons'
|
33
|
-
c.option '--custom STRING', String, 'Overlay a custom image on your icon'
|
34
|
-
c.option '--no_badge', 'Removes the beta badge'
|
35
|
-
c.option '--badge_gravity STRING', String, 'Position of the badge on icon. Default: SouthEast - Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.'
|
36
|
-
c.option '--shield STRING', String, 'Overlay a shield from shield.io on your icon, eg: Version-1.2-green'
|
37
|
-
c.option '--shield_io_timeout INTEGER', Integer, 'The timeout in seconds we should wait the get a response from shield.io'
|
38
|
-
c.option '--shield_gravity STRING', String, 'Position of shield on icon. Default: North - Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.'
|
39
|
-
c.option '--shield_no_resize', 'Shield image will no longer be resized to aspect fill the full icon. Instead it will only be shrinked to not exceed the icon graphic.'
|
40
|
-
c.option '--glob STRING', String, 'Glob pattern for finding image files Default: CURRENT_PATH/**/*.appiconset/*.{png,PNG}'
|
41
|
-
|
42
|
-
c.action do |args, options|
|
43
|
-
params = {}
|
44
|
-
params[:dark] = options.dark
|
45
|
-
params[:custom] = options.custom
|
46
|
-
params[:no_badge] = options.no_badge
|
47
|
-
params[:badge_gravity] = options.badge_gravity
|
48
|
-
params[:shield] = options.shield
|
49
|
-
params[:shield_gravity] = options.shield_gravity
|
50
|
-
params[:shield_no_resize] = options.shield_no_resize
|
51
|
-
params[:shield_io_timeout] = options.shield_io_timeout
|
52
|
-
params[:alpha] = options.alpha
|
53
|
-
params[:glob] = options.glob
|
54
|
-
params[:alpha_channel] = options.alpha_channel
|
55
|
-
Badge::Runner.new.run('.', params)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
run!
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
5
|
+
require 'badge/commands_generator'
|
63
6
|
|
64
|
-
|
65
|
-
BadgeApplication.new.run
|
66
|
-
end
|
7
|
+
Badge::CommandsGenerator.start
|
data/lib/badge.rb
CHANGED
data/lib/badge/base.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'commander'
|
2
|
+
|
3
|
+
HighLine.track_eof = false
|
4
|
+
|
5
|
+
module Badge
|
6
|
+
class CommandsGenerator
|
7
|
+
|
8
|
+
include Commander::Methods
|
9
|
+
|
10
|
+
def self.start
|
11
|
+
self.new.run
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
program :version, Badge::VERSION
|
16
|
+
program :description, 'Add a badge to your app icon'
|
17
|
+
program :help, 'Author', 'Daniel Griesser <daniel.griesser.86@gmail.com>'
|
18
|
+
program :help, 'Website', 'https://github.com/HazAT/badge'
|
19
|
+
program :help, 'GitHub', 'https://github.com/HazAT/badge'
|
20
|
+
program :help_formatter, :compact
|
21
|
+
|
22
|
+
global_option('--verbose', 'Shows a more verbose output') { $verbose = true }
|
23
|
+
|
24
|
+
always_trace!
|
25
|
+
|
26
|
+
FastlaneCore::CommanderGenerator.new.generate(Badge::Options.available_options)
|
27
|
+
|
28
|
+
command :run do |c|
|
29
|
+
c.syntax = 'badge'
|
30
|
+
c.description = "Adds a badge to your app icon"
|
31
|
+
|
32
|
+
c.action do |args, options|
|
33
|
+
params = FastlaneCore::Configuration.create(Badge::Options.available_options, options.__hash__)
|
34
|
+
Badge::Runner.new.run('.', params)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
default_command :run
|
39
|
+
run!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'fastlane_core'
|
2
|
+
|
3
|
+
module Badge
|
4
|
+
class Options
|
5
|
+
def self.available_options
|
6
|
+
[
|
7
|
+
FastlaneCore::ConfigItem.new(key: :dark,
|
8
|
+
description: "Adds a dark badge instead of the white",
|
9
|
+
is_string: false,
|
10
|
+
optional: true),
|
11
|
+
|
12
|
+
FastlaneCore::ConfigItem.new(key: :alpha,
|
13
|
+
description: "Uses the work alpha instead of beta",
|
14
|
+
is_string: false,
|
15
|
+
optional: true),
|
16
|
+
|
17
|
+
FastlaneCore::ConfigItem.new(key: :alpha_channel,
|
18
|
+
description: "Keeps/Adds an alpha channel to the icons",
|
19
|
+
is_string: false,
|
20
|
+
optional: true),
|
21
|
+
|
22
|
+
FastlaneCore::ConfigItem.new(key: :custom,
|
23
|
+
description: "Overlay a custom image on your icon",
|
24
|
+
optional: true),
|
25
|
+
|
26
|
+
FastlaneCore::ConfigItem.new(key: :no_badge,
|
27
|
+
description: "Removes the beta badge",
|
28
|
+
is_string: false,
|
29
|
+
optional: true),
|
30
|
+
|
31
|
+
FastlaneCore::ConfigItem.new(key: :badge_gravity,
|
32
|
+
description: "Position of the badge on icon. Default: SouthEast - Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast",
|
33
|
+
optional: true),
|
34
|
+
|
35
|
+
FastlaneCore::ConfigItem.new(key: :shield,
|
36
|
+
description: "Overlay a shield from shield.io on your icon, eg: Version-1.2-green",
|
37
|
+
optional: true),
|
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",
|
41
|
+
type: Integer,
|
42
|
+
optional: true),
|
43
|
+
|
44
|
+
FastlaneCore::ConfigItem.new(key: :shield_gravity,
|
45
|
+
description: "Position of shield on icon. Default: North - Choices include: NorthWest, North, NorthEast, West, Center, East, South, West, South, SouthEast",
|
46
|
+
optional: true),
|
47
|
+
|
48
|
+
FastlaneCore::ConfigItem.new(key: :shield_no_resize,
|
49
|
+
description: "Shield image will no longer be resized to aspect fill the full icon. Instead it will only be shrinked to not exceed the icon graphic",
|
50
|
+
is_string: false,
|
51
|
+
optional: true),
|
52
|
+
|
53
|
+
FastlaneCore::ConfigItem.new(key: :glob,
|
54
|
+
description: "Glob pattern for finding image files Default: CURRENT_PATH/**/*.appiconset/*.{png,PNG}",
|
55
|
+
optional: true)
|
56
|
+
]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
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.
|
4
|
+
version: 0.6.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-
|
11
|
+
date: 2016-12-08 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.5'
|
61
|
-
description: 0.
|
61
|
+
description: 0.6.0
|
62
62
|
email:
|
63
63
|
- daniel.griesser.86@gmail.com
|
64
64
|
executables:
|
@@ -75,6 +75,8 @@ files:
|
|
75
75
|
- bin/badge
|
76
76
|
- lib/badge.rb
|
77
77
|
- lib/badge/base.rb
|
78
|
+
- lib/badge/commands_generator.rb
|
79
|
+
- lib/badge/options.rb
|
78
80
|
- lib/badge/runner.rb
|
79
81
|
homepage: https://github.com/HazAT/badge
|
80
82
|
licenses:
|
@@ -96,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
98
|
version: '0'
|
97
99
|
requirements: []
|
98
100
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.5.
|
101
|
+
rubygems_version: 2.5.2
|
100
102
|
signing_key:
|
101
103
|
specification_version: 4
|
102
|
-
summary: Add a badge overlay to your
|
104
|
+
summary: Add a badge overlay to your app icon
|
103
105
|
test_files: []
|