class Snapshot::ScreenshotRotate
This class takes care of rotating images
Public Instance Methods
rotate(path)
click to toggle source
# File snapshot/lib/snapshot/screenshot_rotate.rb, line 15 def rotate(path) Dir.glob([path, '/**/*.png'].join('/')).each do |file| UI.verbose("Rotating '#{file}'") command = nil if file.end_with?("landscapeleft.png") command = "sips -r -90 '#{file}'" elsif file.end_with?("landscaperight.png") command = "sips -r 90 '#{file}'" elsif file.end_with?("portrait_upsidedown.png") command = "sips -r 180 '#{file}'" end # Only rotate if we need to next unless command # Rotate FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: false) end end
run(path)
click to toggle source
@param (String
) The path in which the screenshots are located in
# File snapshot/lib/snapshot/screenshot_rotate.rb, line 10 def run(path) UI.verbose("Rotating the screenshots (if necessary)") rotate(path) end