simctl 1.6.1 → 1.6.2
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 +4 -4
- data/Gemfile.lock +14 -28
- data/lib/simctl/command.rb +2 -0
- data/lib/simctl/command/terminate.rb +21 -0
- data/lib/simctl/device.rb +19 -5
- data/lib/simctl/device_path.rb +5 -1
- data/lib/simctl/version.rb +1 -1
- data/spec/simctl/device_interaction_spec.rb +12 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e021076adeb770892257609a7765b4f229dffca
|
4
|
+
data.tar.gz: 0771cf5154fa415e0f4d052ba40fc1a523ced3f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da5ae54554eb7f8dd540f451f02d9e1c3f602545370be3af600f5153a1652679a792997aab0c4d9b6e3cb2a1f61a5904f5af6a4144e4a06365e1ec627bad608
|
7
|
+
data.tar.gz: e1a48ff4ef1a9aea9b9878d5104e4d2f7642e5ba7a094e0f5c09a93a732ccf02f4521ae2b5cc5f72ae84cda36400e0cf15b03d9a8e9ca5775c13f6917edeb7e6
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simctl (1.6.
|
4
|
+
simctl (1.6.2)
|
5
5
|
CFPropertyList
|
6
6
|
naturally
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
CFPropertyList (2.3.
|
12
|
-
coveralls (0.8.
|
13
|
-
json (
|
14
|
-
|
15
|
-
simplecov (~> 0.11.0)
|
11
|
+
CFPropertyList (2.3.5)
|
12
|
+
coveralls (0.8.17)
|
13
|
+
json (>= 1.8, < 3)
|
14
|
+
simplecov (~> 0.12.0)
|
16
15
|
term-ansicolor (~> 1.3)
|
17
16
|
thor (~> 0.19.1)
|
18
|
-
tins (~> 1.6
|
17
|
+
tins (~> 1.6)
|
19
18
|
diff-lcs (1.2.5)
|
20
19
|
docile (1.1.5)
|
21
|
-
|
22
|
-
unf (>= 0.0.5, < 1.0.0)
|
23
|
-
http-cookie (1.0.2)
|
24
|
-
domain_name (~> 0.5)
|
25
|
-
json (1.8.3)
|
26
|
-
mime-types (2.99)
|
20
|
+
json (2.0.2)
|
27
21
|
naturally (2.1.0)
|
28
|
-
|
29
|
-
rake (10.4.2)
|
30
|
-
rest-client (1.8.0)
|
31
|
-
http-cookie (>= 1.0.2, < 2.0)
|
32
|
-
mime-types (>= 1.16, < 3.0)
|
33
|
-
netrc (~> 0.7)
|
22
|
+
rake (12.0.0)
|
34
23
|
rspec (3.5.0)
|
35
24
|
rspec-core (~> 3.5.0)
|
36
25
|
rspec-expectations (~> 3.5.0)
|
@@ -44,18 +33,15 @@ GEM
|
|
44
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
34
|
rspec-support (~> 3.5.0)
|
46
35
|
rspec-support (3.5.0)
|
47
|
-
simplecov (0.
|
36
|
+
simplecov (0.12.0)
|
48
37
|
docile (~> 1.1.0)
|
49
|
-
json (
|
38
|
+
json (>= 1.8, < 3)
|
50
39
|
simplecov-html (~> 0.10.0)
|
51
40
|
simplecov-html (0.10.0)
|
52
|
-
term-ansicolor (1.
|
41
|
+
term-ansicolor (1.4.0)
|
53
42
|
tins (~> 1.0)
|
54
|
-
thor (0.19.
|
55
|
-
tins (1.
|
56
|
-
unf (0.1.4)
|
57
|
-
unf_ext
|
58
|
-
unf_ext (0.0.7.1)
|
43
|
+
thor (0.19.4)
|
44
|
+
tins (1.13.0)
|
59
45
|
|
60
46
|
PLATFORMS
|
61
47
|
ruby
|
@@ -67,4 +53,4 @@ DEPENDENCIES
|
|
67
53
|
simctl!
|
68
54
|
|
69
55
|
BUNDLED WITH
|
70
|
-
1.
|
56
|
+
1.15.1
|
data/lib/simctl/command.rb
CHANGED
@@ -6,6 +6,7 @@ require 'simctl/command/install'
|
|
6
6
|
require 'simctl/command/io'
|
7
7
|
require 'simctl/command/kill'
|
8
8
|
require 'simctl/command/launch'
|
9
|
+
require 'simctl/command/terminate'
|
9
10
|
require 'simctl/command/list'
|
10
11
|
require 'simctl/command/openurl'
|
11
12
|
require 'simctl/command/rename'
|
@@ -29,6 +30,7 @@ module SimCtl
|
|
29
30
|
include SimCtl::Command::Install
|
30
31
|
include SimCtl::Command::Kill
|
31
32
|
include SimCtl::Command::Launch
|
33
|
+
include SimCtl::Command::Terminate
|
32
34
|
include SimCtl::Command::List
|
33
35
|
include SimCtl::Command::OpenUrl
|
34
36
|
include SimCtl::Command::Rename
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
module SimCtl
|
4
|
+
class Command
|
5
|
+
module Terminate
|
6
|
+
# Terminates an app on the given device
|
7
|
+
#
|
8
|
+
# @param device [SimCtl::Device] the device with the app to terminate
|
9
|
+
# @param identifier [String] the app identifier
|
10
|
+
# @param args [Array] optional terminate arguments
|
11
|
+
# @return [void]
|
12
|
+
def terminate_app(device, identifier, args=[])
|
13
|
+
unless Xcode::Version.gte? '8.2'
|
14
|
+
raise UnsupportedCommandError.new('Needs at least Xcode 8.2')
|
15
|
+
end
|
16
|
+
terminate_args = args.map {|arg| Shellwords.shellescape arg}
|
17
|
+
Executor.execute(command_for('terminate', terminate_args, device.udid, identifier))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/simctl/device.rb
CHANGED
@@ -92,6 +92,15 @@ module SimCtl
|
|
92
92
|
SimCtl.launch_app(self, identifier, args, opts)
|
93
93
|
end
|
94
94
|
|
95
|
+
# Terminates an app on the given device
|
96
|
+
#
|
97
|
+
# @param identifier [String] the app identifier
|
98
|
+
# @param args [Array] optional terminate arguments
|
99
|
+
# @return [void]
|
100
|
+
def terminate_app(identifier, args=[])
|
101
|
+
SimCtl.terminate_app(self, identifier, args)
|
102
|
+
end
|
103
|
+
|
95
104
|
# Opens the url on the device
|
96
105
|
#
|
97
106
|
# @param url [String] The url to be opened on the device
|
@@ -104,15 +113,14 @@ module SimCtl
|
|
104
113
|
@path ||= DevicePath.new(self)
|
105
114
|
end
|
106
115
|
|
107
|
-
|
116
|
+
# Returns true/false if the device is ready
|
108
117
|
# Uses [SimCtl::DeviceLaunchctl] to look for certain services being running.
|
109
118
|
#
|
110
119
|
# Unfortunately the 'booted' state does not mean the Simulator is ready for
|
111
120
|
# installing or launching applications.
|
112
|
-
|
121
|
+
#
|
113
122
|
# @return [Bool]
|
114
123
|
def ready?
|
115
|
-
# TODO: Should look for different services depending on device type (iphone/ipad, tv, watch)
|
116
124
|
running_services = launchctl.list.reject {|service| service.pid.to_i == 0 }.map {|service| service.name}
|
117
125
|
(required_services_for_ready - running_services).empty?
|
118
126
|
end
|
@@ -240,12 +248,18 @@ module SimCtl
|
|
240
248
|
]
|
241
249
|
end
|
242
250
|
when :ios
|
243
|
-
if Xcode::Version.gte? '
|
251
|
+
if Xcode::Version.gte? '9.0'
|
252
|
+
[
|
253
|
+
'com.apple.backboardd',
|
254
|
+
'com.apple.mobile.installd',
|
255
|
+
'com.apple.CoreSimulator.bridge',
|
256
|
+
'com.apple.SpringBoard',
|
257
|
+
]
|
258
|
+
elsif Xcode::Version.gte? '8.0'
|
244
259
|
[
|
245
260
|
'com.apple.SimulatorBridge',
|
246
261
|
'com.apple.SpringBoard',
|
247
262
|
'com.apple.backboardd',
|
248
|
-
'com.apple.medialibraryd',
|
249
263
|
'com.apple.mobile.installd',
|
250
264
|
]
|
251
265
|
else
|
data/lib/simctl/device_path.rb
CHANGED
@@ -17,7 +17,11 @@ module SimCtl
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def launchctl
|
20
|
-
@launchctl ||=
|
20
|
+
@launchctl ||= if Xcode::Version.gte? '9.0'
|
21
|
+
"#{Xcode::Path.home}//Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/bin/launchctl"
|
22
|
+
else
|
23
|
+
File.join(runtime_root, 'bin/launchctl')
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def preferences_plist
|
data/lib/simctl/version.rb
CHANGED
@@ -192,6 +192,18 @@ RSpec.describe SimCtl, order: :defined do
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
+
describe 'terminating an app' do
|
196
|
+
if SimCtl::Xcode::Version.gte? '8.2'
|
197
|
+
it 'terminates SampleApp' do
|
198
|
+
@device.terminate_app('com.github.plu.simctl.SampleApp')
|
199
|
+
end
|
200
|
+
else
|
201
|
+
it 'raises exception' do
|
202
|
+
expect { @device.terminate_app('com.github.plu.simctl.SampleApp') }.to raise_error SimCtl::UnsupportedCommandError
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
195
207
|
describe 'uninstall an app' do
|
196
208
|
it 'uninstalls SampleApp' do
|
197
209
|
@device.uninstall('com.github.plu.simctl.SampleApp')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Plunien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/simctl/command/reset.rb
|
113
113
|
- lib/simctl/command/shutdown.rb
|
114
114
|
- lib/simctl/command/spawn.rb
|
115
|
+
- lib/simctl/command/terminate.rb
|
115
116
|
- lib/simctl/command/uninstall.rb
|
116
117
|
- lib/simctl/command/warmup.rb
|
117
118
|
- lib/simctl/device.rb
|
@@ -160,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
161
|
version: '0'
|
161
162
|
requirements: []
|
162
163
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.6.11
|
164
165
|
signing_key:
|
165
166
|
specification_version: 4
|
166
167
|
summary: Ruby interface to xcrun simctl
|