israkel 1.0.0 → 1.0.3

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: 9925300a81c566a80654362e4b4de6ba8f1172ed
4
- data.tar.gz: 4285f4b68e325b6b79e798f6f6562847c95eb2dd
3
+ metadata.gz: d2d89b6a0096463260621cdbd811cf1d3153f2f8
4
+ data.tar.gz: df36e55c33b03c44b257dc4ede723f19f9fcaa9f
5
5
  SHA512:
6
- metadata.gz: 780f73658c5a4e82cbc5853f0231a55a31feb7962b8fe6cc07ce64a0e934e6227a8e0dda114d641e92b0f9f30d9f6c2b9cc3d8dabba77d4cb8c50886870e2571
7
- data.tar.gz: 70822ce80a0287f86a1cad61e9b590e174451b67d432d3da2143ed10ab827aaa9a76720d3a03acf1da3984cdc53ab27f5280c4f08a851feff5b096d47a0571f3
6
+ metadata.gz: 6becac90f577a42dfd11e5a3a38bc5d78203720770979ab73fc51070bafa97cb27ca3236c64c227a021bcdbb2bf00ac1ea6da07dcd3c744dceec1383bfffa278
7
+ data.tar.gz: 120f9df459509597cd79c154c0716e8599364a9d592f022b03425069e47d5d37a4755bc709a33270aa11c5e8dfa69bf0c951c5b3412c60228cb61a761d218ce3
data/README.md CHANGED
@@ -24,9 +24,9 @@ Besides the gem dependencies, that are automatically resolved and
24
24
  installed via bundler, there's only one external dependency to the
25
25
  [ios-sim](https://github.com/phonegap/ios-sim) binary. The most
26
26
  convenient way to install it is via
27
- [homebrew](http://mxcl.github.com/homebrew/):
27
+ [npm](https://www.npmjs.org/package/ios-sim):
28
28
 
29
- brew install ios-sim
29
+ npm install ios-sim
30
30
 
31
31
  ## Example Usage
32
32
 
@@ -78,24 +78,24 @@ to use KIF to tap on the OK button of the access alert views.
78
78
 
79
79
  desc 'Allow AddressBook access'
80
80
  task :allow_addressbook_access do
81
- i.allow_addressbook_access('com.xing.App')
81
+ i.current_device.allow_addressbook_access('com.xing.App')
82
82
  end
83
83
 
84
84
  desc 'Allow GPS access'
85
85
  task :allow_gps_access do
86
- i.allow_gps_access('com.xing.App')
86
+ i.current_device.allow_gps_access('com.xing.App')
87
87
  end
88
88
 
89
89
  desc 'Allow Photo Library access'
90
90
  task :allow_photos_access do
91
- i.allow_photos_access('com.xing.App')
91
+ i.current_device.allow_photos_access('com.xing.App')
92
92
  end
93
93
 
94
94
  Even easier, you don't have to define the rake tasks in your Rakefile.
95
95
  There are generic tasks that take the environment variable `BUNDLE_ID`
96
96
  into account:
97
97
 
98
- IOS_SDK_VERSION=7.1 BUNDLE_ID=com.example.apple-samplecode.PhotoPicker rake simulator:allow_photos_access
98
+ DEVICE_TYPE=iPhone-5s IOS_SDK_VERSION=7.1 BUNDLE_ID=com.example.apple-samplecode.PhotoPicker rake simulator:allow_photos_access
99
99
 
100
100
  ## Feedback
101
101
 
@@ -1,2 +1,3 @@
1
1
  require 'israkel/tasks'
2
2
  require 'israkel/device'
3
+ require 'israkel/simctl'
@@ -28,9 +28,16 @@ class Device
28
28
  end
29
29
 
30
30
  def self.stop
31
+ self.shutdown_devices
31
32
  system 'killall', '-m', '-TERM', 'iOS Simulator'
32
33
  end
33
34
 
35
+ def self.shutdown_devices
36
+ SIMCTL.booted_devices_uuids.each do |uuid|
37
+ SIMCTL.shutdown(uuid)
38
+ end
39
+ end
40
+
34
41
  def self.all
35
42
  devices = []
36
43
  dirs = Dir.entries(Device.sim_root_path).reject { |entry| File.directory? entry }
@@ -95,8 +102,7 @@ class Device
95
102
  end
96
103
 
97
104
  def reset
98
- FileUtils.rm_rf File.join(path)
99
- FileUtils.mkdir File.join(path)
105
+ SIMCTL.erase @UUID
100
106
  end
101
107
 
102
108
  def self.sim_root_path
@@ -0,0 +1,21 @@
1
+ class SIMCTL
2
+
3
+ def self.list
4
+ `xcrun simctl list`
5
+ end
6
+
7
+ def self.booted_devices_uuids
8
+ devices = self.list.split("\n")
9
+ devices.keep_if { |entry| entry =~ /(\(Booted\))/ }
10
+ devices.map { |device| device.match(/\(([^\)]+)\)/)[1] }
11
+ end
12
+
13
+ def self.shutdown(device_uuid)
14
+ system "xcrun simctl shutdown #{device_uuid}"
15
+ end
16
+
17
+ def self.erase(device_uuid)
18
+ system "xcrun simctl erase #{device_uuid}"
19
+ end
20
+
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: israkel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Plunien
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-20 00:00:00.000000000 Z
14
+ date: 2015-03-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: highline
@@ -128,6 +128,7 @@ files:
128
128
  - README.md
129
129
  - lib/israkel.rb
130
130
  - lib/israkel/device.rb
131
+ - lib/israkel/simctl.rb
131
132
  - lib/israkel/tasks.rb
132
133
  homepage: http://github.com/xing/israkel
133
134
  licenses:
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  version: '0'
150
151
  requirements: []
151
152
  rubyforge_project:
152
- rubygems_version: 2.2.2
153
+ rubygems_version: 2.4.5
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: Collection of common rake tasks for the iPhone Simulator.