run_loop 2.1.1.pre4 → 2.1.1.pre5

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: 8a58fe1295ca175dc597c3519289a362e94e3575
4
- data.tar.gz: 190e2c88f05f9f849ec7214ca52b0657abfcb57c
3
+ metadata.gz: 5b472cf66aac006dfd7b64d604f69b2c1ba31e79
4
+ data.tar.gz: e3d19559460c6e3b9c9e584f03e7a1917b0dad6a
5
5
  SHA512:
6
- metadata.gz: 787e8c752f4bc06d49e765e8c442eae0d47a60867fc3db85e0e39aef515c1a7fb4c568db743f4dfe968cd053c008107368bc9d1f8ecf9324b90107daf84c2911
7
- data.tar.gz: 89dcc0de4027a620362d6e5e772719e7d30ca2b9335e6f2b832b9bccdffb04d5974fc91e4d91ec5722debb3834d8c160db16648679b4845570d73c2a5aaac7f1
6
+ metadata.gz: 49b295e9fc5e50857ff4ed8e68f678b849f7996d6348d1d192f42b6ee295bf442157d85429b18b1eac582e01fd373e4661b7e606a30da00328efaf7e20986df8
7
+ data.tar.gz: b82c8b081d6ba5c9adbc2203e5807cacdaf807dcec476fca6b263b792b9e2ff27fa9e55db95f5545f6ba8afdff06c27878538e9fdba9ae6d025ff914c729bd8e
data/lib/run_loop.rb CHANGED
@@ -127,6 +127,10 @@ Please quit the Instruments.app and try again.)
127
127
  cloned_options[:sim_control] = options[:sim_control]
128
128
  end
129
129
 
130
+ if options[:simctl]
131
+ cloned_options[:simctl] = options[:simctl]
132
+ end
133
+
130
134
  Core.run_with_options(cloned_options)
131
135
  end
132
136
  end
@@ -6,7 +6,7 @@ module RunLoop
6
6
  module CLI
7
7
  class Simctl < Thor
8
8
 
9
- attr_reader :sim_control
9
+ attr_reader :simctl
10
10
 
11
11
  desc 'tail', 'Tail the log file of the booted simulator'
12
12
  def tail
@@ -17,7 +17,7 @@ module RunLoop
17
17
  def tail_booted
18
18
  device = booted_device
19
19
  if device.nil?
20
- version = Xcode.new.version
20
+ version = xcode.version
21
21
  puts "No simulator for active Xcode (version #{version}) is booted."
22
22
  else
23
23
  log_file = device.simulator_log_file_path
@@ -30,7 +30,7 @@ module RunLoop
30
30
  def booted
31
31
  device = booted_device
32
32
  if device.nil?
33
- version = Xcode.new.version
33
+ version = xcode.version
34
34
  puts "No simulator for active Xcode (version #{version}) is booted."
35
35
  else
36
36
  puts device
@@ -73,7 +73,7 @@ module RunLoop
73
73
 
74
74
  no_commands do
75
75
  def erase_and_launch_each_simulator
76
- sim_control.simulators.each do |simulator|
76
+ simctl.simulators.each do |simulator|
77
77
  RunLoop::CoreSimulator.erase(simulator)
78
78
  launch_simulator(simulator, xcode)
79
79
  end
@@ -81,7 +81,7 @@ module RunLoop
81
81
 
82
82
  def launch_simulator(simulator, xcode)
83
83
  core_sim = RunLoop::CoreSimulator.new(simulator, nil,
84
- {:xcode => xcode})
84
+ {:xcode => xcode})
85
85
  core_sim.launch_simulator
86
86
  end
87
87
  end
@@ -114,8 +114,8 @@ module RunLoop
114
114
  end
115
115
 
116
116
  no_commands do
117
- def sim_control
118
- @sim_control ||= RunLoop::SimControl.new
117
+ def simctl
118
+ @simctl ||= RunLoop::Simctl.new
119
119
  end
120
120
 
121
121
  def xcode
@@ -127,7 +127,7 @@ module RunLoop
127
127
  end
128
128
 
129
129
  def booted_device
130
- sim_control.simulators.detect(nil) do |device|
130
+ simctl.simulators.detect(nil) do |device|
131
131
  device.state == 'Booted'
132
132
  end
133
133
  end
@@ -192,7 +192,7 @@ module RunLoop
192
192
  no_commands do
193
193
  def expect_device(options)
194
194
  device_from_options = options[:device]
195
- simulators = sim_control.simulators
195
+ simulators = simctl.simulators
196
196
  if device_from_options.nil?
197
197
  default_name = RunLoop::Core.default_simulator
198
198
  device = simulators.find do |sim|
data/lib/run_loop/core.rb CHANGED
@@ -63,12 +63,12 @@ module RunLoop
63
63
  self.prepare(options)
64
64
 
65
65
  logger = options[:logger]
66
- sim_control = options[:sim_control] || options[:simctl] || RunLoop::SimControl.new
66
+ simctl = options[:sim_control] || options[:simctl] || RunLoop::Simctl.new
67
67
  xcode = options[:xcode] || RunLoop::Xcode.new
