cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject [1/2] git commit: Minor style filxes in cordova/platform.js
Date Thu, 12 Jun 2014 21:28:08 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 8dca6770e -> 4548595f1


Minor style filxes in cordova/platform.js

Committing separately to avoid mixing this with real logic changes coming next.


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

Branch: refs/heads/master
Commit: 8f63b9438c411e67c89d977d62d3f863538f4bb9
Parents: 8dca677
Author: Mark Koudritsky <kamrik@gmail.com>
Authored: Thu Jun 12 17:00:34 2014 -0400
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Thu Jun 12 17:00:34 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8f63b943/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index bb64cc8..7890997 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -54,22 +54,26 @@ function getVersionFromScript(script, defaultValue) {
 }
 
 function add(hooks, projectRoot, targets, opts) {
+    var msg;
+    if ( !targets || !targets.length ) {
+        msg = 'No platform specified. Please specify a platform to add. ' +
+              'See `' + cordova_util.binname + ' platform list`.';
+        return Q.reject(new CordovaError(msg));
+    }
     var xml = cordova_util.projectConfig(projectRoot);
     var cfg = new ConfigParser(xml);
-    if (!targets || !targets.length) {
-        return Q.reject(new CordovaError('No platform specified. Please specify a platform
to add. See `'+cordova_util.binname+' platform list`.'));
-    }
     var config_json = config.read(projectRoot);
     var platformsDir = path.join(projectRoot, 'platforms');
 
     // The "platforms" dir is safe to delete, it's almost equivalent to
-    // cordova platfrom rm <list of all platforms>
+    // cordova platform rm <list of all platforms>
     if ( !fs.existsSync(platformsDir)) {
         shell.mkdir('-p', platformsDir);
     }
 
     return hooks.fire('before_platform_add', opts)
     .then(cordova_util.Q_chainmap(targets, function(t) {
+        // For each platform, download it and call its "create" script.
         return lazy_load.based_on_config(projectRoot, t, opts)
         .fail(function(err) {
             throw new CordovaError('Unable to fetch platform ' + t + ': ' + err);
@@ -312,19 +316,19 @@ function supports(project_root, name) {
     // required parameters
     if (!name) return Q.reject(new CordovaError('requires a platform name parameter'));
 
-    // check if platform exists
+    // Check if platform exists.
     var platform = platforms[name];
     if (!platform) {
         return Q.reject(new CordovaError(util.format('"%s" platform does not exist', name)));
     }
 
-    // look up platform meta-data parser
+    // Look up platform meta-data parser.
     var platformParser = platforms[name].parser;
     if (!platformParser) {
         return Q.reject(new Error(util.format('"%s" platform parser does not exist', name)));
     }
 
-    // check for platform support
+    // Check for platform support.
     return platformParser.check_requirements(project_root);
 }
 


Mime
View raw message