You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/11/15 22:19:37 UTC

[2/2] js commit: [all] Rename builder keys to make them consistent across common/platform

[all] Rename builder keys to make them consistent across common/platform

platform.objects -> platform.clobbers
common.objects -> common.defaults


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/99fadd12
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/99fadd12
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/99fadd12

Branch: refs/heads/master
Commit: 99fadd12f74703a58e729664394570956d6ccbe4
Parents: a33b47d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Nov 15 15:34:32 2012 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Nov 15 15:34:32 2012 -0500

----------------------------------------------------------------------
 lib/android/platform.js      |    2 +-
 lib/bada/platform.js         |    2 +-
 lib/blackberry/platform.js   |    3 +--
 lib/common/builder.js        |   12 +++++++++---
 lib/common/common.js         |    4 ++--
 lib/errgen/platform.js       |    3 +--
 lib/ios/platform.js          |    2 +-
 lib/scripts/bootstrap.js     |   26 ++++++--------------------
 lib/test/platform.js         |    3 +--
 lib/tizen/platform.js        |    2 +-
 lib/webos/platform.js        |    2 +-
 lib/windows8/platform.js     |    2 +-
 lib/windowsphone/platform.js |    2 +-
 13 files changed, 27 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/android/platform.js
----------------------------------------------------------------------
diff --git a/lib/android/platform.js b/lib/android/platform.js
index 22e5064..2d1770c 100644
--- a/lib/android/platform.js
+++ b/lib/android/platform.js
@@ -85,7 +85,7 @@ module.exports = {
             exec(null, null, "App", "show", []);
         }, [channel.onCordovaReady]);
     },
-    objects: {
+    clobbers: {
         navigator: {
             children: {
                 app:{

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/bada/platform.js
----------------------------------------------------------------------
diff --git a/lib/bada/platform.js b/lib/bada/platform.js
index 0bbe0e2..00620bf 100644
--- a/lib/bada/platform.js
+++ b/lib/bada/platform.js
@@ -22,7 +22,7 @@
 module.exports = {
     id: "bada",
     initialize: function() {},
-    objects: {
+    clobbers: {
         device: {
             path: 'cordova/plugin/bada/device'
         },

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/blackberry/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/platform.js b/lib/blackberry/platform.js
index 2f568a5..0ff9dfe 100644
--- a/lib/blackberry/platform.js
+++ b/lib/blackberry/platform.js
@@ -43,6 +43,5 @@ module.exports = {
         builder.build(platform.objects).intoAndClobber(window);
         builder.build(platform.merges).intoAndMerge(window);
         platform.initialize();
-    },
-    objects: {}
+    }
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/common/builder.js
----------------------------------------------------------------------
diff --git a/lib/common/builder.js b/lib/common/builder.js
index 1c74bff..05d33c6 100644
--- a/lib/common/builder.js
+++ b/lib/common/builder.js
@@ -120,13 +120,19 @@ module.exports = {
     build: function (objects) {
         return {
             intoButDoNotClobber: function (target) {
-                include(target, objects, false, false);
+                if (objects) {
+                    include(target, objects, false, false);
+                }
             },
             intoAndClobber: function(target) {
-                include(target, objects, true, false);
+                if (objects) {
+                    include(target, objects, true, false);
+                }
             },
             intoAndMerge: function(target) {
-                include(target, objects, true, true);
+                if (objects) {
+                    include(target, objects, true, true);
+                }
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/common/common.js
----------------------------------------------------------------------
diff --git a/lib/common/common.js b/lib/common/common.js
index cbcac1e..2b3ec40 100644
--- a/lib/common/common.js
+++ b/lib/common/common.js
@@ -20,7 +20,7 @@
 */
 
 module.exports = {
-    objects: {
+    defaults: {
         cordova: {
             path: 'cordova',
             children: {
@@ -230,7 +230,7 @@ module.exports = {
                 connection: {
                     path: 'cordova/plugin/network'
                 }
-            },
+            }
         }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/errgen/platform.js
----------------------------------------------------------------------
diff --git a/lib/errgen/platform.js b/lib/errgen/platform.js
index b312505..f87da20 100644
--- a/lib/errgen/platform.js
+++ b/lib/errgen/platform.js
@@ -23,6 +23,5 @@ require('cordova/plugin/errgen/device');
 //------------------------------------------------------------------------------
 module.exports = {
     id:         "errgen",
-    initialize: function() {},
-    objects:    {}
+    initialize: function() {}
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/ios/platform.js
----------------------------------------------------------------------
diff --git a/lib/ios/platform.js b/lib/ios/platform.js
index 515ee14..c196a92 100644
--- a/lib/ios/platform.js
+++ b/lib/ios/platform.js
@@ -30,7 +30,7 @@ module.exports = {
         navigator.geolocation.watchPosition = geo.watchPosition;
         navigator.geolocation.clearWatch = geo.clearWatch;
     },
-    objects: {
+    clobbers: {
         File: { // exists natively, override
             path: "cordova/plugin/File"
         },

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/scripts/bootstrap.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap.js b/lib/scripts/bootstrap.js
index 0ac8ded..4d727fb 100644
--- a/lib/scripts/bootstrap.js
+++ b/lib/scripts/bootstrap.js
@@ -40,27 +40,13 @@
                         platform = require('cordova/platform');
 
                     // Drop the common globals into the window object, but be nice and don't overwrite anything.
-                    builder.build(base.objects).intoButDoNotClobber(context);
+                    builder.build(base.defaults).intoButDoNotClobber(context);
+                    builder.build(base.merges).intoAndMerge(context);
+                    builder.build(base.clobbers).intoAndClobber(context);
 
-                    if (base.merges) {
-                        builder.build(base.merges).intoAndMerge(context);
-                    }
-
-                    if (base.clobbers) {
-                        builder.build(base.clobbers).intoAndClobber(context);
-                    }
-
-                    // Drop the platform-specific globals into the window object
-                    // and clobber any existing object.
-                    if (platform.objects) {
-                        builder.build(platform.objects).intoAndClobber(context);
-                    }
-
-                    // Merge the platform-specific overrides/enhancements into
-                    // the window object.
-                    if (platform.merges) {
-                        builder.build(platform.merges).intoAndMerge(context);
-                    }
+                    builder.build(platform.defaults).intoButDoNotClobber(context);
+                    builder.build(platform.merges).intoAndMerge(context);
+                    builder.build(platform.clobbers).intoAndClobber(context);
 
                     // Call the platform-specific initialization
                     platform.initialize();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/test/platform.js
----------------------------------------------------------------------
diff --git a/lib/test/platform.js b/lib/test/platform.js
index 2688ddd..4315d8a 100644
--- a/lib/test/platform.js
+++ b/lib/test/platform.js
@@ -22,6 +22,5 @@
 module.exports = {
     id: "test platform",
     runtime: function () {},
-    initialize: function () {},
-    objects: {}
+    initialize: function () {}
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/tizen/platform.js
----------------------------------------------------------------------
diff --git a/lib/tizen/platform.js b/lib/tizen/platform.js
index cc5fa45..09f1e34 100644
--- a/lib/tizen/platform.js
+++ b/lib/tizen/platform.js
@@ -22,7 +22,7 @@
 module.exports = {
     id: "tizen",
     initialize: function() {},
-    objects: {
+    clobbers: {
         device: {
             path: "cordova/plugin/tizen/Device"
         },

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/webos/platform.js
----------------------------------------------------------------------
diff --git a/lib/webos/platform.js b/lib/webos/platform.js
index 386b960..cc3f6d4 100644
--- a/lib/webos/platform.js
+++ b/lib/webos/platform.js
@@ -30,7 +30,7 @@ module.exports = {
             console.error("stageActivated");
         };
     },
-    objects: {
+    clobbers: {
         requestFileSystem:{
             path: 'cordova/plugin/webos/requestfilesystem'
         },

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/windows8/platform.js
----------------------------------------------------------------------
diff --git a/lib/windows8/platform.js b/lib/windows8/platform.js
index 5742dc4..93ccec6 100755
--- a/lib/windows8/platform.js
+++ b/lib/windows8/platform.js
@@ -75,7 +75,7 @@ module.exports = {
             onWinJSReady();
         }
     },
-    objects: {
+    clobbers: {
         cordova: {
             path: 'cordova',
             children: {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/99fadd12/lib/windowsphone/platform.js
----------------------------------------------------------------------
diff --git a/lib/windowsphone/platform.js b/lib/windowsphone/platform.js
index b387104..4658ae7 100644
--- a/lib/windowsphone/platform.js
+++ b/lib/windowsphone/platform.js
@@ -45,7 +45,7 @@ module.exports = {
             exec(null, null, "CoreEvents", "overridebackbutton", [this.numHandlers == 1]);
         };
     },
-    objects: {
+    clobbers: {
         CordovaCommandResult: {
             path:"cordova/plugin/windowsphone/CordovaCommandResult"
         },