fastlane-plugin-appicon 0.15.0 → 0.16.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
  SHA256:
3
- metadata.gz: bced1c1899f354fefda0cd562c1adfc9ed9dcda60a699ab89e669af56d76dfc7
4
- data.tar.gz: cb9889f63c757b3c81334c32ee29e4c6cb7567a5ee762005488deb6a4abe84cd
3
+ metadata.gz: 34a5a40f00f66babf8d35487344ed174c6413cb93a7436a4b2b1db448d1f139d
4
+ data.tar.gz: cbd32bd140fca377d4da0d05616234a51e9b4765fcb90b4d0f09c6b965dc4320
5
5
  SHA512:
6
- metadata.gz: 7d5440ea9762219b3b382515bd463dacbc83e14be779a1d01b962906cba942302d2dfed6de6d240052ab53f7da194fe19a0f5042b9ba021dda2e9f9ea70baed9
7
- data.tar.gz: 8c9be79cb72d748708cdda5c60b3341c2043053a9221665763d2fea5663274e3f88b365262ae51bfd66af62ec415d47769069b90f29b9a59d3ac7ca8f319557e
6
+ metadata.gz: 6188bd3df216a12c1d075f47005362f47519f0214355b87af6bae097f232048aed91901dff69635120d7b010d042f5d368f31bd5f4be6c0dc01c59a248219095
7
+ data.tar.gz: 55a65329ca48a57857a0db29c9ea9967fa909e65f2cd4f69d95e47f7bf87cdeb6b1523756fe91cb0cb1b2a57bac6e8ed7d8b0eff7062f9eca64fd9d146f82ffa
data/README.md CHANGED
@@ -12,11 +12,19 @@ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To ge
12
12
  fastlane add_plugin appicon
13
13
  ```
14
14
 
15
- Please note that this plugin uses the GraphicsMagick library. If you do not have it, you can install it via Homebrew:
15
+
16
+ Please note that this plugin uses [minimagick](https://github.com/minimagick/minimagick), which requires either GraphicsMagick or ImageMagick library. If you have neither, you can install either via Homebrew:
17
+
16
18
 
17
19
  ```
18
20
  brew install graphicsmagick
19
21
  ```
22
+ or
23
+ ```
24
+ brew install imagemagick
25
+ ```
26
+
27
+ The default CLI for the `mini_magick` gem is set to auto pick. It will first try to use `GraphicsMagick` (if you have it installed) otherwise it will use `ImageMagick`. If you want to be explicit about which CLI you use, set the `minimagick_cli` option to `graphicsmagick` or `imagemagick`. Not specifying this option will set `MiniMagick` to use auto which will choose what's available.
20
28
 
21
29
  ## About appicon
22
30
 
@@ -30,7 +38,9 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
30
38
 
31
39
  Just specify the source image using the `appicon_image_file`. Optionally specify the devices using `appicon_devices` and the destination path using `appicon_path`.
32
40
 
33
- We recommend storing the full-size picture at `fastlane/metadata/app_icon.png` so it can be picked up by _deliver_, as well as this plugin
41
+ We recommend storing the full-size picture at `fastlane/metadata/app_icon.png` so it can be picked up by _deliver_, as well as this plugin.
42
+
43
+ If you want to use this plugin to generate a app icon for Messages(sticker) extension, set `messages_extension` to `true` and add `messages` to the `appicon_devices`.
34
44
 
35
45
  ```ruby
36
46
  lane :basic do
@@ -59,6 +69,11 @@ lane :test3 do
59
69
  )
60
70
  end
61
71
 
72
+ lane :test4 do
73
+ appicon(appicon_image_file: 'spec/fixtures/Themoji.png',
74
+ appicon_devices: [:macos])
75
+ end
76
+
62
77
  lane :splash_screen do
63
78
  appicon(
64
79
  appicon_image_file: 'spec/fixtures/splash_screen.png',
@@ -68,6 +83,15 @@ lane :splash_screen do
68
83
  )
69
84
  end
70
85
 
86
+ lane :messages_extension do
87
+ appicon(
88
+ appicon_image_file: "fastlane/metadata/iMessageAppIcon.png",
89
+ appicon_devices: [:iphone, :ipad, :ios_marketing, :messages],
90
+ appicon_path: 'iMessageStickers/Stickers.xcassets',
91
+ messages_extension: true
92
+ )
93
+ end
94
+
71
95
  # or
72
96
 
73
97
  lane :android do
