badge 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4260e6a31d54cb3133bc856d1b2fc3b8f0d3a0b4
4
+ data.tar.gz: 2732a2313e887af22b111d862abd5446aecac06f
5
+ SHA512:
6
+ metadata.gz: 0e090d3819d88534a40b35eb7394cdae774a2129ac1cf24fa1223ae6f3a64724164acc36fec302dc6d0ac88cfd20a5e40b2e1a2bc277604ce216fa84c86daaff
7
+ data.tar.gz: bbeae9a1b7ea997e90acd438b999d1a4f5c6281cbe142007d5287d59dd9fb015558bc3d6035ebca716ffc25650a8c5bdf2e221ff0a8a43e64302bcd167da3201
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Daniel Griesser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,47 @@
1
+ badge - add a badge to your iOS app icon
2
+ ============
3
+
4
+ [![Twitter: @DanielGri](https://img.shields.io/badge/contact-@DanielGri-blue.svg?style=flat)](https://twitter.com/DanielGri)
5
+ [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/HazAT/badge/blob/master/LICENSE)
6
+ [![Gem](https://img.shields.io/gem/v/badge.svg?style=flat)](http://rubygems.org/gems/badge)
7
+
8
+ # Features
9
+
10
+ This gem helps to add a badge to your iOS app icon.
11
+
12
+ Yes that's it.
13
+ It's built to easily integrate with [fastlane](https://github.com/fastlane/fastlane).
14
+
15
+ ![assets/icon175x175.png](assets/icon175x175.png?raw=1) ![assets/icon175x175_fitrack.png](assets/icon175x175_fitrack.png?raw=1)
16
+
17
+ becomes
18
+
19
+ ![assets/icon175x175_badged.png](assets/icon175x175_badged.png?raw=1)
20
+
21
+ # Installation
22
+
23
+ Install the gem
24
+
25
+ sudo gem install badge
26
+
27
+ # Usage
28
+
29
+ Call ```badge``` in your iOS projects root folder
30
+
31
+ badge
32
+
33
+ It will search all subfolders for your asset catalog app icon set and add the badge to the icon.
34
+
35
+ You can also use your custom overlay/badge image
36
+
37
+ badge --custom="path_to/custom_badge.png"
38
+
39
+ ## Uninstall
40
+
41
+ sudo gem uninstall badge
42
+
43
+ # Thanks
44
+ [@KrauseFx](https://twitter.com/KrauseFx) [fastlane](https://github.com/fastlane/fastlane) tools.
45
+
46
+ # License
47
+ This project is licensed under the terms of the MIT license. See the LICENSE file.
Binary file
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.expand_path("../../lib", __FILE__)
4
+
5
+ require 'badge'
6
+ require 'commander'
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 beta badge to your 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
+ always_trace!
22
+
23
+ default_command :existing_project
24
+
25
+ command :existing_project do |c|
26
+ c.syntax = 'badge'
27
+ c.description = "adds a beta badge to your app icon"
28
+ c.option '--custom STRING', String, 'overlay a custom image on your icon'
29
+
30
+ c.action do |args, options|
31
+ Badge::Runner.new.run('.', options.custom)
32
+ end
33
+ end
34
+
35
+ run!
36
+ end
37
+ end
38
+
39
+
40
+ begin
41
+ BadgeApplication.new.run
42
+ end
@@ -0,0 +1,8 @@
1
+ require 'badge/base'
2
+ require 'badge/runner'
3
+ #
4
+ require 'fastlane_core'
5
+ #
6
+ module Badge
7
+ Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
8
+ end
@@ -0,0 +1,12 @@
1
+ module Badge
2
+ VERSION = "0.0.1"
3
+ DESCRIPTION = "Add a badge overlay to your app icon"
4
+
5
+ def self.root
6
+ File.dirname __dir__ + "/../../../"
7
+ end
8
+
9
+ def self.assets
10
+ File.join root, 'assets'
11
+ end
12
+ end
@@ -0,0 +1,37 @@
1
+ require 'fastimage'
2
+ require 'mini_magick'
3
+
4
+ module Badge
5
+ class Runner
6
+
7
+ def run(path, custom_badge)
8
+ app_icons = Dir.glob("#{path}/**/*.appiconset/*.{png,PNG}")
9
+
10
+ if app_icons.count > 0
11
+ Helper.log.info "Start adding badges...".green
12
+
13
+ app_icons.each do |full_path|
14
+ Helper.log.info "'#{full_path}'"
15
+ icon_path = Pathname.new(full_path)
16
+ icon = MiniMagick::Image.new(full_path)
17
+
18
+ if custom_badge && File.exist?(custom_badge) # check if custom image is provided
19
+ badge = MiniMagick::Image.open(custom_badge)
20
+ else
21
+ badge = MiniMagick::Image.open("#{Badge.assets}/beta_badge.png")
22
+ end
23
+
24
+ badge.resize "#{icon.width}x#{icon.height}"
25
+ result = icon.composite(badge) do |c|
26
+ c.compose "Over"
27
+ end
28
+ result.write icon_path.basename
29
+ end
30
+
31
+ Helper.log.info "Badged \\o/!".green
32
+ else
33
+ Helper.log.error "Could not find any app icons...".red
34
+ end
35
+ end
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: badge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Griesser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fastlane_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.25.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.25.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: fastimage
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 1.6.3
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 1.6.3
47
+ - !ruby/object:Gem::Dependency
48
+ name: mini_magick
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 4.0.2
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: 4.0.2
61
+ description: 0.0.1
62
+ email:
63
+ - daniel.griesser.86@gmail.com
64
+ executables:
65
+ - badge
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - lib/badge/base.rb
70
+ - lib/badge/runner.rb
71
+ - lib/badge.rb
72
+ - bin/badge
73
+ - README.md
74
+ - LICENSE
75
+ - assets/beta_badge.png
76
+ homepage: https://github.com/HazAT/badge
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: 2.0.0
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.6
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Add a badge overlay to your app icon
100
+ test_files: []