nakal 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1308e125b0ff692265dfb34cee188b56593f6795
4
- data.tar.gz: 066e33d390361816d21dbddb575c85d67ab4f549
3
+ metadata.gz: 61e2153b886871d6dd540d5c9112f7b6d69b4c5e
4
+ data.tar.gz: 053513692e7e6a63ebf539b48e1177328c8c28f3
5
5
  SHA512:
6
- metadata.gz: 2d49e3e455cc5d16eed121a559a34ba533ca75a564493227819a52519b3fb473590c8dd788a66c16b9596a5a8fac1b40e21e95e858a886de2eae0426f406c3fd
7
- data.tar.gz: 0962fc58129af517b05e0c8a35bc3309f6e3c184afece7dc2ce3c1905a80e9450e706913556f813386a0681665428593654b32496dd4a790f694bda1c738443e
6
+ metadata.gz: a7dc1b1a46e61eedd7f195ce54c502d60b2ead67deee771ac8a6b04008dc246f4fa80a3f24eba4a8a7781f39b555f4009d90ade0f6e70b02335ca2a4675d0aa4
7
+ data.tar.gz: 18f8f682b4ebe0ffcbd09985f30f7c48280dd3f7488debbfbefe5d16826760bb40abe73e901baf4ba205d6b575704896944ff4d5ce22e305308cdb3479898c9d
@@ -4,20 +4,27 @@ module Nakal
4
4
 
5
5
  private
6
6
 
7
- CAPTURE_SCRIPT = 'osascript <<EOF
8
- tell application "iOS Simulator"
9
- activate
10
- delay 1
11
- tell application "System Events" to keystroke "s" using {command down}
12
- end tell
13
- EOF'
7
+ def capture_script
8
+ xcode_7 = !(%x(instruments -s devices ; echo)).match(' Simulator\)')
9
+ simulator_app_name = xcode_7 ? "Simulator" : "iOS Simulator"
10
+ "osascript <<EOF
11
+ tell application \"#{simulator_app_name}\"
12
+ activate
13
+ delay 0.5
14
+ tell application \"System Events\" to keystroke \"1\" using {command down}
15
+ delay 0.5
16
+ tell application \"System Events\" to keystroke \"s\" using {command down}
17
+ end tell
18
+ EOF"
19
+ end
20
+
14
21
 
15
22
  def capture
16
- `#{CAPTURE_SCRIPT}`
23
+ `#{capture_script}`
17
24
  sleep 1
18
- Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot - Apple\\ Watch*')).each{|f| FileUtils.rm(f)}
25
+ Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot - Apple\\ Watch*')).each { |f| FileUtils.rm(f) }
19
26
  latest_file = Dir.glob(File.expand_path('~/Desktop/iOS\\ Simulator\\ Screen\\ Shot*')).max_by { |f| File.mtime(f) }
20
- File.rename(latest_file,"#{Nakal.image_location}/#{@name}.png")
27
+ File.rename(latest_file, "#{Nakal.image_location}/#{@name}.png")
21
28
  end
22
29
 
23
30
  end
@@ -1,3 +1,3 @@
1
1
  module Nakal
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nakal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajdeep
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick