lib/calabash-cucumber/launcher.rb in testautoi-0.9.143 vs lib/calabash-cucumber/launcher.rb in testautoi-0.9.144

- old
+ new

@@ -23,11 +23,11 @@ def calabash_no_launch? ENV['NO_LAUNCH']=='1' end def device_target? - ENV['DEVICE_TARGET'] == 'device' + (ENV['DEVICE_TARGET'] != nil) && (not simulator_target?) end def simulator_target? ENV['DEVICE_TARGET'] == 'simulator' end @@ -66,10 +66,14 @@ def relaunch(args={}) RunLoop.stop(run_loop) if run_loop if device_target? default_args = {:app => ENV['BUNDLE_ID']} + target = ENV['DEVICE_TARGET'] + if target != 'DEVICE' + default_args[:udid] = target + end self.run_loop = RunLoop.run(default_args.merge(args)) else sdk = ENV['SDK_VERSION'] || SimLauncher::SdkDetector.new().latest_sdk_version path = Calabash::Cucumber::SimulatorHelper.app_bundle_or_raise(app_path) @@ -117,11 +121,11 @@ end rescue CalabashLauncherTimeoutErr => e puts "Timed out...Retry.." end end - rescue e + rescue RuntimeError => e p e msg = "Unable to make connection to Calabash Server at #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}\n" msg << "Make sure you don't have a firewall blocking traffic to #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}.\n" raise msg end @@ -130,10 +134,10 @@ def ping_app url = URI.parse(ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/") http = Net::HTTP.new(url.host, url.port) res = http.start do |sess| - sess.request Net::HTTP::Get.new "version" + sess.request Net::HTTP::Get.new(ENV['CALABASH_VERSION_PATH'] || "version") end status = res.code begin http.finish if http and http.started? rescue Exception => e