68
68
  instruments = options[:instruments] || RunLoop::Instruments.new
69
69
 
70
70
  # Find the Device under test, the App under test, UIA strategy, and reset options
71
- device = RunLoop::Device.detect_device(options, xcode, sim_control, instruments)
71
+ device = RunLoop::Device.detect_device(options, xcode, simctl, instruments)
72
72
  app_details = RunLoop::DetectAUT.detect_app_under_test(options)
73
73
  uia_strategy = self.detect_uia_strategy(options, device, xcode)
74
74
  reset_options = self.detect_reset_options(options)
@@ -142,7 +142,7 @@ module RunLoop
142
142
  merged_options = options.merge(discovered_options)
143
143
 
144
144
  if device.simulator?
145
- self.prepare_simulator(app_details[:app], device, xcode, sim_control, reset_options)
145
+ self.prepare_simulator(app_details[:app], device, xcode, simctl, reset_options)
146
146
  end
147
147
 
148
148
  self.log_run_loop_options(merged_options, xcode)
@@ -552,9 +552,9 @@ Logfile: #{log_file}
552
552
  return false if value[DEVICE_UDID_REGEX, 0] != nil
553
553
 
554
554
  # Check for named simulators and Xcode >= 7.0 simulators.
555
- sim_control = run_options[:sim_control] || RunLoop::SimControl.new
556
- xcode = sim_control.xcode
557
- simulator = sim_control.simulators.find do |sim|
555
+ simctl = run_options[:sim_control] || run_options[:simctl] || RunLoop::Simctl.new
556
+ xcode = run_options[:xcode] || RunLoop::Xcode.new
557
+ simulator = simctl.simulators.find do |sim|
558
558
  [
559
559
  sim.instruments_identifier(xcode) == value,
560
560
  sim.udid == value,
@@ -568,9 +568,9 @@ Logfile: #{log_file}
568
568
  # @deprecated 2.1.0
569
569
  #
570
570
  # Do not call this method.
571
- def self.udid_and_bundle_for_launcher(device_target, options, sim_control=RunLoop::SimControl.new)
571
+ def self.udid_and_bundle_for_launcher(device_target, options, simctl=RunLoop::Simctl.new)
572
572
  RunLoop.deprecated("2.1.0", "No replacement")
573
- xcode = sim_control.xcode
573
+ xcode = RunLoop::Xcode.new
574
574
 
575
575
  bundle_dir_or_bundle_id = options[:app] || RunLoop::Environment.bundle_id || RunLoop::Environment.path_to_app_bundle
576
576
 
@@ -82,36 +82,34 @@ module RunLoop
82
82
  # are looking for.
83
83
  # @param [Hash] options Allows callers to pass runtime models that might
84
84
  # optimize performance (via memoization).
85
- # @option options [RunLoop::SimControl] :sim_control An instance of
86
- # SimControl.
85
+ # @option options [RunLoop::Simctl] :simctl An instance of
86
+ # Simctl.
87
87
  # @option options [RunLoop::Instruments] :instruments An instance of
88
88
  # Instruments.
89
+ # @option options [RunLoop::Xcode] :xcode An instance of Xcode
89
90
  #
90
91
  # @return [RunLoop::Device] A device that matches `udid_or_name`.
91
92
  # @raise [ArgumentError] If no matching device can be found.
92
93
  def self.device_with_identifier(udid_or_name, options={})
93
94
  if options.is_a?(RunLoop::SimControl)
94
- RunLoop.deprecated('1.5.0', %q(
95
- The 'sim_control' argument has been deprecated. It has been replaced by an
96
- options hash with two keys: :sim_control and :instruments.
97
- Please update your sources.))
98
- merged_options = {
99
- :sim_control => options,
100
- :instruments => RunLoop::Instruments.new
101
- }
102
- else
103
- default_options = {
104
- :sim_control => RunLoop::SimControl.new,
105
- :instruments => RunLoop::Instruments.new
106
- }
107
- merged_options = default_options.merge(options)
95
+ raise ArgumentError, %q[Support for the 'sim_control' argument has been
96
+ removed (1.5.0). It has been replaced by an options hash with two keys:
97
+ :simctl and :instruments. Please update your sources.))]
108
98
  end
109
99
 
100
+ default_options = {
101
+ :simctl => RunLoop::Simctl.new,
102
+ :instruments => RunLoop::Instruments.new,
103
+ :xcode => RunLoop::Xcode.new
104
+ }
105
+
106
+ merged_options = default_options.merge(options)
107
+
110
108
  instruments = merged_options[:instruments]
111
- sim_control = merged_options[:sim_control]
109
+ simctl = merged_options[:simctl]
112
110
 
113
- xcode = sim_control.xcode
114
- simulator = sim_control.simulators.detect do |sim|
111
+ xcode = RunLoop::Xcode.new
112
+ simulator = simctl.simulators.detect do |sim|
115
113
  sim.instruments_identifier(xcode) == udid_or_name ||
