cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: CB-7382 Clean up lazy_load: Platform()
Date Tue, 07 Oct 2014 18:43:50 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 6922bc9b8 -> 6aa0480cc


CB-7382 Clean up lazy_load: Platform()

github: close #79


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

Branch: refs/heads/master
Commit: 6aa0480cc174c400090eb8d273cedd5febb801af
Parents: 6922bc9
Author: Josh Soref <jsoref@blackberry.com>
Authored: Tue Aug 19 15:30:28 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Oct 7 14:43:18 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/lazy_load.js | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6aa0480c/cordova-lib/src/cordova/lazy_load.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/lazy_load.js b/cordova-lib/src/cordova/lazy_load.js
index 823ad04..76ba518 100644
--- a/cordova-lib/src/cordova/lazy_load.js
+++ b/cordova-lib/src/cordova/lazy_load.js
@@ -55,15 +55,22 @@ exports.custom = custom;
 exports.based_on_config = based_on_config;
 
 function Platform(platformString) {
+    var name,
+        platform,
+        parts,
+        version;
     if (platformString.indexOf('@') != -1) {
-        var parts = platformString.split('@');
-        this.name = parts[0];
-        this.version = parts[1];
+        parts = platformString.split('@');
+        name = parts[0];
+        version = parts[1];
     } else {
-        this.name = platformString;
-        if (platforms[this.name]) this.version = platforms[this.name].version;
+        name = platformString;
     }
-    this.source = (this.name in platforms && 'source' in platforms[this.name]) ?
platforms[this.name].source : 'npm';
+    platform = _.extend({}, platforms[name]);
+    this.name = name;
+    this.version = version || platform.version;
+    this.packageName = 'cordova-' + name;
+    this.source = 'source' in platform ? platform.source : 'npm';
 }
 
 // Returns a promise for the path to the lazy-loaded directory.
@@ -125,7 +132,7 @@ function cordova_npm(platform) {
         return Q(git_dload_dir);
     }
 
-    var pkg = 'cordova-' + platform.name + '@' + platform.version;
+    var pkg = platform.packageName + '@' + platform.version;
     return exports.npm_cache_add(pkg);
 }
 


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


Mime
View raw message