simctl 0.1.0 → 0.2.0

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: 0bb277e12e4ce8fc175ae3aa9e2f6409df2f9452
4
- data.tar.gz: 21f532425ac401ea95dde484af341f2f4d8231db
3
+ metadata.gz: 08e307334697a4860011084ade0950db0e7603b6
4
+ data.tar.gz: 16ba00c29ba5c6d3b8108412aadd49d6a89e8411
5
5
  SHA512:
6
- metadata.gz: 8d0400e3c768b6f7dac83a7c4cc7195daa71eca447630410c753c4e19016f29878ef1e59de51dda28eb2e7e89ffa01bf4602167cbbd1ff2352326656e736b766
7
- data.tar.gz: ac9fd2b3fed5f8652dc3fbf2d1cde044fb98f0e6cebe36a83e8f91847c1f8e17f5a6c98e9e04234243ffb1db158f9957831df4b57aaf5fb2efc64593e6ef041c
6
+ metadata.gz: 4c6f499511ef8e23a2843f7ab9e67b10fa818e0949497fb1031a0b97760dc90652e79c4ffc4bdd1cdb71bb9719a23698be27b4aa380f7e85e45e684f5deed7d7
7
+ data.tar.gz: 2573ec31399d6e1fe268d4729367cc8e319344bb23c641c1b21169262113b95cca600903f6140ff8d0db765fb9911d0038c04555eade7127ec7af15b77a543f8
@@ -0,0 +1 @@
1
+ repo_token: kVHew1JCYhlMacKR4TheQtAbB5EfpwWkk
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
+ coverage/
1
2
  doc/
3
+ pkg/
2
4
  .yardoc/
@@ -1,21 +1,53 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simctl (0.1.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
- [![Build Status](https://travis-ci.org/plu/simctl.svg?branch=master)](https://travis-ci.org/plu/simctl)
3
+ [![Build Status](https://travis-ci.org/plu/simctl.svg?branch=master)](https://travis-ci.org/plu/simctl) [![Gem Version](https://badge.fury.io/rb/simctl.svg)](https://badge.fury.io/rb/simctl) [![Coverage Status](https://coveralls.io/repos/plu/simctl/badge.svg?branch=master&service=github)](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
@@ -6,6 +6,7 @@ module SimCtl
6
6
  # Boots a device
7
7
  #
8
8
  # @param device [SimCtl::Device] the device to boot
9
+ # @return [void]
9
10
  def boot_device(device)
10
11
  Executor.execute([COMMAND, device.udid])
11
12
  end
@@ -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::DeviceTYpe] device type of the new device
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
@@ -6,6 +6,7 @@ module SimCtl
6
6
  # Delete a device
7
7
  #
8
8
  # @param device [SimCtl::Device] the device to delete
9
+ # @return [void]
9
10
  def delete_device(device)
10
11
  Executor.execute([COMMAND, device.udid])
11
12
  end
@@ -6,6 +6,7 @@ module SimCtl
6
6
  # Erase a device
7
7
  #
8
8
  # @param device [SimCtl::Device] the device to erase
9
+ # @return [void]
9
10
  def erase_device(device)
10
11
  Executor.execute([COMMAND, device.udid])
11
12
  end
@@ -6,6 +6,7 @@ module SimCtl
6
6
  # Shutdown a device
7
7
  #
8
8
  # @param device [SimCtl::Device] the device to shutdown
9
+ # @return [void]
9
10
  def shutdown_device(device)
10
11
  Executor.execute([COMMAND, device.udid])
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module SimCtl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rake'
22
22
  s.add_development_dependency 'maxitest'
23
23
  s.add_development_dependency 'shoulda-context'
24
+ s.add_development_dependency 'coveralls'
24
25
  end
@@ -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
- SimCtl.delete_device device if device
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
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'maxitest/autorun'
2
5
  require 'shoulda-context'
3
6
 
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.1.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-24 00:00:00.000000000 Z
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.4.6
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: