Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 129DC17575 for ; Thu, 5 Mar 2015 00:37:31 +0000 (UTC) Received: (qmail 24825 invoked by uid 500); 5 Mar 2015 00:37:30 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 24716 invoked by uid 500); 5 Mar 2015 00:37:30 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 24541 invoked by uid 99); 5 Mar 2015 00:37:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2015 00:37:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 662B2E03C8; Thu, 5 Mar 2015 00:37:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Thu, 05 Mar 2015 00:37:34 -0000 Message-Id: <9472c75c22ae4d2eaaed13ca07071f18@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [5/8] cordova-lib git commit: CB-8551 updated regex in isValidCprName to exclude matching @version 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 Authored: Wed Mar 4 14:18:46 2015 -0800 Committer: Steve Gill 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