-
Notifications
You must be signed in to change notification settings - Fork 8
Promo screenshots action refinements #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
3c4eea8
922a8ba
95ed576
5740c60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ def initialize | |
| UI.user_error!(message) | ||
| end | ||
|
|
||
| UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText') | ||
| UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText > /dev/null') | ||
| end | ||
|
|
||
| def read_config(config_file_path) | ||
|
|
@@ -287,7 +287,16 @@ def draw_text_to_canvas(canvas, text, width, height, x_position, y_position, fon | |
| begin | ||
| temp_text_file = Tempfile.new | ||
|
|
||
| Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}") | ||
| system( | ||
| 'drawText', | ||
| "html=#{text}", | ||
| "maxWidth=#{width}", | ||
| "maxHeight=#{height}", | ||
| "output=#{temp_text_file.path}", | ||
| "fontSize=#{font_size}", | ||
| "stylesheet=#{stylesheet_path}", | ||
| "alignment=#{position}" | ||
| ) | ||
|
Comment on lines
-290
to
+299
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fastlane's
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| text_content = open_image(temp_text_file.path).trim | ||
| text_frame = create_image(width, height) | ||
|
|
@@ -407,8 +416,8 @@ def create_image(width, height, background = 'transparent') | |
| working_background = background.frozen? ? background.dup : background | ||
| working_background.paint.to_hex | ||
|
|
||
| Image.new(width, height) do | ||
| self.background_color = working_background | ||
| Image.new(width, height) do |info| | ||
| info.background_color = working_background | ||
| end | ||
| end | ||
|
Comment on lines
-410
to
422
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This addresses a deprecation warning. See commit message for more details. |
||
|
|
||
|
|
@@ -432,8 +441,12 @@ def resolve_path(path) | |
| return resolved_path if !resolved_path.nil? && resolved_path.exist? | ||
| end | ||
|
|
||
| message = "Unable to locate #{path}" | ||
| UI.crash!(message) | ||
| message = <<~MESSAGE | ||
| Unable to locate #{path}. | ||
|
|
||
| Did you run the automation to generate the screenshots? | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just in case I go through the same process of pondering why annotating non existing screenshots fails again. |
||
| MESSAGE | ||
| UI.user_error!(message) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good one 👍 |
||
| end | ||
|
|
||
| def resolve_text_into_path(text, locale) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, we'd get a long list of
command -v drawTextoutput.As a side note, this line seems to be called many times. We should cache, memoize, or otherwise implement a way to run this check only once.