simctl 1.6.0 → 1.6.1

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: befe14fafe0f39d0393b7780baa319a46c6bf13a
4
- data.tar.gz: 88c089c6d7da469fbca2024f8892861181bb09a6
3
+ metadata.gz: 852a8c3916e8ecb03f54d6c79ea9b3bbd7aaab2f
4
+ data.tar.gz: 4de85baf3b388ca02860fd05065b49be819cfdc7
5
5
  SHA512:
6
- metadata.gz: e077e932fa6bb00962c6533a3d3656ecfe7e5917266d86c3cb8800b24fb4e81cfcf6311969e66a3cc6906685285cb0e121d52fc605e05a1e287420ff4f25a013
7
- data.tar.gz: d489f60b57eea0d3b3b106e607c5231e1f4cf527e4b4edbd65081df9da559adeacdf4c92b836394cf279ef5ce2f51a7b9cbb5f85a4d4fc5770ffbadfcf29d871
6
+ metadata.gz: 809ce6cf61c49de8e673e18482ba1cb05ef0c9137da126c09905defa694539b67a4f1c1f4949f9ca4a704f23a7db36db7bba266410f18b8e737f62521cbf50e6
7
+ data.tar.gz: e52114bf31605dcc5dcbd334a4e843ccbea9f1a50992ddc087f52a09e783428d4a5456ae25c3bda69cc0540cc5823eb7e1925c4c1efe45638d416f1f4b57a8a1
@@ -1,3 +1,7 @@
1
+ # 1.6.1
2
+
3
+ * Add `SimCtl.warmup`
4
+
1
5
  # 1.6.0
2
6
 
3
7
  * Breaking change: All `!` have been removed from method names
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simctl (1.6.0)
4
+ simctl (1.6.1)
5
5
  CFPropertyList
6
6
  naturally
7
7
 
@@ -10,6 +10,7 @@ module SimCtl
10
10
  class UnsupportedCommandError < StandardError; end
11
11
  class DeviceTypeNotFound < StandardError; end
12
12
  class RuntimeNotFound < StandardError; end
13
+ class DeviceNotFound < StandardError; end
13
14
 
14
15
  @@default_timeout = 15
15
16
 
@@ -13,6 +13,7 @@ require 'simctl/command/reset'
13
13
  require 'simctl/command/shutdown'
14
14
  require 'simctl/command/spawn'
15
15
  require 'simctl/command/uninstall'
16
+ require 'simctl/command/warmup'
16
17
  require 'simctl/executor'
17
18
  require 'shellwords'
18
19
 
@@ -35,6 +36,7 @@ module SimCtl
35
36
  include SimCtl::Command::Shutdown
36
37
  include SimCtl::Command::Spawn
37
38
  include SimCtl::Command::Uninstall
39
+ include SimCtl::Command::Warmup
38
40
 
39
41
  def device_set_path=(device_set_path)
40
42
  @device_set_path = File.expand_path(device_set_path)
@@ -0,0 +1,21 @@
1
+ module SimCtl
2
+ class Command
3
+ module Warmup
4
+ # Warms up a device and waits for it to be ready
5
+ #
6
+ # @param devicetype [String] device type string
7
+ # @param runtime [String] runtime string
8
+ # @param timeout [Integer] timeout in seconds to wait until device is ready
9
+ # @return [SimCtl::Device]
10
+ def warmup(devicetype, runtime, timeout=120)
11
+ devicetype = devicetype(name: devicetype) unless devicetype.is_a?(DeviceType)
12
+ runtime = runtime(name: runtime) unless runtime.is_a?(Runtime)
13
+ device = device(devicetype: devicetype, runtime: runtime)
14
+ raise DeviceNotFound.new("Could not find device with type '#{devicetype.name}' and runtime '#{runtime.name}'") if device.nil?
15
+ device.launch
16
+ device.wait(timeout) {|d| d.state == :booted && d.ready?}
17
+ device
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module SimCtl
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.1'
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe SimCtl do
4
+ describe '#warmup' do
5
+ if SimCtl.device_set_path.nil?
6
+ it 'warms up and returns a device for given strings' do
7
+ expect(SimCtl.warmup('iPhone 6', 'iOS 9.3')).to be_kind_of SimCtl::Device
8
+ end
9
+
10
+ it 'warms up and returns a device for given objects' do
11
+ devicetype = SimCtl.devicetype(name: 'iPhone 5')
12
+ runtime = SimCtl::Runtime.latest(:ios)
13
+ expect(SimCtl.warmup(devicetype, runtime)).to be_kind_of SimCtl::Device
14
+ end
15
+ else
16
+ it 'raises exception' do
17
+ expect { SimCtl.warmup('iPhone 6', 'iOS 9.3') }.to raise_error SimCtl::DeviceNotFound
18
+ end
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Plunien
@@ -113,6 +113,7 @@ files:
113
113
  - lib/simctl/command/shutdown.rb
114
114
  - lib/simctl/command/spawn.rb
115
115
  - lib/simctl/command/uninstall.rb
116
+ - lib/simctl/command/warmup.rb
116
117
  - lib/simctl/device.rb
117
118
  - lib/simctl/device_launchctl.rb
118
119
  - lib/simctl/device_path.rb
@@ -137,6 +138,7 @@ files:
137
138
  - spec/simctl/executor_spec.rb
138
139
  - spec/simctl/list_spec.rb
139
140
  - spec/simctl/readme_spec.rb
141
+ - spec/simctl/warmup_spec.rb
140
142
  - spec/spec_helper.rb
141
143
  homepage: https://github.com/plu/simctl
142
144
  licenses:
@@ -174,4 +176,5 @@ test_files:
174
176
  - spec/simctl/executor_spec.rb
175
177
  - spec/simctl/list_spec.rb
176
178
  - spec/simctl/readme_spec.rb
179
+ - spec/simctl/warmup_spec.rb
177
180
  - spec/spec_helper.rb