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 2015/03/05 01:37:30 UTC

[1/8] cordova-lib git commit: CB-8551 cleaned up initSetings function

Repository: cordova-lib
Updated Branches:
  refs/heads/CB-8551 cfdcc066e -> fc73432fa


CB-8551 cleaned up initSetings function


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

Branch: refs/heads/CB-8551
Commit: 305cecb9d67e9b0b349db1b22e91400d97bb2306
Parents: cfdcc06
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 16:19:11 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 16:19:11 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/305cecb9/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 743f8e8..fba5053 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -205,16 +205,20 @@ module.exports = {
 
 /**
  * @method initSettings
- * @param {Boolean} using npm registry
+ * @param {Boolean} determines if we are using the npm registry
  * @return {Promise.<Object>} Promised settings.
  */
-function initSettings(npm) {
+function initSettings(useNpmRegistry) {
     var settings = module.exports.settings;
-    var registryURL = 'http://registry.cordova.io';
+    const NPM_REG_URL = 'http://registry.npmjs.org';
+    const CPR_REG_URL = 'http://registry.cordova.io';
+    var registryURL;
 
-    //if npm is true, use npm registry
-    if(npm) {
-        registryURL = 'http://registry.npmjs.org';
+    //if useNpmRegistry is true, use npm registry
+    if(useNpmRegistry) {
+        registryURL = NPM_REG_URL;
+    } else {
+        registryURL = CPR_REG_URL;
     }
 
     // check if settings already set
@@ -240,8 +244,8 @@ function initSettings(npm) {
     // if npm is true, use npm registry. 
     // ~/.plugman/config overides the above config if it exists. 
     // Need to reset the registry value in settings 
-    if(npm) {
-        settings.registry = 'http://registry.npmjs.org';
+    if(useNpmRegistry) {
+        settings.registry = NPM_REG_URL;
     }
 
     return Q(settings);


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


[6/8] cordova-lib git commit: CB-8551 merged fetchNPM and fetchPlugReg into fetchPlugin

Posted by st...@apache.org.
CB-8551 merged fetchNPM and fetchPlugReg into fetchPlugin


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

Branch: refs/heads/CB-8551
Commit: 862c2a6fe8d864c2efa3402f017b9a3f037e4b70
Parents: 58e3dfe
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 14:35:19 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 14:35:19 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 62 +++++++----------------
 1 file changed, 17 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/862c2a6f/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 75549f0..7c5a7ba 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -178,11 +178,11 @@ module.exports = {
             }
         })
         .then(function() {
-            return fetchPlugReg(plugin, client);
+            return fetchPlugin(plugin, client, false);
         })
         .fail(function() {
             module.exports.settings = null;
-            return fetchNPM(plugin,client);
+            return fetchPlugin(plugin, client, true);
         });
     },
  
@@ -213,7 +213,6 @@ module.exports = {
 };
 
 /**
- * @method initSettings
  * @param {Boolean} determines if we are using the npm registry
  * @return {Promise.<Object>} Promised settings.
  */
@@ -339,46 +338,19 @@ function makeRequest (method, where, what, cb_) {
 }
 
 /**
-     * @method fetchNPM
-     * @param {Array} with one element - the plugin id or "id@version"
-     * @return {Promise.<string>} Promised path to fetched package.
-     */
-function fetchNPM(plugin, client) {
-    return initSettings(true)
-    .then(function (settings) {
-        return Q.nfcall(npm.load)
-        // configure npm here instead of passing parameters to npm.load due to CB-7670
-        .then(function () {
-            for (var prop in settings){
-                npm.config.set(prop, settings[prop]);
-            }
-        });
-    })
-    .then(function() {
-        events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
-        return Q.ninvoke(npm.commands, 'cache', ['add', plugin]);
-    })
-    .then(function(info) {
-        var cl = (client === 'plugman' ? 'plugman' : 'cordova-cli');
-        bumpCounter(info, cl);
-        var pluginDir = path.resolve(npm.cache, info.name, info.version, 'package');
-        // Unpack the plugin that was added to the cache (CB-8154)
-        var package_tgz = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
-        return unpack.unpackTgz(package_tgz, pluginDir);
-    })
-    .fail(function(error) {
-        events.emit('log', 'Fetching from npm registry failed');
-        return Q.reject(error);
-    });
-}
-
-/**
- * @method fetchPlugReg
- * @param {Array} with one element - the plugin id or "id@version"
- * @return {Promise.<string>} Promised path to fetched package.
- */
-function fetchPlugReg(plugin, client) {
-    return initSettings()
+* @param {Array} with one element - the plugin id or "id@version"
+* @param useNpmRegistry: {Boolean} - to use the npm registry 
+* @return {Promise.<string>} Promised path to fetched package.
+*/
+function fetchPlugin(plugin, client, useNpmRegistry) {
+    //set registry variable to use in log messages below
+    var registryName;
+    if(useNpmRegistry){
+        registryName = 'npm';
+    } else {
+        registryName = 'cordova plugins registry';
+    }
+    return initSettings(useNpmRegistry)
     .then(function (settings) {
         return Q.nfcall(npm.load)
         // configure npm here instead of passing parameters to npm.load due to CB-7670
@@ -389,7 +361,7 @@ function fetchPlugReg(plugin, client) {
         });
     })
     .then(function() {
-        events.emit('log', 'Fetching plugin "' + plugin + '" via plugin registry');
+        events.emit('log', 'Fetching plugin "' + plugin + '" via ' + registryName);
         return Q.ninvoke(npm.commands, 'cache', ['add', plugin]);
     })
     .then(function(info) {
@@ -401,7 +373,7 @@ function fetchPlugReg(plugin, client) {
         return unpack.unpackTgz(package_tgz, pluginDir);
     })
     .fail(function(error) {
-        events.emit('log', 'Fetching from cordova plugin registry failed');
+        events.emit('log', 'Fetching from ' + registryName + ' failed');
         return Q.reject(error);
     });
 }


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


[8/8] cordova-lib git commit: CB-8551 fixed regex in isValidCprName

Posted by st...@apache.org.
CB-8551 fixed regex in isValidCprName


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

Branch: refs/heads/CB-8551
Commit: fc73432fa0cd3842891dbd2bbfc23acdc50a16c0
Parents: 037246e
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 16:37:11 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 16:37:11 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc73432f/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 079c5a0..cdbe90b 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -383,14 +383,17 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
  * @return {Boolean} if plugin id is reverse domain name style.
  */
 function isValidCprName(plugin) {
-    //Create regex that checks for at least two dots with any characters except @ to determine if it is reverse domain name style. Also makes sure not to match @VERSION.
-    var matches = /([^@]*\.[^@]*\.[^@]*[^@\d])/.exec(plugin)
-    
+    // Split @Version from the plugin if it exists.
+    var splitVersion = plugin.split('@');
+
+    //Create regex that checks for at least two dots with any characters except @ to determine if it is reverse domain name style.
+    var matches = /([^@]*\.[^@]*\.[^@]*)/.exec(splitVersion[0])
+
     //If matches equals null, plugin is not reverse domain name style
-    if(matches === null) { 
+    if(matches === null) {
         return false;
     } else {
-        warnIfIdInMapper(plugin, matches);
+        warnIfIdInMapper(splitVersion[0], matches);
     }
     return true 
 }


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


[2/8] cordova-lib git commit: CB-8551 updated warning message about using new plugin names

Posted by st...@apache.org.
CB-8551 updated warning message about using new plugin names


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

Branch: refs/heads/CB-8551
Commit: d9d956b29768e6c8828bfe7c7dcfdae6bf0557be
Parents: 305cecb
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 16:43:05 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 16:43:05 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d9d956b2/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index fba5053..ed0e221 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -421,8 +421,8 @@ function checkPluginID(plugin) {
         var packageName = pluginMapper[pluginID[0]];
         if(packageName) {
             events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + 
-                    packageName + ' and moved to npm. Please use `cordova plugin add ' + 
-                    packageName + '` next time.');
+                    packageName + '. You may not be getting the latest version! We suggest you `cordova plugin rm ' + 
+                    plugin + '` and `cordova plugin add ' + packageName + '`.');
         }
     }
     return Q(); 


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


[7/8] cordova-lib git commit: CB-8551 updated version of registry mapper and cordova plugin rm code

Posted by st...@apache.org.
CB-8551 updated version of registry mapper and cordova plugin rm code


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

Branch: refs/heads/CB-8551
Commit: 037246eab72b158dff182d83f1b391b3d451913a
Parents: 862c2a6
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 16:06:46 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 16:06:46 2015 -0800

----------------------------------------------------------------------
 cordova-lib/package.json                     |  2 +-
 cordova-lib/src/cordova/plugin.js            | 19 +++++++------------
 cordova-lib/src/plugman/registry/registry.js |  2 +-
 3 files changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/037246ea/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index b7eb682..3aba3db 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -19,7 +19,7 @@
   "dependencies": {
     "bplist-parser": "0.0.6",
     "cordova-js": "3.8.0",
-    "cordova-registry-mapper": "0.0.2",
+    "cordova-registry-mapper": "0.0.3",
     "d8": "0.4.4",
     "dep-graph": "1.1.0",
     "elementtree": "0.1.5",

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/037246ea/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index 46c4184..497722f 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -28,7 +28,7 @@ var cordova_util  = require('./util'),
     shell         = require('shelljs'),
     PluginInfoProvider = require('../PluginInfoProvider'),
     plugman       = require('../plugman/plugman'),
-    pluginMapper  = require('cordova-registry-mapper'),
+    pluginMapper  = require('cordova-registry-mapper').newToOld,
     events        = require('../events');
 
 // Returns a promise.
@@ -240,17 +240,12 @@ module.exports = function plugin(command, targets, opts) {
                     // Check if we have the plugin.
                     if (plugins.indexOf(target) < 0) {
                         // Convert target from package-name to package-id if necessary
-                        var keys = Object.keys(pluginMapper);
-                        //Traverse through pluginMapper values to see if it equals our target.
-                        //Cordova-plugin-device would get changes to org.apache.cordova.device
-                        for (var i = 0; i < keys.length; i++) {
-                            var val = pluginMapper[keys[i]]; 
-                            if(val === target) {
-                                events.emit('log', 'Plugin "' + target + '" is not present in the project. Converting value to "' + keys[i] + '" and trying again.');
-                                target = keys[i]; 
-                            }
-                        }
-                        
+                        // Cordova-plugin-device would get changed to org.apache.cordova.device
+                        var pluginId = pluginMapper[target]; 
+                        if(pluginId) {
+                            events.emit('log', 'Plugin "' + target + '" is not present in the project. Converting value to "' + pluginId + '" and trying again.');
+                            target = pluginId;
+                        }  
                         if (plugins.indexOf(target) < 0) {
                             return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `'+cordova_util.binname+' plugin list`.'));
                         }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/037246ea/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 7c5a7ba..079c5a0 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -27,7 +27,7 @@ var npm = require('npm'),
     rc = require('rc'),
     Q = require('q'),
     request = require('request'),
-    pluginMapper = require('cordova-registry-mapper'),
+    pluginMapper = require('cordova-registry-mapper').oldToNew,
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('../../events'),
     unpack = require('../../util/unpack'),


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


[4/8] cordova-lib git commit: CB-8551 split up changePluginId into two functions

Posted by st...@apache.org.
CB-8551 split up changePluginId into two functions


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

Branch: refs/heads/CB-8551
Commit: 1cae265e5107df801e765f2217780d2cb0283cff
Parents: aac6a1b
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 13:34:35 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 13:34:35 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 56 ++++++++++++++---------
 cordova-lib/src/plugman/uninstall.js         |  2 +-
 2 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1cae265e/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index ed0e221..b4773fc 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -167,7 +167,17 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return checkPluginID(plugin)
+        return Q()
+        .then(function() {
+            //check to see if pluginID is reverse domain name style
+            if(isValidCprName(plugin)){
+                return Q();
+            } else {
+                //fetch from npm
+                events.emit('verbose', 'Skipping CPR');
+                return Q.reject();
+            }
+        })
         .then(function() {
             return fetchPlugReg(plugin, client);
         })
@@ -399,31 +409,33 @@ function fetchPlugReg(plugin, client) {
 }
 
 /**
- * @method checkPluginID
  * @param {Array} with one element - the plugin id or "id@version"
- * @return {Promise.<string>} Promised path to fetched package.
+ * @return {Boolean} if pluginID is reverse domain name style.
  */
-function checkPluginID(plugin) {
+function isValidCprName(plugin) {
     //if plugin id is not reverse domain name style, skip CPR and fetch from npm
 
-    //Create regex to for digits, words and dashes and three dots in plugin ids which excludes @VERSION.
-    var re = /([\w-]*\.[\w-]*\.[\w-]*\.[\w-]*[^@])/;
-    var pluginID = plugin.match(re);
-    //If pluginID equals null, plugin is not reverse domain name style
-    if(pluginID === null) { 
-        events.emit('verbose', 'Skipping CPR');
-        //Q.reject will send us straight to the fail method which is where fetchNPM gets called.
-        return Q.reject();
+    //Create regex that checks for at least two dots with any characters except @ to determine if it is reverse domain name style.
+    var matches = /([^@]*\.[^@]*\.[^@]*)/.exec(plugin)
+
+    //If matches equals null, plugin is not reverse domain name style
+    if(matches === null) { 
+        return false;
     } else {
-        //Reverse domain name style plugin ID
-        //Check if a mapping exists for the pluginID
-        //if it does, warn the users to use package-name
-        var packageName = pluginMapper[pluginID[0]];
-        if(packageName) {
-            events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + 
-                    packageName + '. You may not be getting the latest version! We suggest you `cordova plugin rm ' + 
-                    plugin + '` and `cordova plugin add ' + packageName + '`.');
-        }
+        warnIfIdInMapper(plugin, matches);
+    }
+    return true 
+}
+
+/**
+ * @param {Array} - the plugin id or "id@version"
+ */
+function warnIfIdInMapper(plugin, pluginID) {
+    //Reverse domain name style plugin ID
+    //Check if a mapping exists for the pluginID
+    //if it does, warn the users to use package-name
+    var packageName = pluginMapper[pluginID[0]];
+    if(packageName) {
+        events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + packageName + '. You may not be getting the latest version! We suggest you `cordova plugin rm ' + plugin + '` and `cordova plugin add ' + packageName + '`.');
     }
-    return Q(); 
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1cae265e/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 6a84ea1..4d09996 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -47,7 +47,7 @@ function uninstall(platform, project_dir, id, plugins_dir, options) {
     options.is_top_level = true;
     options.pluginInfoProvider = options.pluginInfoProvider || new PluginInfoProvider();
     plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
-    
+
     // Allow `id` to be a path to a file.
     var xml_path = path.join(id, 'plugin.xml');
     if ( fs.existsSync(xml_path) ) {


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


[5/8] cordova-lib git commit: CB-8551 updated regex in isValidCprName to exclude matching @version

Posted by st...@apache.org.
CB-8551 updated regex in isValidCprName to exclude matching @version


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

Branch: refs/heads/CB-8551
Commit: 58e3dfeb94b9c40f3b6b629e5a1f1181fc0e58dc
Parents: 1cae265
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 14:18:46 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 14:18:46 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 25 ++++++++++-------------
 1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/58e3dfeb/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index b4773fc..75549f0 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -167,13 +167,12 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return Q()
-        .then(function() {
+        return Q.fcall(function() {
             //check to see if pluginID is reverse domain name style
             if(isValidCprName(plugin)){
                 return Q();
             } else {
-                //fetch from npm
+                //make promise fail so it will fetch from npm
                 events.emit('verbose', 'Skipping CPR');
                 return Q.reject();
             }
@@ -373,7 +372,6 @@ function fetchNPM(plugin, client) {
     });
 }
 
-
 /**
  * @method fetchPlugReg
  * @param {Array} with one element - the plugin id or "id@version"
@@ -410,14 +408,12 @@ function fetchPlugReg(plugin, client) {
 
 /**
  * @param {Array} with one element - the plugin id or "id@version"
- * @return {Boolean} if pluginID is reverse domain name style.
+ * @return {Boolean} if plugin id is reverse domain name style.
  */
 function isValidCprName(plugin) {
-    //if plugin id is not reverse domain name style, skip CPR and fetch from npm
-
-    //Create regex that checks for at least two dots with any characters except @ to determine if it is reverse domain name style.
-    var matches = /([^@]*\.[^@]*\.[^@]*)/.exec(plugin)
-
+    //Create regex that checks for at least two dots with any characters except @ to determine if it is reverse domain name style. Also makes sure not to match @VERSION.
+    var matches = /([^@]*\.[^@]*\.[^@]*[^@\d])/.exec(plugin)
+    
     //If matches equals null, plugin is not reverse domain name style
     if(matches === null) { 
         return false;
@@ -428,13 +424,14 @@ function isValidCprName(plugin) {
 }
 
 /**
- * @param {Array} - the plugin id or "id@version"
+ * @param plugin:{Array} - the plugin id or "id@version"
+ * @param matches:{Array} - the array containing the RDN style plugin id without @version
  */
-function warnIfIdInMapper(plugin, pluginID) {
+function warnIfIdInMapper(plugin, matches) {
     //Reverse domain name style plugin ID
-    //Check if a mapping exists for the pluginID
+    //Check if a mapping exists for the plugin id
     //if it does, warn the users to use package-name
-    var packageName = pluginMapper[pluginID[0]];
+    var packageName = pluginMapper[matches[0]];
     if(packageName) {
         events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + packageName + '. You may not be getting the latest version! We suggest you `cordova plugin rm ' + plugin + '` and `cordova plugin add ' + packageName + '`.');
     }


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


[3/8] cordova-lib git commit: CB-8551: removed unnecessary fail method in fetch

Posted by st...@apache.org.
CB-8551: removed unnecessary fail method in fetch


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

Branch: refs/heads/CB-8551
Commit: aac6a1b138b06b5fc8ac538aa6b07c2bea659537
Parents: d9d956b
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 16:46:00 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 16:46:00 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/aac6a1b1/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 4e58a68..dd78c84 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -146,9 +146,6 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
         checkID(options.expected_id, result.pinfo);
         metadata.save_fetch_metadata(plugins_dir, result.pinfo.id, { source: result.fetchJsonSource });
         return result.dest;
-    })            
-    .fail(function(error) {
-        return Q.reject(error);
     });
 }
 


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