cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject [2/2] webworks commit: CB-6326 Fix inconsistency between manually added vs auto-detected emulators
Date Mon, 24 Mar 2014 02:55:16 GMT
CB-6326 Fix inconsistency between manually added vs auto-detected emulators

Manually added targets had type of 'simulator' in blackberry10.json where
those automatically added by the run script use 'emulator'. This change makes
'emulator' the default everywhere including updating older files.


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

Branch: refs/heads/master
Commit: 7b563950c1c2612838b37d81c906f286384ae0bc
Parents: 15c70d7
Author: Bryan Higgins <bryan@bryanhiggins.net>
Authored: Sun Mar 23 12:21:57 2014 -0400
Committer: Bryan Higgins <bryan@bryanhiggins.net>
Committed: Sun Mar 23 12:21:57 2014 -0400

----------------------------------------------------------------------
 blackberry10/bin/lib/target.js                    |  5 ++++-
 .../project/cordova/lib/list-emulator-images.js   |  2 +-
 .../project/cordova/lib/list-started-emulators.js |  2 +-
 .../templates/project/cordova/lib/target-utils.js | 18 ++++++++++++++++++
 4 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7b563950/blackberry10/bin/lib/target.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/lib/target.js b/blackberry10/bin/lib/target.js
index d1afc58..e199762 100644
--- a/blackberry10/bin/lib/target.js
+++ b/blackberry10/bin/lib/target.js
@@ -39,7 +39,7 @@ function isValidType(type) {
         console.log(commander.helpInformation());
         exit(ERROR_VALUE);
     }
-    else if (!(type === 'device' || type === 'simulator')) {
+    else if (!(type === 'device' || type === 'emulator')) {
         result = false;
     }
     return result;
@@ -80,6 +80,9 @@ commander
         targetName = commander.args[0];
         ip = commander.args[1];
         type = commander.type ? commander.type : "device";
+        if (type === "simulator") {
+            type = "emulator";
+        }
         if (commander.password && typeof commander.password === 'string') {
             password = commander.password;
         }

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7b563950/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js b/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js
index 2459694..9bdd906 100644
--- a/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js
+++ b/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js
@@ -16,4 +16,4 @@
 // specific language governing permissions and limitations
 // under the License.
 
-require('./target-utils').listTargets('simulator', false);
+require('./target-utils').listTargets('emulator', false);

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7b563950/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js b/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js
index 5297c10..0b1f8de 100644
--- a/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js
+++ b/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js
@@ -15,4 +15,4 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-require('./target-utils').listTargets('simulator', true);
+require('./target-utils').listTargets('emulator', true);

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7b563950/blackberry10/bin/templates/project/cordova/lib/target-utils.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/target-utils.js b/blackberry10/bin/templates/project/cordova/lib/target-utils.js
old mode 100644
new mode 100755
index b54c244..752847b
--- a/blackberry10/bin/templates/project/cordova/lib/target-utils.js
+++ b/blackberry10/bin/templates/project/cordova/lib/target-utils.js
@@ -21,6 +21,23 @@ var _self,
     bb10_utils = require('./utils'),
     blackberryProperties = bb10_utils.getProperties();
 
+
+//fix older blackberry10.json files 
+//these may include 'simulator' type rather than 'emulator'
+function replaceSimulator(targets) {
+    var replace = false;
+    for (t in targets) {
+        if (targets.hasOwnProperty(t) && targets[t].type === "simulator") {
+            targets[t].type = "emulator";
+            replace = true;
+        }
+    }
+    if (replace) {
+        blackberryProperties.targets = targets;
+        bb10_utils.writeToPropertiesFile(blackberryProperties);
+    }
+}
+
 _self = {
     getTargetList : function (type, pruneDisconnected, callback) {
         var targList = [],
@@ -47,6 +64,7 @@ _self = {
             t;
 
         if (targets) {
+            replaceSimulator(targets);
             for (t in targets) {
                 if (targets.hasOwnProperty(t) && targets[t].type === type) {
                     if (pruneDisconnected) {


Mime
View raw message