motion-screenshots 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da4e8a7c118b9eeff63d851b679a1496f9958312
4
- data.tar.gz: a6ccdf5b7078a066e79f55dc6174da0e79a5f2d2
3
+ metadata.gz: e53e84179de1cb7eec4ba699f61912bc1a5a63cd
4
+ data.tar.gz: 8fa3636341c1d5445e535a36b813108ffe17aa8f
5
5
  SHA512:
6
- metadata.gz: ce8b5676bd4ec91d6662be4884b3f4de640ac2fc0a9915d40a7b9524da22c921902e3c200bdb54da28e1cbf9f66369d307ad28dc734d0cb93b7080fac8909209
7
- data.tar.gz: 9057de92fe94558a51042906f525fbf391b9bd43752e006f42218d47d3577e32f00b8f4f97169a222e194f46f44c823f1f43519b6e22d25ff11e5f2c8319aa59
6
+ metadata.gz: 9e521694e5000a6ff783fc959c404ae3d9f7176c5833d9b86fbb2900b23038502f1d3aa138029c672bdf9e735084617096795b2d9d6120d6c59a398a925e707d
7
+ data.tar.gz: bf50209e4b47fb1716a6b8cf943cb3bbb6083bdfb3a1d49250ccfaa8798e0ef485980fb0f2f982f044221b32d1e2d43b48a03e179d3a43990dd7678c454360d3
data/README.md CHANGED
@@ -17,6 +17,10 @@ And then execute:
17
17
  Or install it yourself as:
18
18
 
19
19
  $ gem install motion-screenshots
20
+
21
+ And require in your Rakefile with:
22
+
23
+ require "motion-screenshots"
20
24
 
21
25
  ## Usage
22
26
 
@@ -3,8 +3,10 @@ unless defined?(Motion::Project::Config)
3
3
  end
4
4
 
5
5
  require 'motion-cocoapods'
6
+ require 'motion-env'
6
7
  require 'fileutils'
7
8
  require 'shellwords'
9
+ require 'plist'
8
10
 
9
11
  lib_dir_path = File.dirname(File.expand_path(__FILE__))
10
12
  Motion::Project::App.setup do |app|
@@ -40,6 +42,12 @@ namespace 'screenshots' do
40
42
  app_config.is_taking_screenshots = true
41
43
  app_config.env['MOTION_SCREENSHOTS_RUNNING'] = true
42
44
 
45
+ if app_config.archs['iPhoneSimulator'].include? 'x86_64'
46
+ # required until KSScreenshotManager is 64bit compatible
47
+ App.warn 'Forcing 32bit-only build target for screenshots..'
48
+ app_config.archs['iPhoneSimulator'] = %w(i386)
49
+ end
50
+
43
51
  screenshots_output_path = ENV['SCREENSHOTS_DIR']
44
52
  screenshots_output_path ||= App.config.screenshots_output_path
45
53
  screenshots_output_path ||= File.join(`pwd`.strip, "screenshots", Time.now.to_i.to_s)
@@ -47,13 +55,31 @@ namespace 'screenshots' do
47
55
 
48
56
  at_exit {
49
57
  # Copy files
50
- target = ENV['target'] || app_config.sdk_version
51
- sim_apps = File.expand_path("~/Library/Application Support/iPhone Simulator/*/Applications")
52
- app_dir = nil
53
58
  app = app_config.app_bundle('iPhoneSimulator')
54
- app_dir = File.dirname(Dir.glob("#{sim_apps}/**/#{File.basename(app)}").sort_by { |f|
55
- File.mtime(f)
56
- }.reverse.first)
59
+ app_id = app_config.identifier
60
+ app_dir = nil
61
+
62
+ if File.directory? File.expand_path( "~/Library/Developer/CoreSimulator/Devices" )
63
+ # XCode 6+ uses the same random UUID layout to store applications and
64
+ # application sandboxes as the native iOS device does (== more work..).
65
+ sim_apps = File.expand_path("~/Library/Developer/CoreSimulator/Devices")
66
+ app_dir = File.dirname(Dir.glob("#{sim_apps}/**/#{File.basename(app)}").sort_by{ |f|
67
+ File.mtime(f)
68
+ }.reverse.first)
69
+ # Get the simulator UUID, then read it's application install data..
70
+ sim_base = app_dir.gsub( %r{(^.*/Devices/\h{8}-(?:\h{4}-){3}\h{12})/.*}, '\\1' )
71
+ app_infos = Plist::parse_xml(open("|plutil -convert xml1 -o - -- #{sim_base}/data/Library/BackBoard/applicationState.plist").read)
72
+ # ..and finally determine the sandbox data directory
73
+ app_dir = app_infos[app_config.identifier]['compatibilityInfo']['sandboxPath']
74
+ else
75
+ # pre XCode 6
76
+ target = ENV['target'] || app_config.sdk_version
77
+ sim_apps = File.expand_path("~/Library/Application Support/iPhone Simulator/*/Applications")
78
+ app_dir = File.dirname(Dir.glob("#{sim_apps}/**/#{File.basename(app)}").sort_by { |f|
79
+ File.mtime(f)
80
+ }.reverse.first)
81
+ end
82
+
57
83
  motion_screenshots = File.join(app_dir, "Documents", "motion_screenshots")
58
84
  screenshot_files = Dir[File.join(motion_screenshots, "**", "*")]
59
85
  FileUtils.cp_r(screenshot_files, screenshots_output_path)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "motion-screenshots"
5
- spec.version = "0.1.0"
5
+ spec.version = "0.1.1"
6
6
  spec.authors = ["Clay Allsopp"]
7
7
  spec.email = ["clay@usepropeller.com"]
8
8
  spec.description = "Take screenshots with RubyMotion"
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "motion-cocoapods", ">= 1.4.0"
23
- spec.add_dependency "motion-env", ">= 0.0.3"
24
-
22
+ spec.add_dependency "motion-cocoapods", ">= 1.7.0"
23
+ spec.add_dependency "motion-env", ">= 0.0.4"
24
+ spec.add_dependency "plist", ">= 3.1.0"
25
+
25
26
  spec.add_development_dependency "rake"
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-screenshots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clay Allsopp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.0
19
+ version: 1.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.0
26
+ version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: motion-env
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.3
33
+ version: 0.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.3
40
+ version: 0.0.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: plist
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement