simctl 1.6.8 → 1.6.10

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
  SHA256:
3
- metadata.gz: e3fa7188b00a37eb0401b6ca306d139fc781eebe63423bec0668177b8ba240bd
4
- data.tar.gz: d5228eb5e09fc2e374808d634387d8bd1137ae6ad4d1802ac9d99fe2560de4de
3
+ metadata.gz: 01f3ce681b28771f0952bf633fa33fed96b06e009331fdcb1ba40452e6480dd9
4
+ data.tar.gz: eb15732f51c9ed7dc17a61d6439f5a185cdd7cd9aecdcabecc55fb221cb4d451
5
5
  SHA512:
6
- metadata.gz: e64ac086748ecf6d73da5594e2c4946984c7346f2e64d390c26451389b494a8477c00bb9bd37a2e9fbbdaf744ab8dec8ebe9ee6db28570bd707f633bfc18d60f
7
- data.tar.gz: 1d5b51b55f031240b96649a7042b5d16d9120e9ca8c6731d04bb44f5f361dd208d79c8c4dcb21f507cff43cac4eecdfdabc8a15dee59fe937ce938ebbca17b32
6
+ metadata.gz: 665c06b9d2a31c17b0b614dcbb792476d2f1a519483c85834391736a148beaec615efd4361cc48af0ac0287e283842d5b73b5147f22a3568b17050711ef895cc
7
+ data.tar.gz: 9a9134735dee1ce4bb3eca2b1eb3c6f5d325f982dfe83c2b3c1f4ea63a4c002ff023c0721bb9bf8f062192b805b93ee7feac8a1a7e4237014a4f7a98d5b2ca37
@@ -0,0 +1,13 @@
1
+ name: Test
2
+ on: [push]
3
+ jobs:
4
+ build:
5
+ env:
6
+ LANG: en_US.UTF-8
7
+ runs-on: macos-11
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Install dependencies
11
+ run: gem install bundler:1.17.3 && bundle install
12
+ - name: Run tests
13
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.7.0
2
+
3
+ * Fix issue with Ruby >= 3.2
4
+
5
+ # 1.6.9
6
+
7
+ * Add `keychain_reset` command
8
+
1
9
  # 1.6.8
2
10
 
3
11
  * Add `upgrade` command
data/Gemfile.lock CHANGED
@@ -1,50 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simctl (1.6.8)
4
+ simctl (1.6.10)
5
5
  CFPropertyList
6
6
  naturally
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- CFPropertyList (3.0.2)
12
- ast (2.4.0)
11
+ CFPropertyList (3.0.6)
12
+ rexml
13
+ ast (2.4.2)
13
14
  coveralls (0.8.23)
14
15
  json (>= 1.8, < 3)
15
16
  simplecov (~> 0.16.1)
16
17
  term-ansicolor (~> 1.3)
17
18
  thor (>= 0.19.4, < 2.0)
18
19
  tins (~> 1.6)
19
- diff-lcs (1.3)
20
- docile (1.3.2)
21
- io-console (0.5.5)
22
- irb (1.2.1)
23
- reline (>= 0.0.1)
24
- json (2.2.0)
25
- naturally (2.2.0)
26
- parallel (1.17.0)
27
- parser (2.6.3.0)
28
- ast (~> 2.4.0)
29
- powerpack (0.1.2)
20
+ diff-lcs (1.5.0)
21
+ docile (1.4.0)
22
+ io-console (0.6.0)
23
+ irb (1.6.2)
24
+ reline (>= 0.3.0)
25
+ json (2.6.3)
26
+ naturally (2.2.1)
27
+ parallel (1.22.1)
28
+ parser (2.7.2.0)
29
+ ast (~> 2.4.1)
30
+ powerpack (0.1.3)
30
31
  rainbow (2.2.2)
31
32
  rake
32
- rake (12.3.3)
33
- reline (0.1.2)
33
+ rake (13.0.6)
34
+ reline (0.3.2)
34
35
  io-console (~> 0.5)