@@ -115,7 +139,7 @@ If you have trouble using plugins, check out the [Plugins Troubleshooting](https
115
139
 
116
140
  ## Using `fastlane` Plugins
117
141
 
118
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
142
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
119
143
 
120
144
  ## About `fastlane`
121
145
 
@@ -42,6 +42,9 @@ module Fastlane
42
42
  end
43
43
 
44
44
  def self.run(params)
45
+
46
+ Helper::AppiconHelper.set_cli(params[:minimagick_cli])
47
+
45
48
  fname = params[:appicon_image_file]
46
49
  custom_sizes = params[:appicon_custom_sizes]
47
50
 
@@ -49,7 +52,7 @@ module Fastlane
49
52
  icons.each do |icon|
50
53
  image = MiniMagick::Image.open(fname)
51
54
 
52
- Helper::AppiconHelper.check_input_image_size(image, 1024)
55
+ Helper::AppiconHelper.check_input_image_size(image, 1024, 1024)
53
56
 
54
57
  # Custom icons will have basepath and filename already defined
55
58
  if icon.has_key?('basepath') && icon.has_key?('filename')
@@ -169,7 +172,16 @@ module Fastlane
169
172
  FastlaneCore::ConfigItem.new(key: :generate_rounded,
170
173
  description: "Generate round icons?",
171
174
  default_value: false,
172
- type: Boolean)
175
+ type: Boolean),
176
+ FastlaneCore::ConfigItem.new(key: :minimagick_cli,
177
+ env_name: "APPICON_MINIMAGICK_CLI",
178
+ description: "Set MiniMagick CLI (auto picked by default). Values are: graphicsmagick, imagemagick",
179
+ optional: true,
180
+ type: String,
181
+ verify_block: proc do |value|
182
+ av = %w(graphicsmagick imagemagick)
183
+ UI.user_error!("Unsupported minimagick cli '#{value}', must be: #{av}") unless av.include?(value)
184
+ end)
173
185
  ]
174
186
  end
175
187
 
@@ -38,6 +38,29 @@ module Fastlane
38
38
  },
39
39
  :watch_marketing => {
40
40
  '1x' => ['1024x1024']
41
+ },
42
+ :macos => {
43
+ '1x' => ['16x16', '32x32', '128x128', '256x256', '512x512'],
44
+ '2x' => ['16x16', '32x32', '128x128', '256x256', '512x512'],
45
+ }
46
+ }
47
+ end
48
+
49
+ def self.needed_icons_messages_extension
50
+ {
51
+ iphone: {
52
+ '2x' => ['60x45'],
53
+ '3x' => ['60x45']
54
+ },
55
+ ipad: {
56
+ '2x' => ['67x50', '74x55']
57
+ },
58
+ messages: {
59
+ '2x' => ['27x20', '32x24'],
60
+ '3x' => ['27x20', '32x24']
61
+ },
62
+ ios_marketing: {
63
+ '1x' => ['1024x768']
41
64
  }
42
65
  }
43
66
  end
@@ -45,11 +68,19 @@ module Fastlane
45
68
  def self.run(params)
46
69
  fname = params[:appicon_image_file]
47
70
  basename = File.basename(fname, File.extname(fname))
48
- basepath = Pathname.new(File.join(params[:appicon_path], params[:appicon_name]))
49
71
 
72
+ Helper::AppiconHelper.set_cli(params[:minimagick_cli])
73
+
74
+ is_messages_extension = params[:messages_extension]
75
+ basepath = Pathname.new(File.join(params[:appicon_path], is_messages_extension ? params[:appicon_messages_name] : params[:appicon_name]))
76
+
50
77
  image = MiniMagick::Image.open(fname)
51
78
 
52
- Helper::AppiconHelper.check_input_image_size(image, 1024)
79
+ if is_messages_extension
80
+ Helper::AppiconHelper.check_input_image_size(image, 1024, 768)
81
+ else
82
+ Helper::AppiconHelper.check_input_image_size(image, 1024, 1024)
83
+ end
53
84
 
54
85
  # Convert image to png
55
86
  image.format 'png'
@@ -65,7 +96,7 @@ module Fastlane
65
96
 
66
97
  images = []
67
98
 
68
- icons = Helper::AppiconHelper.get_needed_icons(params[:appicon_devices], self.needed_icons, false)
99
+ icons = Helper::AppiconHelper.get_needed_icons(params[:appicon_devices], is_messages_extension ? self.needed_icons_messages_extension : self.needed_icons, false)
69
100
  icons.each do |icon|
70
101
  width = icon['width']
71
102
  height = icon['height']
@@ -76,7 +107,8 @@ module Fastlane
76
107
  filename += ".png"
77
108
 
78
109
  # downsize icon
79
- image.resize "#{width}x#{height}"
110
+ # "!" resizes to exact size (needed for messages extension)
111
+ image.resize "#{width}x#{height}!"
80
112
 
81
113
  # Don't write change/created times into the PNG properties
82
114
  # so unchanged files don't have different hashes.
