badge 0.3.0 → 0.4.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: 21eb824c67cbeb34f07eaa6fd066c65a90bea9e2
4
- data.tar.gz: 5dfe6b6ef8c1775850e6ae4726a4c328ad28dfa7
3
+ metadata.gz: 3aef91776cdf789a5b8e78e8a1f4ec1d3c9b1b76
4
+ data.tar.gz: 9e82876afce0b73f62f0baf08d6af5b763fef212
5
5
  SHA512:
6
- metadata.gz: 9d4f89b2482d91487ac9b8cb6774b8b646e026c51b0cfcc01b189e0856eccb74d927f0426dd7ceab4b09142f271888850be37971f3bd22f70d5da3dfbef1f82f
7
- data.tar.gz: 844a0553e6b460f6f957d7361045597a5d046f232489ff7ac5ba2eabc38303a4a9cf2dc307b10ddc3857bf76b0c4b461a2d33e0a10647821db6334c359c0cf75
6
+ metadata.gz: 0cd6f132c177e1e1ca21dd40db3b79dfb509f9d81a78297c34a2630e9d5d0f04498ae840c68e4668c3e8c05ed75027c330a3d8bb9a1556bde15238f1bd1dea6d
7
+ data.tar.gz: 6f3aab19e6473acd3a278509295c7c7abc28224e90cb8d6d258d58ebf2147094c99751eacfba46658345f74a6d44c6916a615b5025a19fd98f22a8425ffd39fb
data/README.md CHANGED
@@ -40,6 +40,7 @@ Install the gem
40
40
 
41
41
  sudo gem install badge
42
42
 
43
+
43
44
  # Usage
44
45
 
45
46
  Call ```badge``` in your iOS projects root folder
@@ -69,11 +70,18 @@ Add a shield at the top of your icon for all possibilites head over to: [shields
69
70
 
70
71
  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=10` accordingly.
71
72
 
73
+ `--shield-gravity=North` changes the postion of the shield on the icon. Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.
74
+
75
+ In version `0.4.0` (coming soon) 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.
76
+
72
77
  Add ```--no_badge``` as an option to hide the beta badge completely if you just want to add a shield.
73
78
 
79
+ Use `badge existing_project --help` to get list all possible parameters.
74
80
 
75
81
  # Usage with fastlane
76
82
 
83
+ I try to keep fastlane integration up-to-date with the gem version. So generally you can use every parameter with fastlane which is also available directly in the gem. It mainly depends how fast the pull requests get merged and a new version of fastlane is available. If there is a problem you can always fallback to the fastlane `sh "cd ..; badge --dark"` command to use everything like it is used in the command line.
84
+
77
85
  ```ruby
78
86
  lane :appstore do
79
87
  increment_build_number
@@ -94,6 +102,8 @@ lane :appstore do
94
102
  end
95
103
  ```
96
104
 
105
+ # Common problems
106
+
97
107
  If Jenkins has problems finding imagemagick on your mac add following env variable to your job:
98
108
 
99
109
  PATH=$PATH:/usr/local/bin
data/bin/badge CHANGED
@@ -34,6 +34,8 @@ class BadgeApplication
34
34
  c.option '--no_badge', 'Removes the beta badge'
35
35
  c.option '--shield STRING', String, 'Overlay a shield from shield.io on your icon, eg: Version-1.2-green'
36
36
  c.option '--shield_io_timeout INTEGER', Integer, 'The timeout in seconds we should wait the get a response from shield.io'
37
+ c.option '--shield_gravity STRING', String, 'Position of shield on icon. Default: North - Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast.'
38
+ 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.'
37
39
  c.option '--glob STRING', String, 'Glob pattern for finding image files Default: CURRENT_PATH/**/*.appiconset/*.{png,PNG}'
38
40
 
39
41
  c.action do |args, options|
@@ -42,6 +44,8 @@ class BadgeApplication
42
44
  params[:custom] = options.custom
43
45
  params[:no_badge] = options.no_badge
44
46
  params[:shield] = options.shield
47
+ params[:shield_gravity] = options.shield_gravity
48
+ params[:shield_no_resize] = options.shield_no_resize
45
49
  params[:shield_io_timeout] = options.shield_io_timeout
46
50
  params[:alpha] = options.alpha
47
51
  params[:glob] = options.glob
data/lib/badge/base.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Badge
2
2
 
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  DESCRIPTION = "Add a badge overlay to your ios app icon"
5
5
 
6
6
  def self.root
data/lib/badge/runner.rb CHANGED
@@ -44,7 +44,7 @@ module Badge
44
44
  icon_changed = true
45
45
  end
46
46
  if shield
47
- result = add_shield(icon, result, shield, alpha_channel)
47
+ result = add_shield(icon, result, shield, alpha_channel, options[:shield_gravity], options[:shield_no_resize])
48
48
  icon_changed = true
49
49
  end
50
50
 
@@ -63,16 +63,26 @@ module Badge
63
63
  end
64
64
  end
65
65
 
66
- def add_shield(icon, result, shield, alpha_channel)
66
+ def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_resize)
67
67
  Helper.log.info "'#{icon.path}'"
68
68
  Helper.log.info "Adding shield.io image ontop of icon".blue unless not $verbose
69
69
 
70
70
  current_shield = MiniMagick::Image.open(shield.path)
71
- current_shield.resize "#{icon.width}x#{icon.height}>"
71
+
72
+ if icon.width > current_shield.width && !shield_no_resize
73
+ current_shield.resize "#{icon.width}x#{icon.height}<"
74
+ else
75
+ current_shield.resize "#{icon.width}x#{icon.height}>"
76
+ end
77
+
72
78
  result = result.composite(current_shield, 'png') do |c|
73
79
  c.compose "Over"
74
80
  c.alpha 'On' unless !alpha_channel
75
- c.gravity "north"
81
+ if shield_gravity
82
+ c.gravity shield_gravity
83
+ else
84
+ c.gravity "north"
85
+ end
76
86
  end
77
87
  end
78
88
 
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.3.0
4
+ version: 0.4.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-02-22 00:00:00.000000000 Z
11
+ date: 2016-02-28 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.3.0
61
+ description: 0.4.0
62
62
  email:
63
63
  - daniel.griesser.86@gmail.com
64
64
  executables: