cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject ios commit: CB-9266 "cordova run" for iOS does not see non-running emulators
Date Wed, 02 Sep 2015 19:52:09 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master 36e2012e6 -> f58c05efa


CB-9266 "cordova run" for iOS does not see non-running emulators


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/f58c05ef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/f58c05ef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/f58c05ef

Branch: refs/heads/master
Commit: f58c05efa5fd76ec6ab87bdb57bea3fd1163061f
Parents: 36e2012
Author: Simon MacDonald <simon.macdonald@gmail.com>
Authored: Wed Sep 2 15:51:57 2015 -0400
Committer: Simon MacDonald <simon.macdonald@gmail.com>
Committed: Wed Sep 2 15:51:57 2015 -0400

----------------------------------------------------------------------
 bin/templates/scripts/cordova/lib/run.js | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f58c05ef/bin/templates/scripts/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/run.js b/bin/templates/scripts/cordova/lib/run.js
index ff1e59e..d51ba52 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -148,9 +148,25 @@ function deployToDevice(appPath, target) {
 function deployToSim(appPath, target) {
     // Select target device for emulator. Default is 'iPhone-6' 
     if (!target) {
-        target = 'iPhone-5s'; // set to iPhone-5s for now until CB-9266
-        console.log('No target specified for emulator. Deploying to ' + target + ' simulator');
+        return require('./list-emulator-images').run()
+        .then(function (emulators) {
+            if (emulators.length > 0) {
+                target = emulators[0];
+            }
+            emulators.forEach(function (emulator) {
+                if (emulator.indexOf("iPhone") == 0) {
+                    target = emulator;
+                }
+            });
+            console.log('No target specified for emulator. Deploying to ' + target + ' simulator');
+            return startSim(appPath, target);
+        });
+    } else {
+        return startSim(appPath, target);
     }
+}
+
+function startSim(appPath, target) {
     var logPath = path.join(cordovaPath, 'console.log');
     var simArgs = ['launch', appPath,
         '--devicetypeid', 'com.apple.CoreSimulator.SimDeviceType.' + target,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message