diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb index 38fdab80c..b4c17c614 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb @@ -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}" + ) 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 @@ -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? + MESSAGE + UI.user_error!(message) end def resolve_text_into_path(text, locale)