35
- rspec (3.8.0)
36
- rspec-core (~> 3.8.0)
37
- rspec-expectations (~> 3.8.0)
38
- rspec-mocks (~> 3.8.0)
39
- rspec-core (3.8.2)
40
- rspec-support (~> 3.8.0)
41
- rspec-expectations (3.8.4)
36
+ rexml (3.2.5)
37
+ rspec (3.12.0)
38
+ rspec-core (~> 3.12.0)
39
+ rspec-expectations (~> 3.12.0)
40
+ rspec-mocks (~> 3.12.0)
41
+ rspec-core (3.12.0)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-expectations (3.12.2)
42
44
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.8.0)
44
- rspec-mocks (3.8.1)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-mocks (3.12.3)
45
47
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.8.0)
47
- rspec-support (3.8.2)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-support (3.12.0)
48
50
  rubocop (0.49.1)
49
51
  parallel (~> 1.10)
50
52
  parser (>= 2.3.3.1, < 3.0)
@@ -52,20 +54,23 @@ GEM
52
54
  rainbow (>= 1.99.1, < 3.0)
53
55
  ruby-progressbar (~> 1.7)
54
56
  unicode-display_width (~> 1.0, >= 1.0.1)
55
- ruby-progressbar (1.10.1)
57
+ ruby-progressbar (1.11.0)
56
58
  simplecov (0.16.1)
57
59
  docile (~> 1.1)
58
60
  json (>= 1.8, < 3)
59
61
  simplecov-html (~> 0.10.0)
60
62
  simplecov-html (0.10.2)
63
+ sync (0.5.0)
61
64
  term-ansicolor (1.7.1)
62
65
  tins (~> 1.0)
63
- thor (0.20.3)
64
- tins (1.21.1)
65
- unicode-display_width (1.6.0)
66
+ thor (1.2.1)
67
+ tins (1.32.1)
68
+ sync
69
+ unicode-display_width (1.8.0)
66
70
 
67
71
  PLATFORMS
68
- ruby
72
+ arm64-darwin-21
73
+ arm64-darwin-22
69
74
 
70
75
  DEPENDENCIES
71
76
  coveralls
@@ -76,4 +81,4 @@ DEPENDENCIES
76
81
  simctl!
77
82
 
78
83
  BUNDLED WITH
