class Fastlane::Actions::ResizeScreenshotsAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 56 def self.available_options [ # FastlaneCore::ConfigItem.new(key: :your_option, # env_name: "RESIZE_SCREENSHOTS_YOUR_OPTION", # description: "A description of your option", # optional: false, # type: String) ] end
description()
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 39 def self.description "Resize screenshots taken from your simulator to use for Frameit." end
details()
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 51 def self.details # Optional: "Take screenshots from your simulator, resize them to their appropriate size, then send the screenshots into Frameit to generate screenshots for the store!" end
get_device_dimensions(filename)
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 25 def self.get_device_dimensions(filename) if filename.include? "iPhone X" return "1125x2436" elsif filename.include? "iPhone 6" return "750x1334" elsif filename.include? "iPhone 5" return "640x1136" elsif filename.include? "iPhone 6 Plus" return "1080x1920" else UI.error("Unknown device for file: #{filename}. Make sure to use iPhone 5, 6, 6 Plus, or X.") end end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 66 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end
return_value()
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 47 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/resize_screenshots/actions/resize_screenshots_action.rb, line 8 def self.run(params) Dir.foreach(Dir.pwd) do |item| next if item == '.' or item == '..' or !item.include? "Simulator Screen Shot - " UI.message("Resizing screenshot: #{item} to size: #{get_device_dimensions(item)}.") image = MiniMagick::Image.open(item) image.resize get_device_dimensions(item) image.format "png" image.write item UI.message("Resizing of #{item} complete.") end UI.message("Resizing of images complete!") end