Sha256: d8f8ce182dbacd497cd7a83aa9ac5710e6cbc06bdac7eb1ae109581ce7de6ac9

Contents?: true

Size: 702 Bytes

Versions: 10

Compression:

Stored size: 702 Bytes

Contents

module Nakal
  module Ios
    class Screen < Common::BaseScreen

      private

      CAPTURE_SCRIPT = 'osascript <<EOF
      tell application "iOS Simulator"
      activate
      delay 1
      tell application "System Events" to keystroke "s" using {command down}
      end tell
      EOF'

      def capture
        `#{CAPTURE_SCRIPT}`
        sleep 1
        Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot - Apple\\ Watch*')).each{|f| FileUtils.rm(f)}
        latest_file = Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot*')).max_by { |f| File.mtime(f) }
        File.rename(latest_file,"#{Nakal.image_location}/#{@name}.png")
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nakal-1.0.2 lib/nakal/ios/screen.rb
nakal-1.0.1 lib/nakal/ios/screen.rb
nakal-1.0.0 lib/nakal/ios/screen.rb
nakal-0.1.2 lib/nakal/ios/screen.rb
nakal-0.1.1 lib/nakal/ios/screen.rb
nakal-0.1.0 lib/nakal/ios/screen.rb
nakal-0.0.7 lib/nakal/ios/screen.rb
nakal-0.0.6 lib/nakal/ios/screen.rb
nakal-0.0.5 lib/nakal/ios/screen.rb
nakal-0.0.4 lib/nakal/ios/screen.rb