116
114
  sim.udid == udid_or_name
117
115
  end
@@ -135,13 +133,13 @@ Please update your sources.))
135
133
  #
136
134
  # @param [Hash] options The launch options passed to RunLoop::Core
137
135
  # @param [RunLoop::Xcode] xcode An Xcode instance
138
- # @param [RunLoop::SimControl] simctl A SimControl instance
136
+ # @param [RunLoop::Simctl] simctl A SimControl instance
139
137
  # @param [RunLoop::Instruments] instruments An Instruments instance
140
138
  #
141
139
  # @raise [ArgumentError] If "device" is detected as the device target and
142
140
  # there is no matching device.
143
141
  # @raise [ArgumentError] If DEVICE_TARGET or options specify an identifier
144
- # that does not match an iOS Simulator or phyiscal device.
142
+ # that does not match an iOS Simulator or physical device.
145
143
  def self.detect_device(options, xcode, simctl, instruments)
146
144
  device = self.device_from_opts_or_env(options)
147
145
 
@@ -159,7 +157,8 @@ Please update your sources.))
159
157
  end
160
158
 
161
159
  # Raises ArgumentError if no matching device can be found.
162
- self.device_with_identifier(identifier, sim_control: simctl,
160
+ self.device_with_identifier(identifier,
161
+ simctl: simctl,
163
162
  instruments: instruments)
164
163
  end
165
164
 
@@ -185,7 +184,7 @@ Please update your sources.))
185
184
  # @return [String] An instruments-ready device identifier.
186
185
  # @raise [RuntimeError] If trying to obtain a instruments-ready identifier
187
186
  # for a simulator when Xcode < 6.
188
- def instruments_identifier(xcode=SIM_CONTROL.xcode)
187
+ def instruments_identifier(xcode)
189
188
  if physical_device?
190
189
  udid
191
190
  else
@@ -206,6 +205,17 @@ Please update your sources.))
206
205
  # Is this a physical device?
207
206
  # @return [Boolean] Returns true if this is a device.
208
207
  def physical_device?
208
+ if udid.nil?
209
+ stack = Kernel.caller(0, 6)[0..-1].join("\n")
210
+ raise RuntimeError,
211
+ %Q[udid is nil
212
+
213
+ #{stack}
214
+
215
+ name: #{name}
216
+ version: #{version}
217
+ ]
218
+ end
209
219
  !udid[DEVICE_UDID_REGEX, 0].nil?
210
220
  end
211
221
 
@@ -603,9 +613,6 @@ Please update your sources.))
603
613
  # @!visibility private
604
614
  CORE_SIMULATOR_LOGS_DIR = File.expand_path('~/Library/Logs/CoreSimulator')
605
615
 
606
- # TODO Is this a good idea? It speeds up rspec tests by a factor of ~2x...
607
- SIM_CONTROL = RunLoop::SimControl.new
608
-
609
616
  # @!visibility private
610
617
  def self.device_from_options(options)
611
618
  options[:device] || options[:device_target] || options[:udid]
@@ -86,6 +86,27 @@ module RunLoop
86
86
  end
87
87
  end
88
88
 
89
+ # @!visibility private
90
+ #
91
+ # SimControl compatibility
92
+ def ensure_accessibility(device)
93
+ sim_control.ensure_accessibility(device)
94
+ end
95
+
96
+ # @!visibility private
97
+ #
98
+ # SimControl compatibility
99
+ def ensure_software_keyboard(device)
100
+ sim_control.ensure_software_keyboard(device)
101
+ end
102
+
103
+ # @!visibility private
104
+ #
105
+ # TODO Make this private again; exposed for SimControl compatibility.
106
+ def xcode
107
+ @xcode ||= RunLoop::Xcode.new
108
+ end
109
+
89
110
  private
90
111
 
91
112
  # @!visibility private
@@ -244,11 +265,6 @@ is not an iOS, tvOS, or watchOS device"
244
265
  @xcrun ||= RunLoop::Xcrun.new
245
266
  end
246
267
 
247
- # @!visibility private
248
- def xcode
249
- @xcode ||= RunLoop::Xcode.new
250
- end
251
-
252
268
  # @!visibility private
253
269
  # Support for Xcode < 7 when trying to collect simulators. Xcode 7 allows
254
270
  # a --json option which is much easier to parse.
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.1.1.pre4"
2
+ VERSION = "2.1.1.pre5"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -16,7 +16,7 @@ module RunLoop
16
16
  # @!visibility private
17
17
  def self.run(options={})
18
18
  # logger = options[:logger]
19
- simctl = options[:sim_control] || options[:simctl] || RunLoop::SimControl.new
19
+ simctl = options[:sim_control] || options[:simctl] || RunLoop::Simctl.new
20
20
  xcode = options[:xcode] || RunLoop::Xcode.new
21
21
  instruments = options[:instruments] || RunLoop::Instruments.new
22
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1.pre4
4
+ version: 2.1.1.pre5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json