simctl 1.5.0 → 1.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11fcd32b757a21e4fbf179095f081bf05c173a62
4
- data.tar.gz: 1422938aace085d235c73e5bc62c70a78b52ae1a
3
+ metadata.gz: da76a9f1cad014fffee2818138f5e11fbd0cc97e
4
+ data.tar.gz: 3932e4c59a417d56f38a69af7f0dd5c16bc12e15
5
5
  SHA512:
6
- metadata.gz: 4caf9e1dda2ecf77aadea8d71c2ae6a329dfd2b24b0807bab3b67d8cdf6e9b8041263b49e8f6fc5a979ec0f3b9677deab74e936ee26407cc84aff6e95f767450
7
- data.tar.gz: 9e264b21cb31b756c297333f4e8c1f030dd5eaf144eb48244638cab1e94106b7b79682ae0e87923d2a9ba84ff084f6cca83a285370a92492f54b45fbee817106
6
+ metadata.gz: ee307c69171853a9d164756c7d842169e33df54a017264bbbc2c9a17fb7c4a5a372d86d9922b989e4333c30224906dbc9050edcce11a04f9a3aad83e5c713a7b
7
+ data.tar.gz: 5abd74d5dd1214848a0c0023774c3fa434897d3c3b80660a60876848b39644749ca7b00052f3ad29558af8b7d2bda12bbf1b405c2427deb5f82a95a2ebaa821b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.5.1
2
+
3
+ * Let `SimCtl#create_device` wait for the device to be created
4
+
1
5
  # 1.5.0
2
6
 
3
7
  * `SimCtl#devicetype` throws exception if device type could not be found
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simctl (1.5.0)
4
+ simctl (1.5.1)
5
5
  CFPropertyList
6
6
 
7
7
  GEM
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  simctl!
57
57
 
58
58
  BUNDLED WITH
59
- 1.11.2
59
+ 1.12.5
data/README.md CHANGED
@@ -25,6 +25,7 @@ device.launch!
25
25
  device.wait! {|d| d.state == :booted}
26
26
 
27
27
  # Kill the Simulator.app instance again
28
+ device.shutdown!
28
29
  device.kill!
29
30
 
30
31
  # Wait until it did shutdown
data/lib/simctl.rb CHANGED
@@ -5,7 +5,17 @@ require 'simctl/list'
5
5
  require 'simctl/runtime'
6
6
 
7
7
  module SimCtl
8
+ @@default_timeout = 15
9
+
8
10
  class << self
11
+ def default_timeout
12
+ @@default_timeout
13
+ end
14
+
15
+ def default_timeout=(timeout)
16
+ @@default_timeout = timeout
17
+ end
18
+
9
19
  def command
10
20
  return @command if defined?(@command)
11
21
  @command = SimCtl::Command.new
@@ -16,9 +16,11 @@ module SimCtl
16
16
  devicetype = devicetype(name: devicetype) unless devicetype.is_a?(DeviceType)
17
17
  raise "Invalid runtime: #{runtime}" unless runtime.is_a?(Runtime)
18
18
  raise "Invalid devicetype: #{devicetype}" unless devicetype.is_a?(DeviceType)
19
- Executor.execute([COMMAND, Shellwords.shellescape(name), devicetype.identifier, runtime.identifier]) do |identifier|
19
+ device = Executor.execute([COMMAND, Shellwords.shellescape(name), devicetype.identifier, runtime.identifier]) do |identifier|
20
20
  device(udid: identifier)
21
21
  end
22
+ device.wait! {|d| d.state == :shutdown && File.exists?(d.path.device_plist)}
23
+ device
22
24
  end
23
25
  end
24
26
  end
data/lib/simctl/device.rb CHANGED
@@ -126,7 +126,7 @@ module SimCtl
126
126
  # Reloads the device until the given block returns true
127
127
  #
128
128
  # @return [void]
129
- def wait!(timeout=15)
129
+ def wait!(timeout=SimCtl.default_timeout)
130
130
  Timeout::timeout(timeout) do
131
131
  loop do
132
132
  break if yield SimCtl.device(udid: udid)
@@ -1,3 +1,3 @@
1
1
  module SimCtl
2
- VERSION = '1.5.0'
2
+ VERSION = '1.5.1'
3
3
  end
@@ -104,8 +104,6 @@ class SimCtl::Command::CRUDTest < Minitest::Test
104
104
  should '9800. reset the device' do
105
105
  old_device = SimCtl.device(udid: udid)
106
106
  new_device = old_device.reset!
107
- new_device.wait!{|d| d.state != :creating}
108
- new_device.wait!{|d| File.exists?(d.path.device_plist)}
109
107
  assert old_device.name == new_device.name
110
108
  assert old_device.devicetype == new_device.devicetype
111
109
  assert old_device.runtime == new_device.runtime
@@ -0,0 +1,30 @@
1
+ require 'test_helper'
2
+
3
+ class SimCtl::Command::ReadmeTest < Minitest::Test
4
+ should 'execute example code from readme' do
5
+ # Select the iOS 9.2 runtime
6
+ runtime = SimCtl.runtime(name: 'iOS 9.2')
7
+
8
+ # Select the iPhone 5 device type
9
+ devicetype = SimCtl.devicetype(name: 'iPhone 5')
10
+
11
+ # Create a new device
12
+ device = SimCtl.create_device 'Unit Tests @ iPhone 5 9.2', devicetype, runtime
13
+
14
+ # Launch a new Simulator.app instance
15
+ device.launch!
16
+
17
+ # Wait for the device to be booted
18
+ device.wait! {|d| d.state == :booted}
19
+
20
+ # Kill the Simulator.app instance again
21
+ device.shutdown!
22
+ device.kill!
23
+
24
+ # Wait until it did shutdown
25
+ device.wait! {|d| d.state == :shutdown}
26
+
27
+ # Delete the device
28
+ device.delete!
29
+ end
30
+ end
data/test/test_helper.rb CHANGED
@@ -6,3 +6,7 @@ require 'shoulda-context'
6
6
 
7
7
  $LOAD_PATH.push File.expand_path("../../lib", __FILE__)
8
8
  require File.dirname(__FILE__) + '/../lib/simctl.rb'
9
+
10
+ if ENV['TRAVIS']
11
+ SimCtl.default_timeout = 300
12
+ end
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Plunien
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -128,6 +128,7 @@ files:
128
128
  - test/SampleApp/SampleApp/main.m
129
129
  - test/simctl/command/crud_test.rb
130
130
  - test/simctl/command/list_test.rb
131
+ - test/simctl/command/readme_test.rb
131
132
  - test/test_helper.rb
132
133
  homepage: https://github.com/plu/simctl
133
134
  licenses:
@@ -163,4 +164,5 @@ test_files:
163
164
  - test/SampleApp/SampleApp/main.m
164
165
  - test/simctl/command/crud_test.rb
165
166
  - test/simctl/command/list_test.rb
167
+ - test/simctl/command/readme_test.rb
166
168
  - test/test_helper.rb