run_loop 0.1.0.pre8 → 0.1.0.pre9

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: 945e26c746021ba0f31cfcc092b20f279ce2d535
4
- data.tar.gz: 3950184ea0e337f1c172a083886c04ae6e5b4783
3
+ metadata.gz: 4d07182bfd4a970c2acfe923ac8b5a94650149db
4
+ data.tar.gz: 4abbd2fdc27bcd848bcb02b8fc86989cca82e1e0
5
5
  SHA512:
6
- metadata.gz: 43171f1961e4c498d63cf00a7acf150b15df5f9b59314c443224da22d9cd42e58cf072153834b530fc5aa52e11a930e288b836b2a13677d93b47207f1de0c824
7
- data.tar.gz: 9ff4f9c9818dcfd64309c424c36de1f47a0b0c015b612a10d96e21cb1637f7a89319963f6fe68197c445344b255abd704da116dca60c3a09f1148e438c017f53
6
+ metadata.gz: f988014195fbc3525edc9b43539eb440d418186ef57be437a01fcbc60e410dc017703e7ff4045643fe495b312a49ebcf65445787b9e6f314a2f76825cd92fabf
7
+ data.tar.gz: 6518e52d8cd49c979042debf89f989e659343b96f413b1862cde461bdccc8954f59e1a0b29cb2ac459c2d292fa397ef108807763492b4df54b6058d58a5ea81b
data/lib/run_loop/core.rb CHANGED
@@ -54,8 +54,8 @@ module RunLoop
54
54
  log_file = options[:log_path]
55
55
  timeout = options[:timeout] || 30
56
56
 
57
- results_dir = options[:results_dir] || Dir.mktmpdir("run_loop")
58
- results_dir_trace = File.join(results_dir, "trace")
57
+ results_dir = options[:results_dir] || Dir.mktmpdir('run_loop')
58
+ results_dir_trace = File.join(results_dir, 'trace')
59
59
  FileUtils.mkdir_p(results_dir_trace)
60
60
 
61
61
  dependencies = options[:dependencies] || []
@@ -64,17 +64,17 @@ module RunLoop
64
64
  FileUtils.cp(dep, results_dir)
65
65
  end
66
66
 
67
- script = File.join(results_dir, "_run_loop.js")
67
+ script = File.join(results_dir, '_run_loop.js')
68
68
 
69
69
 
70
70
  code = File.read(options[:script])
71
71
  code = code.gsub(/\$PATH/, results_dir)
72
- code = code.gsub(/\$MODE/, "FLUSH") unless options[:no_flush]
72
+ code = code.gsub(/\$MODE/, 'FLUSH') unless options[:no_flush]
73
73
 
74
- repl_path = File.join(results_dir, "repl-cmd.txt")
75
- File.open(repl_path, "w") { |file| file.puts "0:UIALogger.logMessage('Listening for run loop commands');" }
74
+ repl_path = File.join(results_dir, 'repl-cmd.txt')
75
+ File.open(repl_path, 'w') { |file| file.puts "0:UIALogger.logMessage('Listening for run loop commands');" }
76
76
 
77
- File.open(script, "w") { |file| file.puts code }
77
+ File.open(script, 'w') { |file| file.puts code }
78
78
 
79
79
 
80
80
  bundle_dir_or_bundle_id = options[:app] || ENV['BUNDLE_ID']|| ENV['APP_BUNDLE_PATH'] || ENV['APP']
@@ -96,7 +96,7 @@ module RunLoop
96
96
  device = options[:device] || :iphone
97
97
  device = device && device.to_sym
98
98
 
99
- plistbuddy="/usr/libexec/PlistBuddy"
99
+ plistbuddy='/usr/libexec/PlistBuddy'
100
100
  plistfile="#{bundle_dir_or_bundle_id}/Info.plist"
101
101
  if device == :iphone
102
102
  uidevicefamily=1
@@ -133,10 +133,16 @@ module RunLoop
133
133
 
134
134
  end
135
135
 
136
- cmd = instruments_command(udid, results_dir_trace, bundle_dir_or_bundle_id, results_dir, script, log_file, args)
136
+ cmd = instruments_command(options.merge(:udid => udid,
137
+ :results_dir_trace => results_dir_trace,
138
+ :bundle_dir_or_bundle_id => bundle_dir_or_bundle_id,
139
+ :results_dir => results_dir,
140
+ :script => script,
141
+ :log_file => log_file,
142
+ :args => args))
137
143
 
138
144
  log_header("Starting on #{device_target} App: #{bundle_dir_or_bundle_id}")
139
- cmd_str = cmd.join(" ")
145
+ cmd_str = cmd.join(' ')
140
146
  if ENV['DEBUG']
141
147
  log(cmd_str)
142
148
  end
@@ -150,7 +156,7 @@ module RunLoop
150
156
 
151
157
  Process.detach(pid)
152
158
 
153
- File.open(File.join(results_dir, "run_loop.pid"), "w") do |f|
159
+ File.open(File.join(results_dir, 'run_loop.pid'), 'w') do |f|
154
160
  f.write pid
155
161
  end
156
162
 
@@ -203,7 +209,7 @@ module RunLoop
203
209
 
204
210
 
205
211
  tmp_cmd = File.join(File.dirname(repl_path), '__repl-cmd.txt')
206
- File.open(tmp_cmd, "w") do |f|
212
+ File.open(tmp_cmd, 'w') do |f|
207
213
  f.write("#{index}:#{cmd}")
208
214
  if ENV['DEBUG']
