run_loop 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = '1.4.1'
2
+ VERSION = '1.5.0'
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -84,6 +84,10 @@ module RunLoop
84
84
  str
85
85
  end
86
86
 
87
+ def inspect
88
+ "#<Version #{to_s}>"
89
+ end
90
+
87
91
  # Compare this version to another for equality.
88
92
  # @param [Version] other the version to compare against
89
93
  # @return [Boolean] true if this Version is the same as `other`
@@ -0,0 +1,228 @@
1
+ require 'open3'
2
+
3
+ module RunLoop
4
+
5
+ # A model of the active Xcode version.
6
+ #
7
+ # @note All command line tools are run in the context of `xcrun`.
8
+ #
9
+ # Throughout this class's documentation, there are references to the
10
+ # _active version of Xcode_. The active Xcode version is the one returned
11
+ # by `xcrun xcodebuild`. The current Xcode version can be set using
12
+ # `xcode-select` or overridden using the `DEVELOPER_DIR`.
13
+ class Xcode
14
+
15
+ include RunLoop::Regex
16
+
17
+ # Returns a String representation.
18
+ def to_s
19
+ "#<Xcode #{version.to_s}>"
20
+ end
21
+
22
+ # Returns debug String representation
23
+ def inspect
24
+ to_s
25
+ end
26
+
27
+ # Returns a version instance for `Xcode 7.0`; used to check for the
28
+ # availability of features and paths to various items on the filesystem.
29
+ #
30
+ # @return [RunLoop::Version] 7.0
31
+ def v70
32
+ fetch_version(:v70)
33
+ end
34
+
35
+ # Returns a version instance for `Xcode 6.4`; used to check for the
36
+ # availability of features and paths to various items on the filesystem.
37
+ #
38
+ # @return [RunLoop::Version] 6.4
39
+ def v64
40
+ fetch_version(:v64)
41
+ end
42
+
43
+ # Returns a version instance for `Xcode 6.3`; used to check for the
44
+ # availability of features and paths to various items on the filesystem.
45
+ #
46
+ # @return [RunLoop::Version] 6.3
47
+ def v63
48
+ fetch_version(:v63)
49
+ end
50
+
51
+ # Returns a version instance for `Xcode 6.2`; used to check for the
52
+ # availability of features and paths to various items on the filesystem.
53
+ #
54
+ # @return [RunLoop::Version] 6.2
55
+ def v62
56
+ fetch_version(:v62)
57
+ end
58
+
59
+ # Returns a version instance for `Xcode 6.1`; used to check for the
60
+ # availability of features and paths to various items on the filesystem.
61
+ #
62
+ # @return [RunLoop::Version] 6.1
63
+ def v61
64
+ fetch_version(:v61)
65
+ end
66
+
67
+ # Returns a version instance for `Xcode 6.0`; used to check for the
68
+ # availability of features and paths to various items on the filesystem.
69
+ #
70
+ # @return [RunLoop::Version] 6.0
71
+ def v60
72
+ fetch_version(:v60)
73
+ end
74
+
75
+ # Returns a version instance for `Xcode 5.1`; used to check for the
76
+ # availability of features and paths to various items on the filesystem.
77
+ #
78
+ # @return [RunLoop::Version] 5.1
79
+ def v51
80
+ fetch_version(:v51)
81
+ end
82
+
83
+ # Returns a version instance for `Xcode 5.0`; used to check for the
84
+ # availability of features and paths to various items on the filesystem.
85
+ #
86
+ # @return [RunLoop::Version] 5.0
87
+ def v50
88
+ fetch_version(:v50)
89
+ end
90
+
91
+ # Is the active Xcode version 7 or above?
92
+ #
93
+ # @return [Boolean] `true` if the current Xcode version is >= 7.0
94
+ def version_gte_7?
95
+ version >= v70
96
+ end
97
+
98
+ # Is the active Xcode version 6.4 or above?
99
+ #
100
+ # @return [Boolean] `true` if the current Xcode version is >= 6.4
101
+ def version_gte_64?
102
+ version >= v64
103
+ end
104
+
105
+ # Is the active Xcode version 6.3 or above?
106
+ #
107
+ # @return [Boolean] `true` if the current Xcode version is >= 6.3
108
+ def version_gte_63?
109
+ version >= v63
110
+ end
111
+
112
+ # Is the active Xcode version 6.2 or above?
113
+ #
114
+ # @return [Boolean] `true` if the current Xcode version is >= 6.2
115
+ def version_gte_62?
116
+ version >= v62
117
+ end
118
+
119
+ # Is the active Xcode version 6.1 or above?
120
+ #
121
+ # @return [Boolean] `true` if the current Xcode version is >= 6.1
122
+ def version_gte_61?
123
+ version >= v61
124
+ end
125
+
126
+ # Is the active Xcode version 6 or above?
127
+ #
128
+ # @return [Boolean] `true` if the current Xcode version is >= 6.0
129
+ def version_gte_6?
130
+ version >= v60
131
+ end
132
+
133
+ # Is the active Xcode version 5.1 or above?
134
+ #
135
+ # @return [Boolean] `true` if the current Xcode version is >= 5.1
136
+ def version_gte_51?
137
+ version >= v51
138
+ end
139
+
140
+ # Returns the current version of Xcode.
141
+ #
142
+ # @return [RunLoop::Version] The current version of Xcode as reported by
143
+ # `xcrun xcodebuild -version`.
144
+ def version
145
+ @xcode_version ||= lambda do
146
+ execute_command(['-version']) do |stdout, _, _|
147
+ version_string = stdout.read.chomp[VERSION_REGEX, 0]
148
+ RunLoop::Version.new(version_string)
149
+ end
150
+ end.call
151
+ end
152
+
153
+ # Is this a beta version of Xcode?
154
+ #
155
+ # @note Relies on Xcode beta versions having and app bundle named Xcode-Beta.app
156
+ # @return [Boolean] True if the Xcode version is beta.
157
+ def beta?
158
+ developer_dir[/Xcode-[Bb]eta.app/, 0]
159
+ end
160
+
161
+ # Returns the path to the current developer directory.
162
+ #
163
+ # From the man pages:
164
+ #
165
+ # ```
166
+ # $ man xcode-select
167
+ # DEVELOPER_DIR
168
+ # Overrides the active developer directory. When DEVELOPER_DIR is set,
169
+ # its value will be used instead of the system-wide active developer
170
+ # directory.
171
+ #```
172
+ #
173
+ # @return [String] path to current developer directory
174
+ def developer_dir
175
+ @xcode_developer_dir ||=
176
+ if RunLoop::Environment.developer_dir
177
+ RunLoop::Environment.developer_dir
178
+ else
179
+ xcode_select_path
180
+ end
181
+ end
182
+
183
+ private
184
+
185
+ attr_reader :xcode_versions
186
+
187
+ def xcode_versions
188
+ @xcode_versions ||= {}
189
+ end
190
+
191
+ def fetch_version(key)
192
+ ensure_valid_version_key key
193
+ value = xcode_versions[key]
194
+
195
+ return value if value
196
+
197
+ string = key.to_s
198
+ string[0] = ''
199
+ version_string = string.split(/(?!^)/).join('.')
200
+ version = RunLoop::Version.new(version_string)
201
+ xcode_versions[key] = version
202
+ version
203
+ end
204
+
205
+ def ensure_valid_version_key(key)
206
+ string = key.to_s
207
+ if string.length != 3
208
+ raise "Expected version key '#{key}' to have exactly 3 characters"
209
+ end
210
+
211
+ unless string[/v\d{2}/, 0]
212
+ raise "Expected version key '#{key}' to match vXX pattern"
213
+ end
214
+ end
215
+
216
+ def execute_command(args)
217
+ Open3.popen3('xcrun', 'xcodebuild', *args) do |_, stdout, stderr, wait_thr|
218
+ yield stdout, stderr, wait_thr
219
+ end
220
+ end
221
+
222
+ def xcode_select_path
223
+ Open3.popen3('xcode-select', '--print-path') do |_, stdout, _, _|
224
+ stdout.read.chomp
225
+ end
226
+ end
227
+ end
228
+ end
@@ -3,6 +3,13 @@ require 'retriable'
3
3
 
4
4
  module RunLoop
5
5
 
6
+ # @deprecated Since 1.5.0
7
+ #
8
+ # The behaviors of this class are in the process of being refactored to other
9
+ # classes. Please do not implement any new behaviors in this class.
10
+ #
11
+ # Callers should be updated ASAP.
12
+ #
6
13
  # A class for interacting with the Xcode tools.
7
14
  #
8
15
  # @note All command line tools are run in the context of `xcrun`.
@@ -15,130 +22,160 @@ module RunLoop
15
22
  # @todo Refactor instruments related code to instruments class.
16
23
  class XCTools
17
24
 
25
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
18
26
  # Returns a version instance for `Xcode 7.0`; used to check for the
19
27
  # availability of features and paths to various items on the filesystem.
20
28
  #
21
29
  # @return [RunLoop::Version] 7.0
22
30
  def v70
23
- @xc70 ||= RunLoop::Version.new('7.0')
31
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
32
+ xcode.v70
24
33
  end
25
34
 
35
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
26
36
  # Returns a version instance for `Xcode 6.4`; used to check for the
27
37
  # availability of features and paths to various items on the filesystem.
28
38
  #
29
- # @return [RunLoop::Version] 6.3
39
+ # @return [RunLoop::Version] 6.4
30
40
  def v64
31
- @xc64 ||= RunLoop::Version.new('6.4')
41
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
42
+ xcode.v64
32
43
  end
33
44
 
45
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
34
46
  # Returns a version instance for `Xcode 6.3`; used to check for the
35
47
  # availability of features and paths to various items on the filesystem.
36
48
  #
37
49
  # @return [RunLoop::Version] 6.3
38
50
  def v63
39
- @xc63 ||= RunLoop::Version.new('6.3')
51
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
52
+ xcode.v63
40
53
  end
41
54
 
55
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
42
56
  # Returns a version instance for `Xcode 6.2`; used to check for the
43
57
  # availability of features and paths to various items on the filesystem.
44
58
  #
45
59
  # @return [RunLoop::Version] 6.2
46
60
  def v62
47
- @xc62 ||= RunLoop::Version.new('6.2')
61
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
62
+ xcode.v62
48
63
  end
49
64
 
65
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
50
66
  # Returns a version instance for `Xcode 6.1`; used to check for the
51
67
  # availability of features and paths to various items on the filesystem.
52
68
  #
53
69
  # @return [RunLoop::Version] 6.1
54
70
  def v61
55
- @xc61 ||= RunLoop::Version.new('6.1')
71
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
72
+ xcode.v61
56
73
  end
57
74
 
75
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
58
76
  # Returns a version instance for `Xcode 6.0`; used to check for the
59
77
  # availability of features and paths to various items on the filesystem.
60
78
  #
61
79
  # @return [RunLoop::Version] 6.0
62
80
  def v60
63
- @xc60 ||= RunLoop::Version.new('6.0')
81
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
82
+ xcode.v60
64
83
  end
65
84
 
85
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
66
86
  # Returns a version instance for `Xcode 5.1`; used to check for the
67
87
  # availability of features and paths to various items on the filesystem.
68
88
  #
69
89
  # @return [RunLoop::Version] 5.1
70
90
  def v51
71
- @xc51 ||= RunLoop::Version.new('5.1')
91
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
92
+ xcode.v51
72
93
  end
73
94
 
74
- # Returns a version instance for `Xcode 5.0`; ; used to check for the
95
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
96
+ # Returns a version instance for `Xcode 5.0`; used to check for the
75
97
  # availability of features and paths to various items on the filesystem.
76
98
  #
77
99
  # @return [RunLoop::Version] 5.0
78
100
  def v50
79
- @xc50 ||= RunLoop::Version.new('5.0')
101
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
102
+ xcode.v50
80
103
  end
81
104
 
105
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
82
106
  # Are we running Xcode 6.4 or above?
83
107
  #
84
108
  # @return [Boolean] `true` if the current Xcode version is >= 6.4
85
109
  def xcode_version_gte_64?
86
- @xcode_gte_64 ||= xcode_version >= v64
110
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
111
+ xcode.version_gte_64?
87
112
  end
88
113
 
114
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
89
115
  # Are we running Xcode 6.3 or above?
90
116
  #
91
117
  # @return [Boolean] `true` if the current Xcode version is >= 6.3
92
118
  def xcode_version_gte_63?
93
- @xcode_gte_63 ||= xcode_version >= v63
119
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
120
+ xcode.version_gte_63?
94
121
  end
95
122
 
123
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
96
124
  # Are we running Xcode 6.2 or above?
97
125
  #
98
126
  # @return [Boolean] `true` if the current Xcode version is >= 6.2
99
127
  def xcode_version_gte_62?
100
- @xcode_gte_62 ||= xcode_version >= v62
128
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
129
+ xcode.version_gte_62?
101
130
  end
102
131
 
132
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
103
133
  # Are we running Xcode 6.1 or above?
104
134
  #
105
135
  # @return [Boolean] `true` if the current Xcode version is >= 6.1
106
136
  def xcode_version_gte_61?
107
- @xcode_gte_61 ||= xcode_version >= v61
137
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
138
+ xcode.version_gte_61?
108
139
  end
109
140
 
141
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
110
142
  # Are we running Xcode 6 or above?
111
143
  #
112
144
  # @return [Boolean] `true` if the current Xcode version is >= 6.0
113
145
  def xcode_version_gte_6?
114
- @xcode_gte_6 ||= xcode_version >= v60
146
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
147
+ xcode.version_gte_6?
115
148
  end
116
149
 
150
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
117
151
  # Are we running Xcode 7 or above?
118
152
  #
119
153
  # @return [Boolean] `true` if the current Xcode version is >= 7.0
120
154
  def xcode_version_gte_7?
121
- @xcode_gte_7 ||= xcode_version >= v70
155
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
156
+ xcode.version_gte_7?
122
157
  end
123
158
 
159
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
124
160
  # Are we running Xcode 5.1 or above?
125
161
  #
126
162
  # @return [Boolean] `true` if the current Xcode version is >= 5.1
127
163
  def xcode_version_gte_51?
128
- @xcode_gte_51 ||= xcode_version >= v51
164
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
165
+ xcode.version_gte_51?
129
166
  end
130
167
 
168
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
131
169
  # Returns the current version of Xcode.
132
170
  #
133
171
  # @return [RunLoop::Version] The current version of Xcode as reported by
134
172
  # `xcrun xcodebuild -version`.
135
173
  def xcode_version
136
- @xcode_version ||= lambda {
137
- xcode_build_output = `xcrun xcodebuild -version`.split(/\s/)[1]
138
- RunLoop::Version.new(xcode_build_output)
139
- }.call
174
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
175
+ xcode.version
140
176
  end
141
177
 
178
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
142
179
  # Returns the path to the current developer directory.
143
180
  #
144
181
  # From the man pages:
@@ -153,25 +190,38 @@ module RunLoop
153
190
  #
154
191
  # @return [String] path to current developer directory
155
192
  def xcode_developer_dir
156
- @xcode_developer_dir ||=
157
- if RunLoop::Environment.developer_dir
158
- RunLoop::Environment.developer_dir
159
- else
160
- # fall back to xcode-select
161
- `xcode-select --print-path`.chomp
162
- end
193
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
194
+ xcode.developer_dir
163
195
  end
164
196
 
197
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Xcode
165
198
  # Is this a beta version of Xcode?
166
199
  #
167
200
  # @note Relies on Xcode beta versions having and app bundle named Xcode-Beta.app
168
201
  # @return [Boolean] True if the Xcode version is beta.
169
202
  def xcode_is_beta?
170
- @xcode_is_beta ||= lambda {
171
- (xcode_developer_dir =~ /Xcode-[Bb]eta.app/) != nil
172
- }.call
203
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
204
+ xcode.beta?
173
205
  end
174
206
 
207
+ alias_method :version_gte_64?, :xcode_version_gte_64?
208
+ alias_method :version_gte_63?, :xcode_version_gte_63?
209
+ alias_method :version_gte_62?, :xcode_version_gte_62?
210
+ alias_method :version_gte_61?, :xcode_version_gte_61?
211
+ alias_method :version_gte_6?, :xcode_version_gte_6?
212
+ alias_method :version_gte_7?, :xcode_version_gte_7?
213
+ alias_method :version_gte_51?, :xcode_version_gte_51?
214
+ alias_method :version, :xcode_version
215
+ alias_method :developer_dir, :xcode_developer_dir
216
+ alias_method :beta?, :xcode_is_beta?
217
+
218
+ # @deprecated Since 1.5.0 - replaced with RunLoop::Instruments.
219
+ #
220
+ # @see {RunLoop::Instruments#version}
221
+ # @see {RunLoop::Instruments#templates}
222
+ # @see {RunLoop::Instruments#physical_devices}
223
+ # @see {RunLoop::Instruments#simulators}
224
+ #
175
225
  # Method for interacting with instruments.
176
226
  #
177
227
  # @example Getting a runnable command for instruments
@@ -193,83 +243,29 @@ module RunLoop
193
243
  # instruments binary.
194
244
  # @raise [ArgumentError] if invalid `cmd` is passed
195
245
  def instruments(cmd=nil)
246
+ RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Instruments')
196
247
  instruments = 'xcrun instruments'
197
248
  return instruments if cmd == nil
198
249
 
199
- # Xcode 6 GM is spamming "WebKit Threading Violations"
200
- stderr_filter = lambda { |stderr|
201
- stderr.read.strip.split("\n").each do |line|
202
- unless line[/WebKit Threading Violation/, 0]
203
- $stderr.puts line
204
- end
205
- end
206
- }
207
250
  case cmd
208
251
  when :version
209
- @instruments_version ||= lambda {
210
- # Xcode 6 can print out some very strange output, so we have to retry.
211
- Retriable.retriable({:tries => 5}) do
212
- Open3.popen3("#{instruments}") do |_, _, stderr, _|
213
- version_str = stderr.read.chomp.split(/\s/)[2]
214
- RunLoop::Version.new(version_str)
215
- end
216
- end
217
- }.call
252
+ instruments_instance.version
218
253
  when :sims
219
- @instruments_sims ||= lambda {
220
- # Instruments 6 spams a lot of error messages. I don't like to
221
- # hide them, but they seem to be around to stay (Xcode 6 GM).
222
- cmd = "#{instruments} -s devices"
223
- Open3.popen3(cmd) do |_, stdout, stderr, _|
224
- stderr_filter.call(stderr)
225
- devices = stdout.read.chomp.split("\n")
226
- devices.select { |device| device.downcase.include?('simulator') }
227
- end
228
- }.call
229
-
254
+ instruments_instance.simulators
230
255
  when :templates
231
- @instruments_templates ||= lambda {
232
- cmd = "#{instruments} -s templates"
233
- if self.xcode_version >= self.v60
234
- Open3.popen3(cmd) do |_, stdout, stderr, _|
235
- stderr_filter.call(stderr)
236
- stdout.read.chomp.split("\n").map { |elm| elm.strip.tr('"', '') }
237
- end
238
- elsif self.xcode_version >= self.v51
239
- `#{cmd}`.split("\n").delete_if do |path|
240
- not path =~ /tracetemplate/
241
- end.map { |elm| elm.strip }
242
- else
243
- # prints to $stderr (>_>) - seriously?
244
- Open3.popen3(cmd) do |_, _, stderr, _|
245
- stderr.read.chomp.split(/(,|\(|")/).map do |elm|
246
- elm.strip
247
- end.delete_if { |path| not path =~ /tracetemplate/ }
248
- end
249
- end
250
- }.call
251
-
256
+ instruments_instance.templates
252
257
  when :devices
253
- @devices ||= lambda {
254
- cmd = "#{instruments} -s devices"
255
- Open3.popen3(cmd) do |_, stdout, stderr, _|
256
- stderr_filter.call(stderr)
257
- all = stdout.read.chomp.split("\n")
258
- valid = all.select { |device| device =~ /[a-f0-9]{40}/ }
259
- valid.map do |device|
260
- udid = device[/[a-f0-9]{40}/, 0]
261
- version = device[/(\d\.\d(\.\d)?)/, 0]
262
- name = device.split('(').first.strip
263
- RunLoop::Device.new(name, version, udid)
264
- end
265
- end
266
- }.call
258
+ instruments_instance.physical_devices
267
259
  else
268
260
  candidates = [:version, :sims, :devices]
269
261
  raise(ArgumentError, "expected '#{cmd}' to be one of '#{candidates}'")
270
262
  end
271
263
  end
272
264
 
265
+ # @deprecated Since 1.5.0 - no replacement.
266
+ #
267
+ # All supported Xcode versions accept -s flag.
268
+ #
273
269
  # Does the instruments `version` accept the -s flag?
274
270
  #
275
271
  # @example
@@ -282,6 +278,7 @@ module RunLoop
282
278
  #
283
279
  # @return [Boolean] true if the version is >= 5.*
284
280
  def instruments_supports_hyphen_s?(version=instruments(:version))
281
+ RunLoop.deprecated('1.5.0', 'Not replaced.')
285
282
  @instruments_supports_hyphen_s ||= lambda {
286
283
  if version.is_a? String
287
284
  _version = RunLoop::Version.new(version)
@@ -291,5 +288,23 @@ module RunLoop
291
288
  _version >= RunLoop::Version.new('5.1')
292
289
  }.call
293
290
  end
291
+
292
+ private
293
+
294
+ # @!visibility private
295
+ attr_reader :xcode
296
+
297
+ # @!visibility private
298
+ def xcode
299
+ @xcode ||= RunLoop::Xcode.new
300
+ end
301
+
302
+ # @!visibility private
303
+ attr_reader :instruments_instance
304
+
305
+ # @!visibility private
306
+ def instruments_instance
307
+ @instruments_instance ||= RunLoop::Instruments.new
308
+ end
294
309
  end
295
310
  end
data/lib/run_loop.rb CHANGED
@@ -1,6 +1,9 @@
1
+ require 'run_loop/regex'
1
2
  require 'run_loop/directory'
2
3
  require 'run_loop/environment'
3
4
  require 'run_loop/logging'
5
+ require 'run_loop/xcode'
6
+ require 'run_loop/l10n'
4
7
  require 'run_loop/process_terminator'
5
8
  require 'run_loop/process_waiter'
6
9
  require 'run_loop/lldb'
@@ -25,6 +28,25 @@ require 'run_loop/simctl/plists'
25
28
 
26
29
  module RunLoop
27
30
 
31
+ # Prints a deprecated message that includes the line number.
32
+ #
33
+ # @param [String] version Indicates when the feature was deprecated.
34
+ # @param [String] msg Deprecation message (possibly suggesting alternatives)
35
+ # @return [void]
36
+ def self.deprecated(version, msg)
37
+
38
+ if RUBY_VERSION < '2.0'
39
+ stack = Kernel.caller[1..6].join("\n")
40
+ else
41
+ stack = Kernel.caller(0, 6)[1..-1].join("\n")
42
+ end
43
+
44
+ msg = "deprecated '#{version}' - #{msg}\n#{stack}"
45
+
46
+ $stderr.puts "\033[34mWARN: #{msg}\033[0m"
47
+ $stderr.flush
48
+ end
49
+
28
50
  class TimeoutError < RuntimeError
29
51
  end
30
52
 
@@ -206,7 +206,13 @@ function isLocationPrompt(alert) {
206
206
  ["OK", /Would Like to Access Your Photos/],
207
207
  ["OK", /Would Like to Access Your Contacts/],
208
208
  ["OK", /Location Accuracy/],
209
- ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/]
209
+ ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/],
210
+ ["OK", /Access the Microphone/],
211
+ ["OK", /enviarle notificaiones/],
212
+ ["OK", /Would Like to Access Your Calendar/],
213
+ ["OK", /Would Like to Access Your Reminders/],
214
+ ["OK", /Would Like to Access Your Motion Activity/],
215
+ ["OK", /Would Like to Access the Camera/]
210
216
  ],
211
217
  ans, exp,
212
218
  txt;
@@ -224,7 +224,13 @@ function isLocationPrompt(alert) {
224
224
  ["OK", /Would Like to Access Your Photos/],
225
225
  ["OK", /Would Like to Access Your Contacts/],
226
226
  ["OK", /Location Accuracy/],
227
- ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/]
227
+ ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/],
228
+ ["OK", /Access the Microphone/],
229
+ ["OK", /enviarle notificaiones/],
230
+ ["OK", /Would Like to Access Your Calendar/],
231
+ ["OK", /Would Like to Access Your Reminders/],
232
+ ["OK", /Would Like to Access Your Motion Activity/],
233
+ ["OK", /Would Like to Access the Camera/]
228
234
  ],
229
235
  ans, exp,
230
236
  txt;
@@ -326,4 +332,4 @@ while (true) {
326
332
  Log.result("success", _result);
327
333
  target.delay(0.1);
328
334
  }
329
- }
335
+ }