@@ -90,6 +122,18 @@ module Fastlane
90
122
  'scale' => icon['scale']
91
123
  }
92
124
 
125
+ # if device is messages, we need to set it to universal
126
+ if icon['device'] == 'messages'
127
+ info['idiom'] = 'universal'
128
+ info['platform'] = 'ios'
129
+ end
130
+
131
+ # if device is ios_marketing but we are generating messages extension app, set the idiom correctly
132
+ if icon['device'] == 'ios_marketing' && is_messages_extension
133
+ info['platform'] = 'ios'
134
+ end
135
+
136
+
93
137
  unless icon['device'] == 'universal'
94
138
  info['size'] = icon['size']
95
139
  end
@@ -146,12 +190,33 @@ module Fastlane
146
190
  description: "Name of the appiconset inside the asset catalogue",
147
191
  optional: true,
148
192
  type: String),
193
+ FastlaneCore::ConfigItem.new(key: :appicon_messages_name,
194
+ env_name: "APPICON_MESSAGES_NAME",
195
+ default_value: 'AppIcon.stickersiconset',
196
+ description: "Name of the appiconset inside the asset catalogue",
197
+ optional: true,
198
+ type: String),
149
199
  FastlaneCore::ConfigItem.new(key: :remove_alpha,
150
200
  env_name: "REMOVE_ALPHA",
151
201
  default_value: false,
152
202
  description: "Remove the alpha channel from generated PNG",
153
203
  optional: true,
154
- type: Boolean)
204
+ type: Boolean),
205
+ FastlaneCore::ConfigItem.new(key: :messages_extension,
206
+ env_name: "APPICON_MESSAGES_EXTENSION",
207
+ default_value: false,
208
+ description: "App icon is generated for Messages extension",
209
+ optional: true,
210
+ type: Boolean),
211
+ FastlaneCore::ConfigItem.new(key: :minimagick_cli,
212
+ env_name: "APPICON_MINIMAGICK_CLI",
213
+ description: "Set MiniMagick CLI (auto picked by default). Values are: graphicsmagick, imagemagick",
214
+ optional: true,
215
+ type: String,
216
+ verify_block: proc do |value|
217
+ av = %w(graphicsmagick imagemagick)
218
+ UI.user_error!("Unsupported minimagick cli '#{value}', must be: #{av}") unless av.include?(value)
219
+ end)
155
220
  ]
156
221
  end
157
222
 
@@ -1,10 +1,26 @@
1
+ require 'mini_magick'
2
+
1
3
  module Fastlane
2
4
  module Helper
3
5
  class AppiconHelper
4
- def self.check_input_image_size(image, size)
5
- UI.user_error!("Minimum width of input image should be #{size}") if image.width < size
6
- UI.user_error!("Minimum height of input image should be #{size}") if image.height < size
7
- UI.user_error!("Input image should be square") if image.width != image.height
6
+ def self.check_input_image_size(image, width, height)
7
+ UI.user_error!("Minimum width of input image should be #{width}") if image.width < width
8
+ UI.user_error!("Minimum height of input image should be #{height}") if image.height < height
9
+ UI.user_error!("Input image should be square") if image.width / image.height != width / height
10
+ end
11
+
12
+ def self.set_cli(minimagick_cli)
13
+ MiniMagick.configure do |config|
14
+ case minimagick_cli
15
+ when "graphicsmagick"
16
+ config.cli = :graphicsmagick
17
+ when "imagemagick"
18
+ config.cli = :imagemagick
19
+ else
20
+ config.cli = MiniMagick.cli()
21
+ end
22
+ config.timeout = 5
23
+ end
8
24
  end
9
25
 
10
26
  def self.get_needed_icons(devices, needed_icons, is_android = false, custom_sizes = {})
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appicon
3
- VERSION = "0.15.0"
3
+ VERSION = "0.16.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-appicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Bügling
8
8
  - Felix Krause
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-28 00:00:00.000000000 Z
12
+ date: 2021-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_magick
@@ -129,7 +129,7 @@ dependencies:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.95.0
132
- description:
132
+ description:
133
133
  email: boris@icculus.org
134
134
  executables: []
135
135
  extensions: []
@@ -146,7 +146,7 @@ homepage: https://github.com/fastlane-community/fastlane-plugin-appicon
146
146
  licenses:
147
147
  - MIT
148
148
  metadata: {}
149
- post_install_message:
149
+ post_install_message:
150
150
  rdoc_options: []
151
151
  require_paths:
152
152
  - lib
@@ -161,8 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.0.6
165
- signing_key:
164
+ rubygems_version: 3.0.3
165
+ signing_key:
166
166
  specification_version: 4
167
167
  summary: Generate required icon sizes and iconset from a master application icon.
168
168
  test_files: []