209
215
  puts "Wrote: #{index}:#{cmd}"
@@ -235,7 +241,7 @@ module RunLoop
235
241
  end
236
242
  index_if_found = output.index(START_DELIMITER)
237
243
  if ENV['DEBUG_READ']=='1'
238
- puts output.gsub("*", '')
244
+ puts output.gsub('*', '')
239
245
  puts "Size #{size}"
240
246
  puts "offset #{offset}"
241
247
  puts "index_of #{START_DELIMITER}: #{index_if_found}"
@@ -309,15 +315,23 @@ module RunLoop
309
315
  end
310
316
 
311
317
 
312
- def self.instruments_command(udid, results_dir_trace, bundle_dir_or_bundle_id, results_dir, script, log_file, args=[])
318
+ def self.instruments_command(options)
319
+ udid = options[:udid]
320
+ results_dir_trace = options[:results_dir_trace]
321
+ bundle_dir_or_bundle_id = options[:bundle_dir_or_bundle_id]
322
+ results_dir = options[:results_dir]
323
+ script = options[:script]
324
+ log_file = options[:log_file]
325
+ args= options[:args] || []
326
+
313
327
  instruments_prefix = instruments_command_prefix(udid, results_dir_trace)
314
328
  cmd = [
315
329
  instruments_prefix,
316
- "-t", automation_template,
330
+ '-t', automation_template,
317
331
  "\"#{bundle_dir_or_bundle_id}\"",
318
- "-e", "UIARESULTSPATH", results_dir,
319
- "-e", "UIASCRIPT", script,
320
- args.join(" ")
332
+ '-e', 'UIARESULTSPATH', results_dir,
333
+ '-e', 'UIASCRIPT', script,
334
+ args.join(' ')
321
335
  ]
322
336
  if log_file
323
337
  cmd << "&> #{log_file}"
@@ -334,12 +348,12 @@ module RunLoop
334
348
 
335
349
  def self.default_tracetemplate
336
350
  xcode_path = `xcode-select -print-path`.chomp
337
- automation_bundle = File.expand_path(File.join(xcode_path, "..", 'Applications', "Instruments.app", "Contents", "PlugIns", 'AutomationInstrument.bundle'))
351
+ automation_bundle = File.expand_path(File.join(xcode_path, '..', 'Applications', 'Instruments.app', 'Contents', 'PlugIns', 'AutomationInstrument.bundle'))
338
352
  if not File.exist? automation_bundle
339
- automation_bundle= File.expand_path(File.join(xcode_path, "Platforms", "iPhoneOS.platform", "Developer", "Library", "Instruments", "PlugIns", "AutomationInstrument.bundle"))
340
- raise "Unable to find AutomationInstrument.bundle" if not File.exist? automation_bundle
353
+ automation_bundle= File.expand_path(File.join(xcode_path, 'Platforms', 'iPhoneOS.platform', 'Developer', 'Library', 'Instruments', 'PlugIns', 'AutomationInstrument.bundle'))
354
+ raise 'Unable to find AutomationInstrument.bundle' if not File.exist? automation_bundle
341
355
  end
342
- File.join(automation_bundle, "Contents", "Resources", "Automation.tracetemplate")
356
+ File.join(automation_bundle, 'Contents', 'Resources', 'Automation.tracetemplate')
343
357
  end
344
358
 
345
359
  def self.log(message)
@@ -371,7 +385,7 @@ module RunLoop
371
385
 
372
386
  def self.instruments_pids
373
387
  pids_str = `ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`.strip
374
- pids_str.split(",").map { |pid| pid.to_i }
388
+ pids_str.split(',').map { |pid| pid.to_i }
375
389
  end
376
390
 
377
391
  end
@@ -420,7 +434,7 @@ module RunLoop
420
434
  FileUtils.mkdir_p(dest)
421
435
 
422
436
  if results_dir
423
- pngs = Dir.glob(File.join(results_dir, "Run 1", "*.png"))
437
+ pngs = Dir.glob(File.join(results_dir, 'Run 1', '*.png'))
424
438
  else
425
439
  pngs = []
426
440
  end
@@ -1,3 +1,3 @@
1
1
  module RunLoop
2
- VERSION = '0.1.0.pre8'
2
+ VERSION = '0.1.0.pre9'
3
3
  end
@@ -329,9 +329,8 @@ UIATarget.localTarget().frontMostApp().setPreferencesValueForKey(null, __calabas
329
329
  UIATarget.localTarget().frontMostApp().setPreferencesValueForKey(0, __calabashRequest);
330
330
 
331
331
  Log.result('success',true,true);
332
-
332
+ target = UIATarget.localTarget();
333
333
  while (true) {
334
- target = UIATarget.localTarget();
335
334
  try {
336
335
  preferences = target.frontMostApp().preferencesValueForKey(__calabashRequest);
337
336
  } catch (e) {
@@ -349,7 +348,7 @@ while (true) {
349
348
  if (!isNaN(_actualIndex) && _actualIndex >= _expectedIndex) {
350
349
  _exp = preferences['command'];
351
350
  UIALogger.logMessage("index " + _actualIndex + " is command: "+ _exp);
352
- target.frontMostApp().setPreferencesValueForKey(0, __calabashRequest);
351
+ target.frontMostApp().setPreferencesValueForKey(null, __calabashRequest);
353
352
  try {
354
353
  _result = eval(_exp);
355
354
  UIALogger.logMessage("Success: "+ _result);
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.1.0.pre8
4
+ version: 0.1.0.pre9
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-12-30 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor