You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/13 02:32:14 UTC

[6/8] git commit: Style fixes - comments

Style fixes - comments

//xyz -> // Xyz (space and capitalization).


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

Branch: refs/heads/cb-7219
Commit: c60bd17d65af3d431ada55d32d824266b721c089
Parents: eca3661
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Fri Aug 8 14:46:55 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Fri Aug 8 14:46:55 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/plugman/create.js              | 16 +++++++-------
 cordova-lib/src/plugman/platform.js            | 24 ++++++++++-----------
 cordova-lib/src/plugman/registry/manifest.js   |  9 ++++----
 cordova-lib/src/plugman/util/config-changes.js |  4 ++--
 4 files changed, 26 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c60bd17d/cordova-lib/src/plugman/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/create.js b/cordova-lib/src/plugman/create.js
index 684b126..a63ffea 100644
--- a/cordova-lib/src/plugman/create.js
+++ b/cordova-lib/src/plugman/create.js
@@ -37,38 +37,38 @@ module.exports = function create( name, id, version, pluginPath, options ) {
         clobber,
         jsMod;
 
-    //check we are not already in a plugin
+    // Check we are not already in a plugin
     if( fs.existsSync( cwd + 'plugin.xml' ) ) {
         return Q.reject( new CordovaError( 'plugin.xml already exists. Are you already in a plugin?' ) );
     }
 
-    //Create a plugin.xml file
+    // Create a plugin.xml file
     root = et.Element( 'plugin' );
     root.set( 'xmlns', 'http://apache.org/cordova/ns/plugins/1.0' );
     root.set( 'xmlns:android', 'http://schemas.android.com/apk/res/android' );
     root.set( 'id', id );
     root.set( 'version', version );
 
-    //Add the name tag
+    // Add the name tag
     pluginName = et.XML( '<name>' );
     pluginName.text = name;
     root.append( pluginName );
 
-    //loop through the options( variables ) for other tags
+    // Loop through the options( variables ) for other tags
     for( var key in options ) {
         var temp = et.XML( '<' + key + '>');
         temp.text = options[ key ];
         root.append( temp );
     }
 
-    //setup the directory structure
+    // Setup the directory structure
     shell.mkdir( '-p', cwd + 'www' );
     shell.mkdir( '-p', cwd + 'src' );
 
-    //create a base plugin.js file
+    // Create a base plugin.js file
     baseJS = fs.readFileSync( templatesDir + 'base.js', 'utf-8').replace( /%pluginName%/g, name );
     fs.writeFileSync( cwd + 'www/' + name + '.js', baseJS, 'utf-8' );
-    //Add it to the xml as a js module
+    // Add it to the xml as a js module
     jsMod = et.Element( 'js-module' );
     jsMod.set( 'src', 'www/' + name + '.js' );
     jsMod.set( 'name', name );
@@ -79,7 +79,7 @@ module.exports = function create( name, id, version, pluginPath, options ) {
 
     root.append( jsMod );
 
-    //Write out the plugin.xml file
+    // Write out the plugin.xml file
     fs.writeFileSync( cwd + 'plugin.xml', new et.ElementTree( root ).write( {indent: 4} ), 'utf-8' );
 
     return Q();

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c60bd17d/cordova-lib/src/plugman/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platform.js b/cordova-lib/src/plugman/platform.js
index 414e975..8761986 100644
--- a/cordova-lib/src/plugman/platform.js
+++ b/cordova-lib/src/plugman/platform.js
@@ -33,23 +33,23 @@ module.exports = {
         var pluginxml,
             platform;
 
-        //check to make sure we are in the plugin first
+        // Check to make sure we are in the plugin first
         if( !fs.existsSync( 'plugin.xml' ) ) {
             return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
         }
 
-        //Get the current plugin.xml file
+        // Get the current plugin.xml file
         pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
 
-        //Check if this platform exists
+        // Check if this platform exists
         if( pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
             return Q.reject( new Error( "platform: " + platformName + " already added"  ) );
         }
 
-        //Get the platform specific elements
+        // Get the platform specific elements
         platform = doPlatform( platformName, pluginxml.find("./name").text, pluginxml.getroot().get( "id" ) );
 
-        //Make sure we support it
+        // Make sure we support it
         if( !platform ) {
             return Q.reject( new Error( "platform: " + platformName + " not yet supported"  ) );
         }
@@ -60,26 +60,26 @@ module.exports = {
         return Q();
     },
     remove: function( platformName ) {
-        //check to make sure we are in the plugin first
+        // Check to make sure we are in the plugin first
         if( !fs.existsSync( 'plugin.xml' ) ) {
             return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
         }
 
-        //Get the current plugin.xml file
+        // Get the current plugin.xml file
         var pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
 
-        //Check if this platform exists
+        // Check if this platform exists
         if( !pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
             return Q.reject( new Error( "platform: " + platformName + " hasn't been added"  ) );
         }
 
-        //Remove the Platform in question
+        // Remove the Platform in question
         pluginxml.getroot().remove( 0, pluginxml.find("./platform/[@name='"+ platformName +"']") );
 
-        //Rewrite the plugin.xml file back out
+        // Rewrite the plugin.xml file back out
         fs.writeFileSync( "plugin.xml", pluginxml.write( "plugin.xml", {indent: 4} ), 'utf-8' );
 
-        //Remove the src/"platform"
+        // Remove the src/"platform"
         shell.rm( '-rf', 'src/' + platformName );
 
         return Q();
@@ -107,7 +107,7 @@ function doPlatform( platformName, pluginName, pluginID, pluginVersion ) {
 }
 
 function doPlatformBase( templatesDir, platformName, pluginName, pluginID, pluginVersion ) {
-    //Create the default plugin file
+    // Create the default plugin file
     var baseFiles = [],
         i = 0;
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c60bd17d/cordova-lib/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/manifest.js b/cordova-lib/src/plugman/registry/manifest.js
index 5306b0e..4496f34 100644
--- a/cordova-lib/src/plugman/registry/manifest.js
+++ b/cordova-lib/src/plugman/registry/manifest.js
@@ -88,7 +88,7 @@ function generatePackageJsonFromPluginXml(plugin_path) {
         if(keywords)     package_json.keywords     = keywords.split(',');
         if(platforms)    package_json.platforms    = platforms;
 
-        // adding engines
+        // Adding engines
         if(engines) {
             package_json.engines = [];
             for(var i = 0, j = engines.length ; i < j ; i++) {
@@ -96,10 +96,10 @@ function generatePackageJsonFromPluginXml(plugin_path) {
             }
         }
 
-        //set docs_path to doc/index.md exists
+        // Set docs_path to doc/index.md exists
         var docs_path = path.resolve(plugin_path, 'doc/index.md');
         if(!(fs.existsSync(docs_path))){
-            //set docs_path to doc/en/index.md
+            // Set docs_path to doc/en/index.md
             docs_path = path.resolve(plugin_path, 'doc/en/index.md');
         }
         if(fs.existsSync(docs_path)){
@@ -107,9 +107,8 @@ function generatePackageJsonFromPluginXml(plugin_path) {
             package_json.englishdoc = englishdoc;
         }
 
-        // write package.json
+        // Write package.json
         var package_json_path = path.resolve(plugin_path, 'package.json');
-        //console.log('about to write package.json');
         fs.writeFileSync(package_json_path, JSON.stringify(package_json, null, 4), 'utf8');
         return package_json;
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c60bd17d/cordova-lib/src/plugman/util/config-changes.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/config-changes.js b/cordova-lib/src/plugman/util/config-changes.js
index 11765b3..45cde7d 100644
--- a/cordova-lib/src/plugman/util/config-changes.js
+++ b/cordova-lib/src/plugman/util/config-changes.js
@@ -421,8 +421,8 @@ ConfigKeeper.prototype.get = ConfigKeeper_get;
 function ConfigKeeper_get(project_dir, platform, file) {
     var self = this;
 
-    //This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
-    //https://issues.apache.org/jira/browse/CB-6414
+    // This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
+    // https://issues.apache.org/jira/browse/CB-6414
     if(file == 'config.xml' && platform == 'android'){
         file = 'res/xml/config.xml';
     }