run_loop 0.0.16 → 0.0.17

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: aabb5bbbc7bf6211a9e87b46baf7457d99cb09ec
4
- data.tar.gz: eb013c7fc3fed7008ba09827dbe87aa9083c0ed1
3
+ metadata.gz: 0228cc12904b485c2498611ec2e0229bd0e37da9
4
+ data.tar.gz: 3272b5371b4eb5f0b855d73ed3f3a499ffd325fc
5
5
  SHA512:
6
- metadata.gz: f74ac8bdf22e7dd2b2f90f20c975b12e351b546d891bd287fc0848bb35ad46315452fb8d3157e6fcb0bd05c3bad557c68f2bed1575a435cb35c11a38c12b1f29
7
- data.tar.gz: 74c9a9cdba9ad1301d9e5f023cf1f221c835dfc905b5d6fb15ed585f1e8a55ef023c888f30e34502ff6fd7c96ee87ad699ba5873f5e6a3f7841e46e2a6c26388
6
+ metadata.gz: 2c75eac24772f687abd3d8667dab52064e32ce1c106f2087294bba6c3759ad4abe5c556254f5f4efa884c12a11b64f72e7727d719f45ab66318e2f3063a0f42e
7
+ data.tar.gz: 184c83415bf1613c72d42bec4691716422dbd8d9abde989d311f85b1c0d351eb3186f1102ed752aacfdc4ff5c712b5c188ce64f46e7eb6c0a713ef95fc673389
data/lib/run_loop/core.rb CHANGED
@@ -31,10 +31,11 @@ module RunLoop
31
31
  end
32
32
 
33
33
  def self.run_with_options(options)
34
+ ensure_instruments_not_running!
34
35
 
35
36
  device = options[:device] || :iphone
36
37
  udid = options[:udid]
37
- timeout = options[:timeout] || 30
38
+ timeout = options[:timeout] || 15
38
39
 
39
40
  log_file = options[:log_path]
40
41
 
@@ -258,7 +259,14 @@ module RunLoop
258
259
  cmd
259
260
  end
260
261
 
261
- def self.automation_template
262
+ def self.automation_template(candidate = ENV['TRACE_TEMPLATE'])
263
+ unless candidate && File.exist?(candidate)
264
+ candidate = default_tracetemplate
265
+ end
266
+ candidate
267
+ end
268
+
269
+ def self.default_tracetemplate
262
270
  xcode_path = `xcode-select -print-path`.chomp
263
271
  automation_bundle = File.expand_path(File.join(xcode_path, "..", 'Applications', "Instruments.app", "Contents", "PlugIns", 'AutomationInstrument.bundle'))
264
272
  if not File.exist? automation_bundle
@@ -278,6 +286,22 @@ module RunLoop
278
286
  $stdout.flush
279
287
  end
280
288
 
289
+ def self.ensure_instruments_not_running!
290
+ if instruments_running?
291
+ puts "Killing instruments"
292
+ `killall -9 instruments`
293
+ end
294
+ end
295
+
296
+ def self.instruments_running?
297
+ instruments_pids.size > 0
298
+ end
299
+
300
+ def self.instruments_pids
301
+ pids_str = `ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`.strip
302
+ pids_str.split(",").map { |pid| pid.to_i }
303
+ end
304
+
281
305
  end
282
306
 
283
307
  def self.run(options={})
@@ -1,3 +1,3 @@
1
1
  module RunLoop
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
@@ -21595,12 +21595,6 @@ calabash_script.core.tap_mark = function tap_mark(mark) {
21595
21595
  return calabash_script.core.tap.call(null, cljs.core.PersistentVector.fromArray(["\ufdd0'view", cljs.core.ObjMap.fromObject(["\ufdd0'marked"], {"\ufdd0'marked":mark})], true))
21596
21596
  };
21597
21597
  calabash_script.core.tap_offset = function tap_offset(offset) {
21598
- var rect = calabash_script.utils.window.call(null).rect();
21599
- var center_x = rect["size"]["width"] / 2;
21600
- var center_y = rect["size"]["height"] / 2;
21601
- var x = cljs.core.int$.call(null, (new cljs.core.Keyword("\ufdd0'x")).call(null, offset)) - center_x;
21602
- var y = cljs.core.int$.call(null, (new cljs.core.Keyword("\ufdd0'y")).call(null, offset)) - center_y;
21603
- calabash_script.log.log.call(null, cljs.core.ObjMap.fromObject(["\ufdd0'tapOffset"], {"\ufdd0'tapOffset":cljs.core.ObjMap.fromObject(["\ufdd0'x", "\ufdd0'y"], {"\ufdd0'x":x, "\ufdd0'y":y})}));
21604
21598
  return calabash_script.utils.target.call(null).tapWithOptions(calabash_script.utils.clj__GT_js.call(null, offset))
21605
21599
  };
21606
21600
  calabash_script.core.element_exists_QMARK_ = function() {
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: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-04 00:00:00.000000000 Z
11
+ date: 2013-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor