You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/06/02 12:31:35 UTC

cordova-paramedic git commit: Use the first matching simulator

Repository: cordova-paramedic
Updated Branches:
  refs/heads/ci/ios b5278f3fb -> a305fccba


Use the first matching simulator


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

Branch: refs/heads/ci/ios
Commit: a305fccba83e978e5cda903d2cd66ce0818283c4
Parents: b5278f3
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Thu Jun 2 15:30:29 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Thu Jun 2 15:30:29 2016 +0300

----------------------------------------------------------------------
 lib/utils/utilities.js | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/a305fccb/lib/utils/utilities.js
----------------------------------------------------------------------
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index 0e31c67..f387c02 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -96,17 +96,20 @@ function getSimulatorId(findSimResult) {
 
     // This matches <device> (<version>) [<simulator-id>]
     var simIdRegex = /^([a-zA-Z\d ]+) \(([\d.]+)\) \[([a-zA-Z\d\-]*)\].*$/;
-
-    var simId = null;
-    var lines = instrResult.output.split(/\n/);
-    lines.forEach(function (line) {
+    var simulatorIds = instrResult.output.split(/\n/)
+    .reduce(function (result, line) {
         var simIdMatch = simIdRegex.exec(line);
         if (simIdMatch && simIdMatch.length === 4 && simIdMatch[1] === device && simIdMatch[2] === version) {
-            simId = encodeURIComponent(simIdMatch[3]);
+            result.push(encodeURIComponent(simIdMatch[3]));
         }
-    });
+        return result;
+    }, []);
+
+    if (simulatorIds.length > 1) {
+        logger.warn('Multiple matching emulators found. Will use the first matching simulator');
+    }
 
-    return simId;
+    return simulatorIds[0];
 }
 
 function doesFileExist(filePath) {


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