simctl 0.1.0 → 0.2.0
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/.coveralls.yml +1 -0
- data/.gitignore +2 -0
- data/Gemfile.lock +33 -1
- data/README.md +9 -1
- data/lib/simctl/command/boot.rb +1 -0
- data/lib/simctl/command/create.rb +20 -1
- data/lib/simctl/command/delete.rb +1 -0
- data/lib/simctl/command/erase.rb +1 -0
- data/lib/simctl/command/shutdown.rb +1 -0
- data/lib/simctl/version.rb +1 -1
- data/simctl.gemspec +1 -0
- data/test/simctl/command/crud_test.rb +11 -1
- data/test/simctl/command/list_test.rb +13 -0
- data/test/test_helper.rb +3 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08e307334697a4860011084ade0950db0e7603b6
|
4
|
+
data.tar.gz: 16ba00c29ba5c6d3b8108412aadd49d6a89e8411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c6f499511ef8e23a2843f7ab9e67b10fa818e0949497fb1031a0b97760dc90652e79c4ffc4bdd1cdb71bb9719a23698be27b4aa380f7e85e45e684f5deed7d7
|
7
|
+
data.tar.gz: 2573ec31399d6e1fe268d4729367cc8e319344bb23c641c1b21169262113b95cca600903f6140ff8d0db765fb9911d0038c04555eade7127ec7af15b77a543f8
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: kVHew1JCYhlMacKR4TheQtAbB5EfpwWkk
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simctl (0.
|
4
|
+
simctl (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
coveralls (0.8.10)
|
10
|
+
json (~> 1.8)
|
11
|
+
rest-client (>= 1.6.8, < 2)
|
12
|
+
simplecov (~> 0.11.0)
|
13
|
+
term-ansicolor (~> 1.3)
|
14
|
+
thor (~> 0.19.1)
|
15
|
+
tins (~> 1.6.0)
|
16
|
+
docile (1.1.5)
|
17
|
+
domain_name (0.5.25)
|
18
|
+
unf (>= 0.0.5, < 1.0.0)
|
19
|
+
http-cookie (1.0.2)
|
20
|
+
domain_name (~> 0.5)
|
21
|
+
json (1.8.3)
|
9
22
|
maxitest (1.5.4)
|
10
23
|
minitest (>= 5.0.0, < 5.9.0)
|
24
|
+
mime-types (2.99)
|
11
25
|
minitest (5.8.3)
|
26
|
+
netrc (0.11.0)
|
12
27
|
rake (10.4.2)
|
28
|
+
rest-client (1.8.0)
|
29
|
+
http-cookie (>= 1.0.2, < 2.0)
|
30
|
+
mime-types (>= 1.16, < 3.0)
|
31
|
+
netrc (~> 0.7)
|
13
32
|
shoulda-context (1.2.1)
|
33
|
+
simplecov (0.11.1)
|
34
|
+
docile (~> 1.1.0)
|
35
|
+
json (~> 1.8)
|
36
|
+
simplecov-html (~> 0.10.0)
|
37
|
+
simplecov-html (0.10.0)
|
38
|
+
term-ansicolor (1.3.2)
|
39
|
+
tins (~> 1.0)
|
40
|
+
thor (0.19.1)
|
41
|
+
tins (1.6.0)
|
42
|
+
unf (0.1.4)
|
43
|
+
unf_ext
|
44
|
+
unf_ext (0.0.7.1)
|
14
45
|
|
15
46
|
PLATFORMS
|
16
47
|
ruby
|
17
48
|
|
18
49
|
DEPENDENCIES
|
50
|
+
coveralls
|
19
51
|
maxitest
|
20
52
|
rake
|
21
53
|
shoulda-context
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# simctl
|
2
2
|
|
3
|
-
[](https://travis-ci.org/plu/simctl)
|
3
|
+
[](https://travis-ci.org/plu/simctl) [](https://badge.fury.io/rb/simctl) [](https://coveralls.io/github/plu/simctl?branch=master)
|
4
4
|
|
5
5
|
Ruby interface to xcrun simctl.
|
6
6
|
|
@@ -124,6 +124,14 @@ end
|
|
124
124
|
#<SimCtl::Runtime:0x007fbce48cd040 @buildversion="13S660", @availability="(available)", @name="watchOS 2.1", @identifier="com.apple.CoreSimulator.SimRuntime.watchOS-2-1", @version="2.1">
|
125
125
|
```
|
126
126
|
|
127
|
+
### reset_device
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
SimCtl.reset_device 'my iphone 5', SimCtl.devicetype(name: 'iPhone 5'), SimCtl.runtime(name: 'iOS 9.2')
|
131
|
+
|
132
|
+
#<SimCtl::Device:0x007fbce48afd88 @state="Creating", @availability="(available)", @name="my iphone 5", @udid="6F7269E0-6375-4B72-8451-F2728BF6DA82", @os="iOS 9.2">
|
133
|
+
```
|
134
|
+
|
127
135
|
### runtime
|
128
136
|
|
129
137
|
```ruby
|
data/lib/simctl/command/boot.rb
CHANGED
@@ -6,13 +6,32 @@ module SimCtl
|
|
6
6
|
# Creates a device
|
7
7
|
#
|
8
8
|
# @param name [String] name of the new device
|
9
|
-
# @param device_type [SimCtl::
|
9
|
+
# @param device_type [SimCtl::DeviceType] device type of the new device
|
10
10
|
# @param runtime [SimCtl::Runtime] runtime of the new device
|
11
|
+
# @return [SimCtl::Device] the device that was created
|
11
12
|
def create_device(name, device_type, runtime)
|
12
13
|
Executor.execute([COMMAND, "'#{name}'", device_type.identifier, runtime.identifier]) do |identifier|
|
13
14
|
device(udid: identifier)
|
14
15
|
end
|
15
16
|
end
|
17
|
+
|
18
|
+
# Shutdown, delete and create a device
|
19
|
+
#
|
20
|
+
# @param name [String] name of the new device
|
21
|
+
# @param device_type [SimCtl::DeviceType] device type of the new device
|
22
|
+
# @param runtime [SimCtl::Runtime] runtime of the new device
|
23
|
+
# @return [SimCtl::Device] the device that was created
|
24
|
+
# @yield [exception] an exception that might happen during shutdown/delete of the old device
|
25
|
+
def reset_device(name, device_type, runtime)
|
26
|
+
begin
|
27
|
+
device = device(name: name, os: runtime.name)
|
28
|
+
device.shutdown! if device.state != 'Shutdown'
|
29
|
+
device.delete!
|
30
|
+
rescue Exception => exception
|
31
|
+
yield exception if block_given?
|
32
|
+
end
|
33
|
+
create_device name, device_type, runtime
|
34
|
+
end
|
16
35
|
end
|
17
36
|
end
|
18
37
|
end
|
data/lib/simctl/command/erase.rb
CHANGED
data/lib/simctl/version.rb
CHANGED
data/simctl.gemspec
CHANGED
@@ -12,7 +12,9 @@ class SimCtl::Command::CRUDTest < Minitest::Test
|
|
12
12
|
|
13
13
|
def teardown
|
14
14
|
device = SimCtl.device(udid: @device.udid)
|
15
|
-
|
15
|
+
return unless device
|
16
|
+
device.shutdown! if device.state != 'Shutdown'
|
17
|
+
device.delete!
|
16
18
|
end
|
17
19
|
|
18
20
|
def wait_for
|
@@ -52,4 +54,12 @@ class SimCtl::Command::CRUDTest < Minitest::Test
|
|
52
54
|
SimCtl.delete_device device
|
53
55
|
assert_nil SimCtl.device(udid: @device.udid)
|
54
56
|
end
|
57
|
+
|
58
|
+
should 'reset the device created in setup' do
|
59
|
+
device = SimCtl.reset_device @device.name, @devicetype, @runtime
|
60
|
+
assert_kind_of SimCtl::Device, device
|
61
|
+
assert_nil SimCtl.device(udid: @device.udid)
|
62
|
+
@device = device # teardown cleanup
|
63
|
+
wait_for {|device| device.state != 'Creating'}
|
64
|
+
end
|
55
65
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class SimCtl::Command::ListTest < Minitest::Test
|
4
|
+
context 'devicetype' do
|
5
|
+
should 'find device type by name' do
|
6
|
+
assert_kind_of SimCtl::DeviceType, SimCtl.devicetype(name: 'iPhone 5')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
context 'list_devicetypes' do
|
5
11
|
should 'contain some devicetypes' do
|
6
12
|
assert SimCtl.list_devicetypes.count > 0
|
@@ -44,4 +50,11 @@ class SimCtl::Command::ListTest < Minitest::Test
|
|
44
50
|
assert SimCtl.list_runtimes.first.name != nil
|
45
51
|
end
|
46
52
|
end
|
53
|
+
|
54
|
+
context 'runtime' do
|
55
|
+
should 'find runtime by name' do
|
56
|
+
assert_kind_of SimCtl::Runtime, SimCtl.runtime(name: 'iOS 9.2')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
47
60
|
end
|
data/test/test_helper.rb
CHANGED
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: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Plunien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Ruby interface to xcrun simctl
|
56
70
|
email:
|
57
71
|
- plu@pqpq.de
|
@@ -59,6 +73,7 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
76
|
+
- ".coveralls.yml"
|
62
77
|
- ".gitignore"
|
63
78
|
- ".travis.yml"
|
64
79
|
- Gemfile
|
@@ -105,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
120
|
version: '0'
|
106
121
|
requirements: []
|
107
122
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.2.2
|
109
124
|
signing_key:
|
110
125
|
specification_version: 4
|
111
126
|
summary: Ruby interface to xcrun simctl
|
@@ -113,4 +128,3 @@ test_files:
|
|
113
128
|
- test/simctl/command/crud_test.rb
|
114
129
|
- test/simctl/command/list_test.rb
|
115
130
|
- test/test_helper.rb
|
116
|
-
has_rdoc:
|