Skip to content

Commit 7f6f5aa

Browse files
authored
Promo screenshots action refinements (#685)
2 parents 8484fcf + 17bf347 commit 7f6f5aa

5 files changed

Lines changed: 71 additions & 42 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ _None_
1818

1919
### Internal Changes
2020

21-
_None_
21+
- Improved efficiency and refined the logs of the `promo_screenshots` action. [#685]
22+
- Updated minimum Fastlane requirement to 2.231.0. [#685]
2223

2324
## 13.8.1
2425

Gemfile.lock

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PATH
66
buildkit (~> 1.5)
77
chroma (= 0.2.0)
88
diffy (~> 3.3)
9-
fastlane (~> 2.213)
9+
fastlane (~> 2.231)
1010
git (~> 1.3)
1111
google-cloud-storage (~> 1.31)
1212
java-properties (~> 0.3.0)
@@ -22,10 +22,8 @@ PATH
2222
GEM
2323
remote: https://rubygems.org/
2424
specs:
25-
CFPropertyList (3.0.7)
26-
base64
27-
nkf
28-
rexml
25+
CFPropertyList (3.0.8)
26+
abbrev (0.1.2)
2927
activesupport (7.2.2.1)
3028
base64
3129
benchmark (>= 0.3)
@@ -38,37 +36,37 @@ GEM
3836
minitest (>= 5.1)
3937
securerandom (>= 0.3)
4038
tzinfo (~> 2.0, >= 2.0.5)
41-
addressable (2.8.7)
42-
public_suffix (>= 2.0.2, < 7.0)
39+
addressable (2.8.8)
40+
public_suffix (>= 2.0.2, < 8.0)
4341
algoliasearch (1.27.5)
4442
httpclient (~> 2.8, >= 2.8.3)
4543
json (>= 1.5.1)
4644
artifactory (3.0.17)
4745
ast (2.4.2)
4846
atomos (0.1.3)
4947
aws-eventstream (1.4.0)
50-
aws-partitions (1.1196.0)
51-
aws-sdk-core (3.240.0)
48+
aws-partitions (1.1206.0)
49+
aws-sdk-core (3.241.4)
5250
aws-eventstream (~> 1, >= 1.3.0)
5351
aws-partitions (~> 1, >= 1.992.0)
5452
aws-sigv4 (~> 1.9)
5553
base64
5654
bigdecimal
5755
jmespath (~> 1, >= 1.6.1)
5856
logger
59-
aws-sdk-kms (1.118.0)
60-
aws-sdk-core (~> 3, >= 3.239.1)
57+
aws-sdk-kms (1.121.0)
58+
aws-sdk-core (~> 3, >= 3.241.4)
6159
aws-sigv4 (~> 1.5)
62-
aws-sdk-s3 (1.208.0)
63-
aws-sdk-core (~> 3, >= 3.234.0)
60+
aws-sdk-s3 (1.212.0)
61+
aws-sdk-core (~> 3, >= 3.241.4)
6462
aws-sdk-kms (~> 1)
6563
aws-sigv4 (~> 1.5)
6664
aws-sigv4 (1.12.1)
6765
aws-eventstream (~> 1, >= 1.0.2)
6866
babosa (1.0.4)
69-
base64 (0.3.0)
67+
base64 (0.2.0)
7068
benchmark (0.4.0)
71-
bigdecimal (3.1.9)
69+
bigdecimal (4.0.1)
7270
buildkit (1.6.1)
7371
sawyer (>= 0.6)
7472
buildkite-test_collector (2.9.0)
@@ -129,6 +127,7 @@ GEM
129127
crack (1.0.0)
130128
bigdecimal
131129
rexml
130+
csv (3.3.5)
132131
danger (9.5.1)
133132
base64 (~> 0.2)
134133
claide (~> 1.0)
@@ -179,16 +178,16 @@ GEM
179178
faraday-rack (~> 1.0)
180179
faraday-retry (~> 1.0)
181180
ruby2_keywords (>= 0.0.4)
182-
faraday-cookie_jar (0.0.7)
181+
faraday-cookie_jar (0.0.8)
183182
faraday (>= 0.8.0)
184-
http-cookie (~> 1.0.0)
183+
http-cookie (>= 1.0.0)
185184
faraday-em_http (1.0.0)
186-
faraday-em_synchrony (1.0.0)
185+
faraday-em_synchrony (1.0.1)
187186
faraday-excon (1.1.0)
188187
faraday-http-cache (2.5.1)
189188
faraday (>= 0.8)
190189
faraday-httpclient (1.0.1)
191-
faraday-multipart (1.1.0)
190+
faraday-multipart (1.2.0)
192191
multipart-post (~> 2.0)
193192
faraday-net_http (1.0.2)
194193
faraday-net_http_persistent (1.2.0)
@@ -198,15 +197,18 @@ GEM
198197
faraday_middleware (1.2.1)
199198
faraday (~> 1.0)
200199
fastimage (2.4.0)
201-
fastlane (2.227.0)
200+
fastlane (2.231.0)
202201
CFPropertyList (>= 2.3, < 4.0.0)
202+
abbrev (~> 0.1.2)
203203
addressable (>= 2.8, < 3.0.0)
204204
artifactory (~> 3.0)
205205
aws-sdk-s3 (~> 1.0)
206206
babosa (>= 1.0.3, < 2.0.0)
207-
bundler (>= 1.12.0, < 3.0.0)
207+
base64 (~> 0.2.0)
208+
bundler (>= 1.17.3, < 5.0.0)
208209
colored (~> 1.2)
209210
commander (~> 4.6)
211+
csv (~> 3.3)
210212
dotenv (>= 2.1.1, < 3.0.0)
211213
emoji_regex (>= 0.1, < 4.0)
212214
excon (>= 0.71.0, < 1.0.0)
@@ -224,9 +226,12 @@ GEM
224226
http-cookie (~> 1.0.5)
225227
json (< 3.0.0)
226228
jwt (>= 2.1.0, < 3)
229+
logger (>= 1.6, < 2.0)
227230
mini_magick (>= 4.9.4, < 5.0.0)
228231
multipart-post (>= 2.0.0, < 3.0.0)
232+
mutex_m (~> 0.3.0)
229233
naturally (~> 2.2)
234+
nkf (~> 0.2.0)
230235
optparse (>= 0.1.1, < 1.0.0)
231236
plist (>= 3.1.0, < 4.0.0)
232237
rubyzip (>= 2.0.0, < 3.0.0)
@@ -238,7 +243,7 @@ GEM
238243
tty-spinner (>= 0.8.0, < 1.0.0)
239244
word_wrap (~> 1.0.0)
240245
xcodeproj (>= 1.13.0, < 2.0.0)
241-
xcpretty (~> 0.4.0)
246+
xcpretty (~> 0.4.1)
242247
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
243248
fastlane-sirp (1.0.0)
244249
sysrandom (~> 1.0)
@@ -295,28 +300,28 @@ GEM
295300
concurrent-ruby (~> 1.0)
296301
java-properties (0.3.0)
297302
jmespath (1.6.2)
298-
json (2.10.2)
299-
jwt (2.10.1)
303+
json (2.18.0)
304+
jwt (2.10.2)
300305
base64
301306
kramdown (2.5.1)
302307
rexml (>= 3.3.9)
303308
kramdown-parser-gfm (1.1.0)
304309
kramdown (~> 2.0)
305310
language_server-protocol (3.17.0.4)
306311
lint_roller (1.1.0)
307-
logger (1.6.6)
312+
logger (1.7.0)
308313
method_source (0.9.2)
309314
mini_magick (4.13.2)
310315
mini_mime (1.1.5)
311316
mini_portile2 (2.8.9)
312317
minitest (5.25.5)
313318
molinillo (0.8.0)
314-
multi_json (1.15.0)
319+
multi_json (1.19.1)
315320
multipart-post (2.4.1)
316321
mutex_m (0.3.0)
317322
nanaimo (0.4.0)
318323
nap (1.1.0)
319-
naturally (2.2.1)
324+
naturally (2.3.0)
320325
netrc (0.11.0)
321326
nkf (0.2.0)
322327
nokogiri (1.18.9)
@@ -328,7 +333,7 @@ GEM
328333
sawyer (~> 0.9)
329334
open4 (1.3.4)
330335
options (2.3.2)
331-
optparse (0.6.0)
336+
optparse (0.8.1)
332337
os (1.1.4)
333338
parallel (1.26.3)
334339
parser (3.3.7.1)
@@ -346,7 +351,7 @@ GEM
346351
public_suffix (4.0.7)
347352
racc (1.8.1)
348353
rainbow (3.1.1)
349-
rake (13.2.1)
354+
rake (13.3.1)
350355
rake-compiler (1.2.9)
351356
rake
352357
rchardet (1.9.0)
@@ -356,7 +361,7 @@ GEM
356361
trailblazer-option (>= 0.1.1, < 0.2.0)
357362
uber (< 0.2.0)
358363
retriable (3.1.2)
359-
rexml (3.4.2)
364+
rexml (3.4.4)
360365
rmagick (5.5.0)
361366
observer (~> 0.1)
362367
pkg-config (~> 1.4)
@@ -400,10 +405,10 @@ GEM
400405
faraday (>= 0.17.3, < 3)
401406
securerandom (0.4.1)
402407
security (0.1.5)
403-
signet (0.19.0)
408+
signet (0.21.0)
404409
addressable (~> 2.8)
405410
faraday (>= 0.17.5, < 3.a)
406-
jwt (>= 1.5, < 3.0)
411+
jwt (>= 1.5, < 4.0)
407412
multi_json (~> 1.10)
408413
simctl (1.6.10)
409414
CFPropertyList
@@ -440,7 +445,7 @@ GEM
440445
colored2 (~> 3.1)
441446
nanaimo (~> 0.4.0)
442447
rexml (>= 3.3.6, < 4.0)
443-
xcpretty (0.4.0)
448+
xcpretty (0.4.1)
444449
rouge (~> 3.28.0)
445450
xcpretty-travis-formatter (1.0.1)
446451
xcpretty (~> 0.2, >= 0.0.7)

fastlane-plugin-wpmreleasetoolkit.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
3030
spec.add_dependency 'buildkit', '~> 1.5'
3131
spec.add_dependency 'chroma', '0.2.0'
3232
spec.add_dependency 'diffy', '~> 3.3'
33-
spec.add_dependency 'fastlane', '~> 2.213'
33+
spec.add_dependency 'fastlane', '~> 2.231'
3434
spec.add_dependency 'git', '~> 1.3'
3535
spec.add_dependency 'java-properties', '~> 0.3.0'
3636
spec.add_dependency 'nokogiri', '~> 1.11'

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def self.run(params)
6262

6363
UI.message("Unable to find device #{entry['device']}.") if device.nil?
6464

65+
UI.verbose("Processing entry:\n#{JSON.pretty_generate(entry)}")
66+
6567
width = device['canvas_size'][0]
6668
height = device['canvas_size'][1]
6769

@@ -93,7 +95,7 @@ def self.confirm_directory_overwrite(path, description)
9395
FileUtils.rm_rf(path)
9496
Dir.mkdir(path)
9597
else
96-
UI.user_error!("Exiting to avoid overwriting #{description}.")
98+
UI.abort_with_message!("Exiting to avoid overwriting #{description}.")
9799
end
98100
else
99101
Dir.mkdir(path)

lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ def initialize
3333
UI.user_error!(message)
3434
end
3535

36-
UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText')
36+
UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless self.class.draw_text_available?
37+
end
38+
39+
def self.draw_text_available?
40+
return @draw_text_available if defined?(@draw_text_available)
41+
42+
@draw_text_available = system('command -v drawText', %i[out err] => File::NULL)
3743
end
3844

3945
def read_config(config_file_path)
@@ -287,7 +293,17 @@ def draw_text_to_canvas(canvas, text, width, height, x_position, y_position, fon
287293
begin
288294
temp_text_file = Tempfile.new
289295

290-
Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}")
296+
Actions.sh(
297+
'drawText',
298+
"html=#{text}",
299+
"maxWidth=#{width}",
300+
"maxHeight=#{height}",
301+
"output=#{temp_text_file.path}",
302+
"fontSize=#{font_size}",
303+
"stylesheet=#{stylesheet_path}",
304+
"alignment=#{position}",
305+
log: false
306+
)
291307

292308
text_content = open_image(temp_text_file.path).trim
293309
text_frame = create_image(width, height)
@@ -407,8 +423,8 @@ def create_image(width, height, background = 'transparent')
407423
working_background = background.frozen? ? background.dup : background
408424
working_background.paint.to_hex
409425

410-
Image.new(width, height) do
411-
self.background_color = working_background
426+
Image.new(width, height) do |info|
427+
info.background_color = working_background
412428
end
413429
end
414430

@@ -432,8 +448,12 @@ def resolve_path(path)
432448
return resolved_path if !resolved_path.nil? && resolved_path.exist?
433449
end
434450

435-
message = "Unable to locate #{path}"
436-
UI.crash!(message)
451+
message = <<~MESSAGE
452+
Unable to locate #{path}.
453+
454+
Did you run the automation to generate the screenshots?
455+
MESSAGE
456+
UI.user_error!(message)
437457
end
438458

439459
def resolve_text_into_path(text, locale)
@@ -444,6 +464,7 @@ def resolve_text_into_path(text, locale)
444464
elsif can_resolve_path(localized_file)
445465
resolve_path(localized_file).realpath.to_s
446466
else
467+
UI.important("Could not identify '#{localized_file}' as a file path or the file was not found. Will use its value as a raw string. This may result in undesired annotations.")
447468
format(text, 'source')
448469
end
449470
end

0 commit comments

Comments
 (0)