79
- 1.17.3
84
+ 2.4.1
data/README.md CHANGED
@@ -9,14 +9,14 @@ Ruby interface to xcrun simctl. Manage your iOS Simulators directly from a ruby
9
9
  ```ruby
10
10
  require 'simctl'
11
11
 
12
- # Select the iOS 12.1 runtime
13
- runtime = SimCtl.runtime(name: 'iOS 12.1')
12
+ # Select the iOS 14.5 runtime
13
+ runtime = SimCtl.runtime(name: 'iOS 14.5')
14
14
 
15
- # Select the iPhone 6 device type
16
- devicetype = SimCtl.devicetype(name: 'iPhone 6')
15
+ # Select the iPhone 8 device type
16
+ devicetype = SimCtl.devicetype(name: 'iPhone 8')
17
17
 
18
18
  # Create a new device
19
- device = SimCtl.create_device 'Unit Tests @ iPhone 6 - 12.1', devicetype, runtime
19
+ device = SimCtl.create_device 'Unit Tests @ iPhone 8 - 14.5', devicetype, runtime
20
20
 
21
21
  # Boot the device
22
22
  device.boot
@@ -34,7 +34,7 @@ module Fastlane
34
34
  description: "iOS device type used to create the simulator",
35
35
  optional: true,
36
36
  type: String,
37
- default_value: 'iPhone 6'),
37
+ default_value: 'iPhone 8'),
38
38
  FastlaneCore::ConfigItem.new(key: :name,
39
39
  description: "String used to set the name to the simulator",
40
40
  optional: true,
@@ -0,0 +1,18 @@
1
+ require 'ostruct'
2
+
3
+ module SimCtl
4
+ class Command
5
+ module Keychain
6
+ # Reset the keychain
7
+ #
8
+ # @param device [SimCtl::Device] the device
9
+ # @return [void]
10
+ def keychain_reset(device)
11
+ unless Xcode::Version.gte? '11.4'
12
+ raise UnsupportedCommandError, 'Needs at least Xcode 11.4'
13
+ end
14
+ Executor.execute(command_for('keychain', device.udid, 'reset'))
15
+ end
16
+ end
17
+ end
18
+ end
@@ -10,7 +10,7 @@ module SimCtl
10
10
  def warmup(devicetype, runtime, timeout = 120)
11
11
  devicetype = devicetype(name: devicetype) unless devicetype.is_a?(DeviceType)
12
12
  runtime = runtime(name: runtime) unless runtime.is_a?(Runtime)
13
- device = device(devicetype: devicetype, runtime: runtime)
13
+ device = device(runtime: runtime, devicetype: devicetype)
14
14
  raise DeviceNotFound, "Could not find device with type '#{devicetype.name}' and runtime '#{runtime.name}'" if device.nil?
15
15
  device.boot if device.state != :booted
16
16
  device.wait(timeout) { |d| d.state == :booted && d.ready? }
@@ -4,6 +4,7 @@ require 'simctl/command/delete'
4
4
  require 'simctl/command/erase'
5
5
  require 'simctl/command/install'
6
6
  require 'simctl/command/io'
7
+ require 'simctl/command/keychain'
7
8
  require 'simctl/command/kill'
8
9
  require 'simctl/command/launch'
9
10
  require 'simctl/command/privacy'
@@ -32,6 +33,7 @@ module SimCtl
32
33
  include SimCtl::Command::Erase
33
34
  include SimCtl::Command::IO
34
35
  include SimCtl::Command::Install
36
+ include SimCtl::Command::Keychain
35
37
  include SimCtl::Command::Kill
36
38
  include SimCtl::Command::Launch
37
39
  include SimCtl::Command::List
data/lib/simctl/device.rb CHANGED
@@ -3,6 +3,7 @@ require 'ostruct'
3
3
  require 'simctl/device_launchctl'
4
4
  require 'simctl/device_path'
5
5
  require 'simctl/device_settings'
6
+ require 'simctl/keychain'
6
7
  require 'simctl/object'
7
8
  require 'simctl/status_bar'
8
9
  require 'timeout'
@@ -27,7 +28,12 @@ module SimCtl
27
28
  #
28
29
  # @return [Bool]
29
30
  def available?
30
- is_available !~ /unavailable/i
31
+ case is_available
32
+ when String
33
+ is_available !~ /unavailable/i
34
+ else
35
+ is_available
36
+ end
31
37
  end
32
38
 
33
39
  # Boots the device
@@ -46,9 +52,11 @@ module SimCtl
46
52
 
47
53
  # Returns the device type
48
54
  #
49
- # @return [SimCtl::DeviceType]
55
+ # @return [SimCtl::DeviceType, String]
50
56
  def devicetype
51
57
  @devicetype ||= SimCtl.devicetype(identifier: plist.deviceType)
58
+ rescue
59
+ plist.deviceType
52
60
  end
53
61
 
54
62
  # Erases the device
@@ -95,6 +103,13 @@ module SimCtl
95
103
  @launchctl ||= DeviceLaunchctl.new(self)
96
104
  end
97
105
 
106
+ # Returns the keychain bar object
107
+ #
108
+ # @return [SimCtl::keychain]
109
+ def keychain
110
+ @keychain ||= SimCtl::Keychain.new(self)
111
+ end
112
+
98
113
  # Launches an app in the given device
99
114
  #
100
115
  # @param opts [Hash] options hash - `{ wait_for_debugger: true/false }`
@@ -177,9 +192,11 @@ module SimCtl
177
192
 
178
193
  # Returns the runtime object
179
194
  #
180
- # @return [SimCtl::Runtime]
195
+ # @return [SimCtl::Runtime, String]
181
196
  def runtime
182
197
  @runtime ||= SimCtl.runtime(identifier: plist.runtime)
198
+ rescue
199
+ plist.runtime
183
200
  end
184
201
 
185
202
  # Saves a screenshot to a file
@@ -0,0 +1,18 @@
1
+ module SimCtl
2
+ class Keychain
3
+ def initialize(device)
4
+ @device = device
5
+ end
6
+
7
+ # Reset the keychain
8
+ #
9
+ # @return [void]
10
+ def reset
11
+ SimCtl.keychain_reset(device)
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :device
17
+ end
18
+ end
@@ -32,7 +32,7 @@ module SimCtl
32
32
  # @param name [String] type (ios, watchos, tvos)
33
33
  # @return [SimCtl::Runtime] the latest available runtime
34
34
  def self.latest(type)
35
- Naturally.sort_by(SimCtl.list_runtimes.where(name: /#{type}/i), :version).last
35
+ Naturally.sort_by(SimCtl.list_runtimes.where(identifier: /#{type}/i), :version).last
36
36
  end
37
37
  end
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module SimCtl
2
- VERSION = '1.6.8'.freeze
2
+ VERSION = '1.6.10'.freeze
3
3
  end
@@ -169,6 +169,18 @@ RSpec.describe SimCtl, order: :defined do
169
169
  end
170
170
  end
171
171
 
172
+ describe 'keychain operations' do
173
+ if SimCtl::Xcode::Version.gte?('11.4')
174
+ it 'resets the keychain' do
175
+ @device.keychain.reset
176
+ end
177
+ else
178
+ it 'raises exception' do
179
+ expect { @device.keychain.reset }.to raise_error SimCtl::UnsupportedCommandError
180
+ end
181
+ end
182
+ end
183
+
172
184
  describe 'overriding status bar values' do
173
185
  if SimCtl::Xcode::Version.gte?('11.4')
174
186
  it 'overrides the status bar values' do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  RSpec.describe SimCtl do
4
4
  describe '#devicetype' do
5
5
  it 'find device type by name' do
6
- expect(SimCtl.devicetype(name: 'iPhone 6')).to be_kind_of SimCtl::DeviceType
6
+ expect(SimCtl.devicetype(name: 'iPhone 8')).to be_kind_of SimCtl::DeviceType
7
7
  end
8
8
 
9
9
  it 'raise exception if device type is not found' do
@@ -69,15 +69,19 @@ RSpec.describe SimCtl do
69
69
 
70
70
  describe '#runtime' do
71
71
  it 'find runtime by name' do
72
- expect(SimCtl.runtime(name: 'iOS 12.1')).to be_kind_of SimCtl::Runtime
72
+ expect(SimCtl.runtime(name: 'iOS 15.2')).to be_kind_of SimCtl::Runtime
73
73
  end
74
74
 
75
75
  it 'raise exception if runtime is not found' do
76
- expect { SimCtl.runtime(name: 'iOS 17.0') }.to raise_error SimCtl::RuntimeNotFound
76
+ expect { SimCtl.runtime(name: 'iOS 19.0') }.to raise_error SimCtl::RuntimeNotFound
77
77
  end
78
78
 
79
79
  it 'finds the latest runtime' do
80
- if SimCtl::Xcode::Version.gte?('11.4')
80
+ if SimCtl::Xcode::Version.gte?('13.2')
81
+ expect(SimCtl::Runtime.latest(:ios).version).to be == '15.2'
82
+ elsif SimCtl::Xcode::Version.gte?('12.5')
83
+ expect(SimCtl::Runtime.latest(:ios).version).to be == '14.5'
84
+ elsif SimCtl::Xcode::Version.gte?('11.4')
81
85
  expect(SimCtl::Runtime.latest(:ios).version).to be == '13.4'
82
86
  elsif SimCtl::Xcode::Version.gte?('11.3')
83
87
  expect(SimCtl::Runtime.latest(:ios).version).to be == '13.3'
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe SimCtl do
4
4
  it 'executes example code from readme' do
5
- # Select the iOS 12.1 runtime
6
- runtime = SimCtl.runtime(name: 'iOS 12.1')
5
+ # Select the iOS 15.2 runtime
6
+ runtime = SimCtl.runtime(name: 'iOS 15.2')
7
7
 
8
- # Select the iPhone 6 device type
9
- devicetype = SimCtl.devicetype(name: 'iPhone 6')
8
+ # Select the iPhone 8 device type
9
+ devicetype = SimCtl.devicetype(name: 'iPhone 8')
10
10
 
11
11
  # Create a new device
12
- device = SimCtl.create_device 'Unit Tests @ iPhone 6 - 12.1', devicetype, runtime
12
+ device = SimCtl.create_device 'Unit Tests @ iPhone 8 - 15.2', devicetype, runtime
13
13
 
14
14
  # Boot the device
15
15
  device.boot
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  RSpec.describe SimCtl do
4
4
  describe '#upgrade' do
5
5
  it 'upgrades a device to a newer runtime' do
6
- old_runtime = SimCtl.runtime(name: 'iOS 12.1')
7
- new_runtime = SimCtl.runtime(name: 'iOS 12.4')
8
- device = SimCtl.reset_device 'iPhone 7', SimCtl.devicetype(name: 'iPhone 7'), old_runtime
6
+ old_runtime = SimCtl.runtime(name: 'iOS 15.2')
7
+ new_runtime = SimCtl.runtime(name: 'iOS 15.2')
8
+ device = SimCtl.reset_device 'iPhone 8', SimCtl.devicetype(name: 'iPhone 8'), old_runtime
9
9
  expect(device.runtime.version).to be == old_runtime.version
10
10
  SimCtl.upgrade device, new_runtime
11
11
  device.wait { |d| d.runtime.version == new_runtime.version }
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  RSpec.describe SimCtl do
4
4
  describe '#warmup' do
5
5
  it 'warms up and returns a device for given strings' do
6
- SimCtl.reset_device 'iPhone 6', SimCtl.devicetype(name: 'iPhone 6'), SimCtl.runtime(name: 'iOS 12.1')
7
- expect(SimCtl.warmup('iPhone 6', 'iOS 12.1')).to be_kind_of SimCtl::Device
6
+ SimCtl.reset_device 'iPhone 8', SimCtl.devicetype(name: 'iPhone 8'), SimCtl.runtime(name: 'iOS 15.2')
7
+ expect(SimCtl.warmup('iPhone 8', 'iOS 15.2')).to be_kind_of SimCtl::Device
8
8
  end
9
9
 
10
10
  it 'warms up and returns a device for given objects' do
data/spec/spec_helper.rb CHANGED
@@ -9,12 +9,7 @@ Coveralls.wear!
9
9
  $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
10
10
  require File.dirname(__FILE__) + '/../lib/simctl.rb'
11
11
 
12
- SimCtl.default_timeout = if ENV['TRAVIS']
13
- 300
14
- else
15
- 60
16
- end
17
-
12
+ SimCtl.default_timeout = 300
18
13
  SimCtl.device_set_path = Dir.mktmpdir 'foo bar' if ENV['CUSTOM_DEVICE_SET_PATH']
19
14
 
20
15
  RSpec.configure do |config|
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.8
4
+ version: 1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Plunien
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-07 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".coveralls.yml"
119
+ - ".github/workflows/test.yml"
119
120
  - ".gitignore"
120
121
  - ".rubocop.yml"
121
122
  - ".rubocop_todo.yml"
@@ -149,6 +150,7 @@ files:
149
150
  - lib/simctl/command/erase.rb
150
151
  - lib/simctl/command/install.rb
151
152
  - lib/simctl/command/io.rb
153
+ - lib/simctl/command/keychain.rb
152
154
  - lib/simctl/command/kill.rb
153
155
  - lib/simctl/command/launch.rb
154
156
  - lib/simctl/command/list.rb
@@ -170,6 +172,7 @@ files:
170
172
  - lib/simctl/device_settings.rb
171
173
  - lib/simctl/device_type.rb
172
174
  - lib/simctl/executor.rb
175
+ - lib/simctl/keychain.rb
173
176
  - lib/simctl/list.rb
174
177
  - lib/simctl/object.rb
175
178
  - lib/simctl/runtime.rb
@@ -196,7 +199,7 @@ homepage: https://github.com/plu/simctl
196
199
  licenses:
197
200
  - MIT
198
201
  metadata: {}
199
- post_install_message:
202
+ post_install_message:
200
203
  rdoc_options: []
201
204
  require_paths:
202
205
  - lib
@@ -211,8 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
214
  - !ruby/object:Gem::Version
212
215
  version: '0'
213
216
  requirements: []
214
- rubygems_version: 3.0.3
215
- signing_key:
217
+ rubygems_version: 3.2.22
218
+ signing_key:
216
219
  specification_version: 4
217
220
  summary: Ruby interface to xcrun simctl
218
221
  test_files: