badge 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c6e7be74490391b278353a104c112c35e79c34f
4
- data.tar.gz: 46e3549960cdac887b7b021881461bf1f696050f
3
+ metadata.gz: 307f9b7edfd352b5479fee083ea69abd4eab7ebd
4
+ data.tar.gz: 2c9ad804cce291c8928eff21b21be6b018dd3acb
5
5
  SHA512:
6
- metadata.gz: a847598a6267a7d239febb141a3f918bcec7517256619878123e0f5da56e67406b62672a3faf1b251a38df7da42642dbb8e0cba3262fdfb674a8230f01ce6f69
7
- data.tar.gz: a931a652cbe50b3dd3955162b2007bffcb303846d9a15aafbc482f7d29d4bbfe88b55938b7be13060e2750301c8a467979333064b82233701d222babe5b54974
6
+ metadata.gz: ea3a4cd5ea6888fef9eaea2cfa6247e7ddfc9b157d1588f512a4046931c2aac1c64ed86f4ff94a7093ea2d81448b42765fc634430ed41e0c2c5da03043f43099
7
+ data.tar.gz: 4b2c2fcea5a95c25d1d47d9fad1c90657ad693961f0880642d6211bb972f4adc0e8c618e9e48d1fd6d1af746f63bfe15a9a24ffa6658028b71e78317b9725eee
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Daniel Griesser
3
+ Copyright (c) 2016 Daniel Griesser <daniel.griesser.86@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- badge - add a badge to your iOS/Android app icon
1
+ badge - add a badge to your tvOS/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/Android app icon
7
7
 
8
8
  # Features
9
9
 
10
- This gem helps to add a badge to your iOS/Android app icon.
10
+ This gem helps to add a badge to your tvOS/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).
@@ -56,7 +56,7 @@ Call ```badge``` in your iOS projects root folder
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
- But you can also run badge on your Android icons.
59
+ But you can also run badge on your Android or tvOS icons.
60
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`
data/bin/badge CHANGED
@@ -32,6 +32,7 @@ class BadgeApplication
32
32
  c.option '--alpha_channel', 'Keeps/Adds an alpha channel to the icons'
33
33
  c.option '--custom STRING', String, 'Overlay a custom image on your icon'
34
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.'
35
36
  c.option '--shield STRING', String, 'Overlay a shield from shield.io on your icon, eg: Version-1.2-green'
36
37
  c.option '--shield_io_timeout INTEGER', Integer, 'The timeout in seconds we should wait the get a response from shield.io'
37
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.'
@@ -43,6 +44,7 @@ class BadgeApplication
43
44
  params[:dark] = options.dark
44
45
  params[:custom] = options.custom
45
46
  params[:no_badge] = options.no_badge
47
+ params[:badge_gravity] = options.badge_gravity
46
48
  params[:shield] = options.shield
47
49
  params[:shield_gravity] = options.shield_gravity
48
50
  params[:shield_no_resize] = options.shield_no_resize
@@ -1,6 +1,6 @@
1
1
  module Badge
2
2
 
3
- VERSION = "0.4.2"
3
+ VERSION = "0.5.0"
4
4
  DESCRIPTION = "Add a badge overlay to your ios app icon"
5
5
 
6
6
  def self.root
@@ -56,7 +56,7 @@ module Badge
56
56
  result = MiniMagick::Image.new(full_path)
57
57
 
58
58
  if !options[:no_badge]
59
- result = add_badge(options[:custom], options[:dark], icon, options[:alpha], alpha_channel)
59
+ result = add_badge(options[:custom], options[:dark], icon, options[:alpha], alpha_channel, options[:badge_gravity])
60
60
  icon_changed = true
61
61
  end
62
62
  if shield
@@ -91,15 +91,7 @@ module Badge
91
91
  current_shield.resize "#{icon.width}x#{icon.height}>"
92
92
  end
93
93
 
94
- result = result.composite(current_shield, 'png') do |c|
95
- c.compose "Over"
96
- c.alpha 'On' if alpha_channel
97
- if shield_gravity
98
- c.gravity shield_gravity
99
- else
100
- c.gravity "north"
101
- end
102
- end
94
+ result = composite(result, current_shield, alpha_channel, shield_gravity || "north")
103
95
  end
104
96
 
105
97
  def load_shield(shield_string)
@@ -116,7 +108,7 @@ module Badge
116
108
  end
117
109
  end
118
110
 
119
- def add_badge(custom_badge, dark_badge, icon, alpha_badge, alpha_channel)
111
+ def add_badge(custom_badge, dark_badge, icon, alpha_badge, alpha_channel, badge_gravity)
120
112
  UI.message "'#{icon.path}'"
121
113
  UI.verbose "Adding badge image ontop of icon".blue
122
114
  if custom_badge && File.exist?(custom_badge) # check if custom image is provided
@@ -130,9 +122,14 @@ module Badge
130
122
  end
131
123
 
132
124
  badge.resize "#{icon.width}x#{icon.height}"
133
- result = icon.composite(badge, 'png') do |c|
125
+ result = composite(icon, badge, alpha_channel, badge_gravity || "SouthEast")
126
+ end
127
+
128
+ def composite(image, overlay, alpha_channel, gravity)
129
+ image.composite(overlay, 'png') do |c|
134
130
  c.compose "Over"
135
131
  c.alpha 'On' unless !alpha_channel
132
+ c.gravity gravity
136
133
  end
137
134
  end
138
135
  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.4.2
4
+ version: 0.5.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-06-01 00:00:00.000000000 Z
11
+ date: 2016-09-26 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.1
61
- description: 0.4.2
61
+ description: 0.5.0
62
62
  email:
63
63
  - daniel.griesser.86@gmail.com
64
64
  executables: