badge 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/badge +14 -8
- data/lib/badge/base.rb +2 -2
- data/lib/badge/runner.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28cdb0b407de805ff7f3e9f5dbf1d5cc9bb8cc8c
|
4
|
+
data.tar.gz: 7c71842dd19ea862c4d8b3c1410a4567b4e89cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f7929a37a7505fca9675d35731dc2449cecca2254e9d15254cc309e96e758fc2a3d6203dbb90dbd4f136652fbe7e384eede354e562a780fe908859a37f0707e
|
7
|
+
data.tar.gz: 7e4cc3190d857383158fd3d13ab6c971f558da9774238ed3a12ef0b81f3d98ddb17b445e36ae7cb335a110c00192609e68d63c1dbe509421ce7272c7ca0b301c
|
data/bin/badge
CHANGED
@@ -12,7 +12,7 @@ class BadgeApplication
|
|
12
12
|
|
13
13
|
def run
|
14
14
|
program :version, Badge::VERSION
|
15
|
-
program :description, 'Add a
|
15
|
+
program :description, 'Add a badge to your ios app icon'
|
16
16
|
program :help, 'Author', 'Daniel Griesser <daniel.griesser.86@gmail.com>'
|
17
17
|
program :help, 'Website', 'https://github.com/HazAT/badge'
|
18
18
|
program :help, 'GitHub', 'https://github.com/HazAT/badge'
|
@@ -26,15 +26,21 @@ class BadgeApplication
|
|
26
26
|
|
27
27
|
command :existing_project do |c|
|
28
28
|
c.syntax = 'badge'
|
29
|
-
c.description = "
|
30
|
-
c.option '--dark', '
|
31
|
-
c.option '--alpha', '
|
32
|
-
c.option '--custom STRING', String, '
|
33
|
-
c.option '--no_badge', '
|
34
|
-
c.option '--shield STRING', String, '
|
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 '--custom STRING', String, 'Overlay a custom image on your icon'
|
33
|
+
c.option '--no_badge', 'Removes the beta badge'
|
34
|
+
c.option '--shield STRING', String, 'Overlay a shield from shield.io on your icon, eg: Version-1.2-green'
|
35
35
|
|
36
36
|
c.action do |args, options|
|
37
|
-
|
37
|
+
params = {}
|
38
|
+
params[:dark] = options.dark
|
39
|
+
params[:custom_badge] = options.custom
|
40
|
+
params[:no_badge] = options.no_badge
|
41
|
+
params[:shield_string] = options.shield
|
42
|
+
params[:alpha_badge] = options.alpha
|
43
|
+
Badge::Runner.new.run('.', params)
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
data/lib/badge/base.rb
CHANGED
data/lib/badge/runner.rb
CHANGED
@@ -5,10 +5,10 @@ require 'mini_magick'
|
|
5
5
|
module Badge
|
6
6
|
class Runner
|
7
7
|
|
8
|
-
def run(path,
|
8
|
+
def run(path, options)
|
9
9
|
app_icons = Dir.glob("#{path}/**/*.appiconset/*.{png,PNG}")
|
10
|
-
|
11
10
|
Helper.log.info "Verbose active...".blue unless not $verbose
|
11
|
+
Helper.log.info "Parameters: #{options.inspect}".blue unless not $verbose
|
12
12
|
|
13
13
|
if app_icons.count > 0
|
14
14
|
Helper.log.info "Start adding badges...".green
|
@@ -16,7 +16,7 @@ module Badge
|
|
16
16
|
shield = nil
|
17
17
|
begin
|
18
18
|
Timeout.timeout(Badge.shield_io_timeout) do
|
19
|
-
shield = load_shield(shield_string) unless not shield_string
|
19
|
+
shield = load_shield(options[:shield_string]) unless not options[:shield_string]
|
20
20
|
end
|
21
21
|
rescue Timeout::Error
|
22
22
|
Helper.log.error "Error loading image from shield.io timeout reached. Skipping Shield. Use --verbose for more info".red
|
@@ -28,7 +28,7 @@ module Badge
|
|
28
28
|
icon = MiniMagick::Image.new(full_path)
|
29
29
|
|
30
30
|
result = MiniMagick::Image.new(full_path)
|
31
|
-
result = add_badge(custom_badge,
|
31
|
+
result = add_badge(options[:custom_badge], options[:dark], icon, options[:alpha_badge]) unless options[:no_badge]
|
32
32
|
|
33
33
|
result = add_shield(icon, result, shield) unless not shield
|
34
34
|
|
@@ -57,7 +57,7 @@ module Badge
|
|
57
57
|
url = Badge.shield_base_url + Badge.shield_path + shield_string + ".png"
|
58
58
|
file_name = shield_string + ".png"
|
59
59
|
|
60
|
-
Helper.log.info "Trying to load image from shield.io. Timeout: ".blue unless not $verbose
|
60
|
+
Helper.log.info "Trying to load image from shield.io. Timeout: #{Badge.shield_io_timeout}s".blue unless not $verbose
|
61
61
|
Helper.log.info "URL: #{url}".blue unless not $verbose
|
62
62
|
|
63
63
|
shield = Tempfile.new(file_name).tap do |file|
|
@@ -68,7 +68,7 @@ module Badge
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def add_badge(custom_badge, dark_badge, icon, alpha_badge)
|
71
|
-
Helper.log.info "Adding
|
71
|
+
Helper.log.info "Adding badge image ontop of icon".blue unless not $verbose
|
72
72
|
if custom_badge && File.exist?(custom_badge) # check if custom image is provided
|
73
73
|
badge = MiniMagick::Image.open(custom_badge)
|
74
74
|
else
|
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.0
|
4
|
+
version: 0.1.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-01
|
11
|
+
date: 2016-02-01 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.0
|
61
|
+
description: 0.1.0
|
62
62
|
email:
|
63
63
|
- daniel.griesser.86@gmail.com
|
64
64
|
executables:
|
@@ -99,5 +99,5 @@ rubyforge_project:
|
|
99
99
|
rubygems_version: 2.0.6
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
|
-
summary: Add a badge overlay to your app icon
|
102
|
+
summary: Add a badge overlay to your ios app icon
|
103
103
|
test_files: []
|