Sha256: 3ad1e9a529395c9d69faf5ae26b3fde3fa80bf07a2e8237aa4b23b8817015343
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Nakal module Ios class Screen < Common::BaseScreen private def capture_script "osascript <<EOF tell application \"#{simulator_app_name}\" activate delay 0.5 tell application \"System Events\" to keystroke \"1\" using {command down} delay 0.5 tell application \"System Events\" to keystroke \"s\" using {command down} end tell EOF" end def simulator_app_name xcode_7 = !(%x(instruments -s devices ; echo)).match(' Simulator\)') xcode_7 ? "Simulator" : "iOS Simulator" end def capture `#{capture_script}` sleep 1 Dir.glob(File.expand_path("~/Desktop/#{simulator_app_name}\\ Screen\\ Shot - Apple\\ Watch*")).each { |f| FileUtils.rm(f) } latest_file = Dir.glob(File.expand_path("~/Desktop/#{simulator_app_name}\\ Screen\\ Shot*")).max_by { |f| File.mtime(f) } File.rename(latest_file, "#{Nakal.image_location}/#{@name}.png") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nakal-1.0.4 | lib/nakal/ios/screen.rb |