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/06 01:26:37 UTC

[01/27] cordova-lib git commit: plugins get fetched from npm, then cordova registry if needed

Repository: cordova-lib
Updated Branches:
  refs/heads/master 811ad9577 -> 356356d06


plugins get fetched from npm, then cordova registry if needed


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

Branch: refs/heads/master
Commit: 4cf298cab1af6b02ddb9ee96df597bfe5ef5b1d3
Parents: 049548a
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 17:19:43 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Jan 23 17:20:15 2015 -0800

----------------------------------------------------------------------
 cordova-lib/package.json                     |  9 +--
 cordova-lib/src/plugman/registry/registry.js | 78 +++++++++++++++--------
 2 files changed, 58 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4cf298ca/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 70ded65..47543ae 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -18,6 +18,9 @@
   "engineStrict": true,
   "dependencies": {
     "bplist-parser": "0.0.6",
+    "cordova-js": "3.7.3",
+    "cordova-registry-mapper": "0.0.2",
+    "d8": "0.4.4",
     "dep-graph": "1.1.0",
     "elementtree": "0.1.5",
     "glob": "4.0.6",
@@ -33,13 +36,11 @@
     "semver": "2.0.11",
     "shelljs": "0.3.0",
     "tar": "1.0.2",
+    "through2": "0.6.3",
     "underscore": "1.7.0",
-    "xcode": "0.6.7",
-    "cordova-js": "3.7.3",
-    "d8": "0.4.4",
     "unorm": "1.3.3",
     "valid-identifier": "0.0.1",
-    "through2": "0.6.3"
+    "xcode": "0.6.7"
   },
   "devDependencies": {
     "istanbul": "^0.3.4",

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4cf298ca/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 3643eb3..a9ce9ab 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -30,6 +30,7 @@ var npm = require('npm'),
     rc = require('rc'),
     Q = require('q'),
     request = require('request'),
+    pluginMapper = require('cordova-registry-mapper');
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('../../events'),
     unpack = require('../../util/unpack'),
@@ -327,7 +328,6 @@ function makeRequest (method, where, what, cb_) {
      * @return {Promise.<string>} Promised path to fetched package.
      */
 function fetchNPM(plugin, client) {
-    events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
     return initSettingsNPM()
     .then(function (settings) {
         return Q.nfcall(npm.load)
@@ -338,7 +338,35 @@ function fetchNPM(plugin, client) {
             }
         });
     })
+    .then(function(){
+        //if plugin variable is in reverse domain name style, look up the package-name in cordova-registry-mapper module
+
+        //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 true, pluginID is reverse domain style
+        if(pluginID != null) { 
+            //grab the @VERSION from the end of the plugin string if it exists
+            re = /(@.*)/;
+            var versionStr = plugin.match(re);
+
+            //Check if a mapping exists for the pluginID
+            //if it does, set the plugin variable to your packageName
+            //if it doesn't, don't change the plugin variable
+            var packageName = pluginMapper[pluginID[0]];
+            if(packageName) {
+                //if @VERSION exists, concat it to packageName
+                if(versionStr != null) {
+                    packageName += versionStr[0];
+                }
+                events.emit('verbose', 'Converted ' + plugin + ' to ' + packageName + ' for npm fetch');
+                plugin = packageName;
+            }
+        }
+        return true;
+    })
     .then(function() {
+        events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
         return Q.ninvoke(npm.commands, 'cache', ['add', plugin]);
     })
     .then(function(info) {
@@ -358,30 +386,30 @@ function fetchNPM(plugin, client) {
  * @return {Promise.<string>} Promised path to fetched package.
  */
 function fetchPlugReg(plugin, client) {
-    events.emit('log', 'Fetching plugin "' + plugin + '" via plugin registry');
-        return initSettings()
-        .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() {
-            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() {
-            events.emit('log', 'Fetching from plugin registry failed');
+    return initSettings()
+    .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 plugin registry');
+        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() {
+        events.emit('log', 'Fetching from plugin registry failed');
+    });
 }
 


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


[10/27] cordova-lib git commit: CB-8551 added npm fetching as fallback

Posted by st...@apache.org.
CB-8551 added npm fetching as fallback


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

Branch: refs/heads/master
Commit: db4d274b6b46ec92c775c065ff2ec0c0439482b8
Parents: 2f91b4f
Author: Steve Gill <st...@gmail.com>
Authored: Wed Feb 25 22:53:52 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Feb 25 22:53:52 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js             |  5 +-
 cordova-lib/src/plugman/registry/registry.js | 88 +++++++----------------
 2 files changed, 29 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/db4d274b/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index dd78c84..416a7b6 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -133,7 +133,7 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                         id: plugin_src
                     }
                 };
-            });
+            })
         }).then(function(result) {
             options.plugin_src_dir = result.pinfo.dir;
             return Q.when(copyPlugin(result.pinfo, plugins_dir, options.link && result.fetchJsonSource.type == 'local'))
@@ -146,6 +146,9 @@ 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);
     });
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/db4d274b/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 786cb6e..2943a77 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -91,7 +91,7 @@ module.exports = {
             if(fs.existsSync(path.join(dir,'package.json'))) {
                 events.emit('verbose', 'temporarily moving existing package.json so we can create one to publish to the cordova plugins registry');
                 if(fs.existsSync(path.join(dir,'package.json1'))) {
-                    //package.json1 already exists, maybe due to an past failed attempt to publish
+                    //package.json1 already exists, maybe due to a failed past attempt to publish
                     //we will assume that the rename has already happened.
                     events.emit('verbose', 'package.json1 already exists. Will use');
                 } else {
@@ -167,12 +167,11 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return fetchNPM(plugin, client)
+        return fetchPlugReg(plugin, client)
         .fail(function() {
-            events.emit('log', 'Fetching from npm failed');
-            //reset settings to fetch from cordova registry
+            events.emit('log', 'Fetching from cordova plugin registry failed');
             module.exports.settings = null;
-            return fetchPlugReg(plugin,client);
+            return fetchNPM(plugin,client);
         });
     },
  
@@ -204,10 +203,18 @@ module.exports = {
 
 /**
  * @method initSettings
+ * @param {Boolean} using npm registry
  * @return {Promise.<Object>} Promised settings.
  */
-function initSettings() {
+function initSettings(npm) {
     var settings = module.exports.settings;
+    var registryURL = 'http://registry.cordova.io';
+
+    //if npm is true, use npm registry
+    if(npm) {
+        registryURL = 'http://registry.npmjs.org';
+    }
+
     // check if settings already set
     if(settings !== null) return Q(settings);
 
@@ -222,42 +229,22 @@ function initSettings() {
     module.exports.settings =
     rc('plugman', {
         cache: plugmanCacheDir,
-        registry: 'http://registry.cordova.io',
+        registry: registryURL,
         logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
         userconfig: path.resolve(plugmanConfigDir, 'config'),
         'cache-min': oneDay
     });
-    return Q(settings);
-}
-
-/**
- * @method initSettingsNPM
- * @return {Promise.<Object>} Promised settings.
- */
-function initSettingsNPM() {
-    var settings = module.exports.settings;
-    // check if settings already set
-    if(settings !== null) return Q(settings);
 
-    // setting up settings
-    // obviously if settings dir does not exist settings is going to be empty
-    if(!fs.existsSync(plugmanConfigDir)) {
-        fs.mkdirSync(plugmanConfigDir);
-        fs.mkdirSync(plugmanCacheDir);
+    // if npm is true, use npm registry. 
+    // ~/.plugman/config overides the above cofig if it exists. 
+    // Need to reset the registry value in settings 
+    if(npm) {
+        settings.registry = 'http://registry.npmjs.org';
     }
 
-    settings =
-    module.exports.settings =
-    rc('plugman', {
-        cache: plugmanCacheDir,
-        registry: 'http://registry.npmjs.org',
-        logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
-        'cache-min': oneDay
-    });
     return Q(settings);
 }
 
-
 // Send a message to the registry to update download counts.
 function bumpCounter(info, client) {
     // Update the download count for this plugin.
@@ -342,7 +329,7 @@ function makeRequest (method, where, what, cb_) {
      * @return {Promise.<string>} Promised path to fetched package.
      */
 function fetchNPM(plugin, client) {
-    return initSettingsNPM()
+    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
@@ -352,33 +339,6 @@ function fetchNPM(plugin, client) {
             }
         });
     })
-    .then(function(){
-        //if plugin variable is in reverse domain name style, look up the package-name in cordova-registry-mapper module
-
-        //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 true, pluginID is reverse domain style
-        if(pluginID !== null) { 
-            //grab the @VERSION from the end of the plugin string if it exists
-            re = /(@.*)/;
-            var versionStr = plugin.match(re);
-
-            //Check if a mapping exists for the pluginID
-            //if it does, set the plugin variable to your packageName
-            //if it doesn't, don't change the plugin variable
-            var packageName = pluginMapper[pluginID[0]];
-            if(packageName) {
-                //if @VERSION exists, concat it to packageName
-                if(versionStr !== null) {
-                    packageName += versionStr[0];
-                }
-                events.emit('verbose', 'Converted ' + plugin + ' to ' + packageName + ' for npm fetch');
-                plugin = packageName;
-            }
-        }
-        return true;
-    })
     .then(function() {
         events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
         return Q.ninvoke(npm.commands, 'cache', ['add', plugin]);
@@ -390,6 +350,11 @@ function fetchNPM(plugin, client) {
         // 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) {
+        //console.log(error)
+        events.emit('log', 'Fetching from npm registry failed');
+        return Q.reject(error)
     });
 }
 
@@ -421,9 +386,6 @@ function fetchPlugReg(plugin, client) {
         // 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() {
-        events.emit('log', 'Fetching from plugin registry failed');
     });
 }
 


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


[15/27] cordova-lib git commit: Merge branch 'CB-8551' of https://git-wip-us.apache.org/repos/asf/cordova-lib into CB-8551

Posted by st...@apache.org.
Merge branch 'CB-8551' of https://git-wip-us.apache.org/repos/asf/cordova-lib into CB-8551


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

Branch: refs/heads/master
Commit: f74768834dcd5b032a82e61f9b57867f43e406db
Parents: d49159b 45af7f8
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 00:41:37 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 00:41:37 2015 -0800

----------------------------------------------------------------------

----------------------------------------------------------------------



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


[16/27] cordova-lib git commit: cleaning up whitespace

Posted by st...@apache.org.
cleaning up whitespace


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

Branch: refs/heads/master
Commit: cfdcc066ecea14d77d88da8c9de2076274d7649a
Parents: f747688
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 00:52:29 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 00:52:29 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/plugin.js    | 5 -----
 cordova-lib/src/plugman/uninstall.js | 1 +
 2 files changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cfdcc066/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index 205af3f..46c4184 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -237,11 +237,8 @@ module.exports = function plugin(command, targets, opts) {
             return hooksRunner.fire('before_plugin_rm', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
-                   /*
-*/
                     // 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.
@@ -255,7 +252,6 @@ module.exports = function plugin(command, targets, opts) {
                         }
                         
                         if (plugins.indexOf(target) < 0) {
-
                             return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `'+cordova_util.binname+' plugin list`.'));
                         }
                     }
@@ -299,7 +295,6 @@ module.exports = function plugin(command, targets, opts) {
                 opts.cordova = { plugins: cordova_util.findPlugins(path.join(projectRoot, 'plugins')) };
                 return hooksRunner.fire('after_plugin_rm', opts);
             });
-
         case 'search':
             return hooksRunner.fire('before_plugin_search')
             .then(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cfdcc066/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index ecb4518..6a84ea1 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -47,6 +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


[26/27] cordova-lib git commit: CB-8551 bumped cordova-registry-mapper version

Posted by st...@apache.org.
CB-8551 bumped cordova-registry-mapper 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/6db73f4a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/6db73f4a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/6db73f4a

Branch: refs/heads/master
Commit: 6db73f4afa45106e81cf05eade9f1a50b2f4643c
Parents: ca395cf
Author: Steve Gill <st...@gmail.com>
Authored: Thu Mar 5 16:21:00 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Thu Mar 5 16:21:00 2015 -0800

----------------------------------------------------------------------
 cordova-lib/package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6db73f4a/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 3aba3db..e65a222 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.3",
+    "cordova-registry-mapper": "1.x",
     "d8": "0.4.4",
     "dep-graph": "1.1.0",
     "elementtree": "0.1.5",


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


[25/27] cordova-lib git commit: CB-8551 fixed jshint errors

Posted by st...@apache.org.
CB-8551 fixed jshint errors


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

Branch: refs/heads/master
Commit: ca395cfe4d9a130302c7ae4f57e189f2cbd9227e
Parents: fc73432
Author: Steve Gill <st...@gmail.com>
Authored: Wed Mar 4 17:00:09 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Mar 4 17:00:09 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ca395cfe/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 cdbe90b..9e08631 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -185,7 +185,7 @@ module.exports = {
             return fetchPlugin(plugin, client, true);
         });
     },
- 
+
     /**
      * @method info
      * @param {String} name Plugin name
@@ -218,8 +218,8 @@ module.exports = {
  */
 function initSettings(useNpmRegistry) {
     var settings = module.exports.settings;
-    const NPM_REG_URL = 'http://registry.npmjs.org';
-    const CPR_REG_URL = 'http://registry.cordova.io';
+    var NPM_REG_URL = 'http://registry.npmjs.org';
+    var CPR_REG_URL = 'http://registry.cordova.io';
     var registryURL;
 
     //if useNpmRegistry is true, use npm registry
@@ -383,30 +383,30 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
  * @return {Boolean} if plugin id is reverse domain name style.
  */
 function isValidCprName(plugin) {
-    // Split @Version from the plugin if it exists.
+    // Split @Version from the plugin id 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])
+    var matches = /([^@]*\.[^@]*\.[^@]*)/.exec(splitVersion[0]);
 
     //If matches equals null, plugin is not reverse domain name style
     if(matches === null) {
         return false;
     } else {
-        warnIfIdInMapper(splitVersion[0], matches);
+        warnIfIdInMapper(splitVersion[0]);
     }
-    return true 
+    return true;
 }
 
 /**
  * @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, matches) {
+function warnIfIdInMapper(plugin) {
     //Reverse domain name style plugin ID
     //Check if a mapping exists for the plugin id
     //if it does, warn the users to use package-name
-    var packageName = pluginMapper[matches[0]];
+    var packageName = pluginMapper[plugin];
     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


[12/27] cordova-lib git commit: CB-8551 added plugin-name support for removing plugins.

Posted by st...@apache.org.
CB-8551 added plugin-name support for removing plugins.


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

Branch: refs/heads/master
Commit: c063fdec756ff1dac6edb5e5dff1c72d2c985c1f
Parents: 9b36f20
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 00:17:29 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 00:27:18 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/plugin.js            | 32 ++++++++++++++---------
 cordova-lib/src/plugman/fetch.js             |  2 +-
 cordova-lib/src/plugman/registry/registry.js | 12 ++++-----
 cordova-lib/src/plugman/uninstall.js         |  1 -
 4 files changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index 0a8855f..db3c6d9 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -237,20 +237,27 @@ module.exports = function plugin(command, targets, opts) {
             return hooksRunner.fire('before_plugin_rm', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
-                    // 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) {
-                            target = keys[i];
-                        }
-                    }
-
+                   /*
+*/
                     // Check if we have the plugin.
                     if (plugins.indexOf(target) < 0) {
-                        return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `'+cordova_util.binname+' plugin list`.'));
+                    
+                        // 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]; 
+                            }
+                        }
+                        
+                        if (plugins.indexOf(target) < 0) {
+
+                            return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `'+cordova_util.binname+' plugin list`.'));
+                        }
                     }
 
                     // Iterate over all installed platforms and uninstall.
@@ -292,6 +299,7 @@ module.exports = function plugin(command, targets, opts) {
                 opts.cordova = { plugins: cordova_util.findPlugins(path.join(projectRoot, 'plugins')) };
                 return hooksRunner.fire('after_plugin_rm', opts);
             });
+
         case 'search':
             return hooksRunner.fire('before_plugin_search')
             .then(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 416a7b6..4e58a68 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -133,7 +133,7 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                         id: plugin_src
                     }
                 };
-            })
+            });
         }).then(function(result) {
             options.plugin_src_dir = result.pinfo.dir;
             return Q.when(copyPlugin(result.pinfo, plugins_dir, options.link && result.fetchJsonSource.type == 'local'))

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/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 75e234c..fb574b5 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -355,7 +355,7 @@ function fetchNPM(plugin, client) {
     })
     .fail(function(error) {
         events.emit('log', 'Fetching from npm registry failed');
-        return Q.reject(error)
+        return Q.reject(error);
     });
 }
 
@@ -390,8 +390,8 @@ function fetchPlugReg(plugin, client) {
     })
     .fail(function(error) {
         events.emit('log', 'Fetching from cordova plugin registry failed');
-        return Q.reject(error)
-    });;
+        return Q.reject(error);
+    });
 }
 
 /**
@@ -416,9 +416,9 @@ function checkPluginID(plugin) {
         //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 + ' and moved to npm. Please use `cordova plugin add '
-                    + packageName + '` next time.');
+            events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + 
+                    packageName + ' and moved to npm. Please use `cordova plugin add ' + 
+                    packageName + '` next time.');
         }
     }
     return Q(); 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 4d09996..ecb4518 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -47,7 +47,6 @@ 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


[07/27] cordova-lib git commit: Merge branch 'npmfetch' of https://github.com/stevengill/cordova-lib into npmfetch

Posted by st...@apache.org.
Merge branch 'npmfetch' of https://github.com/stevengill/cordova-lib into npmfetch


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

Branch: refs/heads/master
Commit: fee6daaf5a1a68c954fe28404784510176b269ff
Parents: 6e24960 ba4d2a6
Author: Steve Gill <st...@gmail.com>
Authored: Mon Jan 26 17:00:27 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Mon Jan 26 17:00:27 2015 -0800

----------------------------------------------------------------------

----------------------------------------------------------------------



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


[04/27] cordova-lib git commit: fixed minor errors so npm test runs

Posted by st...@apache.org.
fixed minor errors so npm test runs


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

Branch: refs/heads/master
Commit: 6e24960f06030c8f790f4bf03777a154e8ea6c0b
Parents: f919820
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 17:31:37 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Mon Jan 26 16:59:29 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6e24960f/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 f72c109..7f9ff71 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'),
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('../../events'),
     unpack = require('../../util/unpack'),
@@ -342,7 +342,7 @@ function fetchNPM(plugin, client) {
         var re = /([\w-]*\.[\w-]*\.[\w-]*\.[\w-]*[^@])/;
         var pluginID = plugin.match(re);
         //If true, pluginID is reverse domain style
-        if(pluginID != null) { 
+        if(pluginID !== null) { 
             //grab the @VERSION from the end of the plugin string if it exists
             re = /(@.*)/;
             var versionStr = plugin.match(re);
@@ -353,7 +353,7 @@ function fetchNPM(plugin, client) {
             var packageName = pluginMapper[pluginID[0]];
             if(packageName) {
                 //if @VERSION exists, concat it to packageName
-                if(versionStr != null) {
+                if(versionStr !== null) {
                     packageName += versionStr[0];
                 }
                 events.emit('verbose', 'Converted ' + plugin + ' to ' + packageName + ' for npm fetch');


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


[18/27] 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/master
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


[03/27] cordova-lib git commit: fixed minor errors so npm test runs

Posted by st...@apache.org.
fixed minor errors so npm test runs


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

Branch: refs/heads/master
Commit: ba4d2a6d954001e16a73a6091cfe429fabf3fc8a
Parents: 4cf298c
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 17:31:37 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Jan 23 17:31:37 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ba4d2a6d/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 a9ce9ab..5b2a2b3 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -30,7 +30,7 @@ var npm = require('npm'),
     rc = require('rc'),
     Q = require('q'),
     request = require('request'),
-    pluginMapper = require('cordova-registry-mapper');
+    pluginMapper = require('cordova-registry-mapper'),
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('../../events'),
     unpack = require('../../util/unpack'),
@@ -345,7 +345,7 @@ function fetchNPM(plugin, client) {
         var re = /([\w-]*\.[\w-]*\.[\w-]*\.[\w-]*[^@])/;
         var pluginID = plugin.match(re);
         //If true, pluginID is reverse domain style
-        if(pluginID != null) { 
+        if(pluginID !== null) { 
             //grab the @VERSION from the end of the plugin string if it exists
             re = /(@.*)/;
             var versionStr = plugin.match(re);
@@ -356,7 +356,7 @@ function fetchNPM(plugin, client) {
             var packageName = pluginMapper[pluginID[0]];
             if(packageName) {
                 //if @VERSION exists, concat it to packageName
-                if(versionStr != null) {
+                if(versionStr !== null) {
                     packageName += versionStr[0];
                 }
                 events.emit('verbose', 'Converted ' + plugin + ' to ' + packageName + ' for npm fetch');


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


[17/27] cordova-lib git commit: CB-8551 cleaned up initSetings function

Posted by st...@apache.org.
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/master
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


[06/27] cordova-lib git commit: plugins get fetched from npm, then cordova registry if needed

Posted by st...@apache.org.
plugins get fetched from npm, then cordova registry if needed


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

Branch: refs/heads/master
Commit: f91982059fa412746b6b266d6312ee27e5b34bd8
Parents: 7db3df1
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 17:19:43 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Mon Jan 26 16:59:29 2015 -0800

----------------------------------------------------------------------
 cordova-lib/package.json                     |  9 +--
 cordova-lib/src/plugman/registry/registry.js | 78 +++++++++++++++--------
 2 files changed, 58 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9198205/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 300da39..b44cf19 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -18,6 +18,9 @@
   "engineStrict": true,
   "dependencies": {
     "bplist-parser": "0.0.6",
+    "cordova-js": "3.7.3",
+    "cordova-registry-mapper": "0.0.2",
+    "d8": "0.4.4",
     "dep-graph": "1.1.0",
     "elementtree": "0.1.5",
     "glob": "4.0.6",
@@ -33,13 +36,11 @@
     "semver": "2.0.11",
     "shelljs": "0.3.0",
     "tar": "1.0.2",
+    "through2": "0.6.3",
     "underscore": "1.7.0",
-    "xcode": "0.6.7",
-    "cordova-js": "3.7.3",
-    "d8": "0.4.4",
     "unorm": "1.3.3",
     "valid-identifier": "0.0.1",
-    "through2": "0.6.3"
+    "xcode": "0.6.7"
   },
   "devDependencies": {
     "istanbul": "^0.3.4",

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f9198205/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 d6e86d0..f72c109 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -27,6 +27,7 @@ var npm = require('npm'),
     rc = require('rc'),
     Q = require('q'),
     request = require('request'),
+    pluginMapper = require('cordova-registry-mapper');
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('../../events'),
     unpack = require('../../util/unpack'),
@@ -324,7 +325,6 @@ function makeRequest (method, where, what, cb_) {
      * @return {Promise.<string>} Promised path to fetched package.
      */
 function fetchNPM(plugin, client) {
-    events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
     return initSettingsNPM()
     .then(function (settings) {
         return Q.nfcall(npm.load)
@@ -335,7 +335,35 @@ function fetchNPM(plugin, client) {
             }
         });
     })
+    .then(function(){
+        //if plugin variable is in reverse domain name style, look up the package-name in cordova-registry-mapper module
+
+        //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 true, pluginID is reverse domain style
+        if(pluginID != null) { 
+            //grab the @VERSION from the end of the plugin string if it exists
+            re = /(@.*)/;
+            var versionStr = plugin.match(re);
+
+            //Check if a mapping exists for the pluginID
+            //if it does, set the plugin variable to your packageName
+            //if it doesn't, don't change the plugin variable
+            var packageName = pluginMapper[pluginID[0]];
+            if(packageName) {
+                //if @VERSION exists, concat it to packageName
+                if(versionStr != null) {
+                    packageName += versionStr[0];
+                }
+                events.emit('verbose', 'Converted ' + plugin + ' to ' + packageName + ' for npm fetch');
+                plugin = packageName;
+            }
+        }
+        return true;
+    })
     .then(function() {
+        events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
         return Q.ninvoke(npm.commands, 'cache', ['add', plugin]);
     })
     .then(function(info) {
@@ -355,30 +383,30 @@ function fetchNPM(plugin, client) {
  * @return {Promise.<string>} Promised path to fetched package.
  */
 function fetchPlugReg(plugin, client) {
-    events.emit('log', 'Fetching plugin "' + plugin + '" via plugin registry');
-        return initSettings()
-        .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() {
-            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() {
-            events.emit('log', 'Fetching from plugin registry failed');
+    return initSettings()
+    .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 plugin registry');
+        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() {
+        events.emit('log', 'Fetching from plugin registry failed');
+    });
 }
 


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


[27/27] cordova-lib git commit: Merge branch 'master' into CB-8551

Posted by st...@apache.org.
Merge branch 'master' into CB-8551


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

Branch: refs/heads/master
Commit: 356356d068af981930b6cc7a47d71dd18a7140a4
Parents: 6db73f4 811ad95
Author: Steve Gill <st...@gmail.com>
Authored: Thu Mar 5 16:21:30 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Thu Mar 5 16:21:30 2015 -0800

----------------------------------------------------------------------
 .../src/cordova/metadata/android_parser.js      | 31 +++++++++-----------
 1 file changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------



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


[09/27] cordova-lib git commit: fixed merge conflict

Posted by st...@apache.org.
fixed merge conflict


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

Branch: refs/heads/master
Commit: 2f91b4fa1635654c123147247a2eb04a460544ae
Parents: 38a0afb 608977d
Author: Steve Gill <st...@gmail.com>
Authored: Wed Feb 25 14:17:16 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Wed Feb 25 14:17:16 2015 -0800

----------------------------------------------------------------------
 .gitignore                                      |   2 +
 cordova-lib/.jshintignore                       |   2 +
 cordova-lib/package.json                        |   3 +-
 cordova-lib/spec-cordova/HooksRunner.spec.js    |   4 +-
 cordova-lib/spec-cordova/prepare.spec.js        |   1 +
 cordova-lib/spec-cordova/restore.spec.js        |  71 ---
 cordova-lib/spec-cordova/save.spec.js           |  67 ---
 cordova-lib/spec-plugman/.jshintrc              |  11 +
 cordova-lib/spec-plugman/add_platform.spec.js   |  16 +-
 cordova-lib/spec-plugman/common.js              |   2 +-
 cordova-lib/spec-plugman/fetch.spec.js          |  26 +-
 .../spec-plugman/install-browserify.spec.js     |  37 +-
 cordova-lib/spec-plugman/install.spec.js        |  32 +-
 cordova-lib/spec-plugman/platform.spec.js       |   8 +-
 .../platforms/amazon-fireos.spec.js             |   2 +
 .../spec-plugman/platforms/android.spec.js      | 237 ++++----
 .../spec-plugman/platforms/blackberry10.spec.js |  10 +-
 .../spec-plugman/platforms/common.spec.js       |  21 +-
 cordova-lib/spec-plugman/platforms/ios.spec.js  |  80 ++-
 .../spec-plugman/platforms/tizen.spec.js        |  15 +-
 .../spec-plugman/platforms/windows.spec.js      | 419 ++++++++++++++
 .../spec-plugman/platforms/windows8.spec.js     | 140 -----
 cordova-lib/spec-plugman/platforms/wp8.spec.js  |  10 +-
 .../org.test.plugins.dummyplugin/extra.gradle   |   1 +
 .../plugin-lib/AndroidManifest.xml              |   5 +
 .../plugin-lib/libFile                          |   1 +
 .../plugin-lib/project.properties               |   1 +
 .../org.test.plugins.dummyplugin/plugin.xml     |  25 +-
 .../src/windows/dummer.js                       |   1 +
 .../src/windows/dummy1.dll                      |   0
 .../src/windows/dummy1.vcxproj                  |   7 +
 .../src/windows/dummy2.dll                      |   0
 .../src/windows/dummy2.vcxproj                  |   7 +
 .../src/windows/dummy3.dll                      |   0
 .../src/windows/dummy3.vcxproj                  |   7 +
 .../src/windows/dummy4.dll                      |   0
 .../src/windows/dummy4.vcxproj                  |   7 +
 .../src/windows8/dummer.js                      |   1 -
 .../org.test.plugins.faultyplugin/plugin.xml    |  14 +-
 .../src/windows/faultyPlugin.js                 |   1 +
 .../src/windows8/faultyPlugin.js                |   1 -
 cordova-lib/spec-plugman/prepare.spec.js        |   9 +-
 .../projects/android_install/local.properties   |   1 +
 .../projects/android_one/project.properties     |   4 +
 .../projects/android_uninstall/local.properties |   1 +
 .../SampleApp.xcodeproj/project.pbxproj         |  44 +-
 .../SampleApp.xcodeproj/project.pbxproj         |  44 +-
 .../projects/windows/CordovaApp.Phone.jsproj    |  99 ++++
 .../projects/windows/CordovaApp.Windows.jsproj  |  99 ++++
 .../windows/CordovaApp.Windows80.jsproj         |  93 ++++
 .../projects/windows/CordovaApp.projitems       |  32 ++
 .../projects/windows/CordovaApp.shproj          |  30 +
 .../projects/windows/CordovaApp.sln             | 134 +++++
 .../projects/windows/CordovaApp.vs2012.sln      |  64 +++
 .../windows/CordovaApp_TemporaryKey.pfx         | Bin 0 -> 2544 bytes
 .../spec-plugman/projects/windows/VERSION       |   1 +
 .../spec-plugman/projects/windows/config.xml    |  14 +
 .../projects/windows/package.phone.appxmanifest |  57 ++
 .../windows/package.windows.appxmanifest        |  58 ++
 .../windows/package.windows80.appxmanifest      |  50 ++
 .../spec-plugman/registry/registry.spec.js      |   4 +-
 .../spec-plugman/uninstall-browserify.spec.js   |  33 +-
 cordova-lib/spec-plugman/uninstall.spec.js      |  47 +-
 .../spec-plugman/util/action-stack.spec.js      |   3 +-
 .../spec-plugman/util/config-changes.spec.js    |  10 +-
 cordova-lib/spec-plugman/util/csproj.spec.js    |  13 +-
 .../spec-plugman/util/dependencies.spec.js      |  20 +-
 cordova-lib/spec-plugman/util/plugins.spec.js   |   6 +-
 .../spec-plugman/util/xml-helpers.spec.js       |  34 +-
 cordova-lib/spec-plugman/wrappers.spec.js       |   5 +-
 cordova-lib/src/PluginInfo.js                   |  27 +-
 cordova-lib/src/configparser/ConfigParser.js    |  22 +-
 cordova-lib/src/cordova/compile.js              |   6 +-
 cordova-lib/src/cordova/cordova.js              |   2 -
 .../src/cordova/metadata/firefoxos_parser.js    |  40 ++
 cordova-lib/src/cordova/platform.js             |  74 ++-
 cordova-lib/src/cordova/platformsConfig.json    |   8 +-
 cordova-lib/src/cordova/plugin.js               | 114 +++-
 cordova-lib/src/cordova/prepare.js              |  30 +-
 cordova-lib/src/cordova/restore-util.js         | 110 ++++
 cordova-lib/src/cordova/restore.js              | 104 ----
 cordova-lib/src/cordova/save.js                 | 161 ------
 cordova-lib/src/cordova/util.js                 |  18 +-
 cordova-lib/src/plugman/createpackagejson.js    |  57 ++
 cordova-lib/src/plugman/init-defaults.js        | 141 +++++
 cordova-lib/src/plugman/install.js              |  30 +-
 cordova-lib/src/plugman/platforms/android.js    |  76 ++-
 cordova-lib/src/plugman/platforms/ios.js        |  21 +-
 cordova-lib/src/plugman/platforms/windows.js    |  52 +-
 cordova-lib/src/plugman/plugman.js              |  11 +-
 cordova-lib/src/plugman/prepare.js              |   2 +-
 cordova-lib/src/plugman/registry/manifest.js    |   2 +-
 cordova-lib/src/plugman/registry/registry.js    |  21 +-
 cordova-lib/src/plugman/uninstall.js            |  25 +-
 cordova-lib/src/plugman/util/action-stack.js    |  14 +-
 cordova-lib/src/plugman/util/android-project.js | 150 ++---
 cordova-lib/src/util/windows/jsproj.js          | 309 -----------
 cordova-lib/src/util/windows/jsprojManager.js   | 544 +++++++++++++++++++
 98 files changed, 2975 insertions(+), 1500 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/2f91b4fa/cordova-lib/package.json
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/2f91b4fa/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/2f91b4fa/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------


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


[19/27] 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/master
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


[02/27] cordova-lib git commit: plugins are fetched from npm before cordova registry

Posted by st...@apache.org.
plugins are fetched from npm before cordova registry


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

Branch: refs/heads/master
Commit: 049548a5994d4efcd85560c81526bcd0cd4c3ed5
Parents: 75687fb
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 15:25:33 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Jan 23 17:20:15 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js             |   1 -
 cordova-lib/src/plugman/registry/registry.js | 121 ++++++++++++++++++----
 2 files changed, 99 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/049548a5/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 1d4d0a4..136b849 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -128,7 +128,6 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                 ));
             }
             // If not found in local search path, fetch from the registry.
-            events.emit('log', 'Fetching plugin "' + plugin_src + '" via plugin registry');
             return registry.fetch([plugin_src], options.client)
             .then(function(dir) {
                 return {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/049548a5/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 e3e0532..3643eb3 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -152,29 +152,15 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return initSettings()
-        .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() {
-            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);
+        return fetchNPM(plugin, client)
+        .fail(function() {
+            events.emit('log', 'Fetching from npm failed');
+            //reset settings to fetch from cordova registry
+            module.exports.settings = null;
+            return fetchPlugReg(plugin,client);
         });
     },
-
+ 
     /**
      * @method info
      * @param {String} name Plugin name
@@ -195,7 +181,6 @@ module.exports = {
             // Plugin info should be accessed as info[version]. If a version
             // specifier like >=x.y.z was used when calling npm view, info
             // can contain several versions, but we take the first one here.
-            console.log(info);
             var version = Object.keys(info)[0];
             return info[version];
         });
@@ -230,6 +215,33 @@ function initSettings() {
     return Q(settings);
 }
 
+/**
+ * @method initSettingsNPM
+ * @return {Promise.<Object>} Promised settings.
+ */
+function initSettingsNPM() {
+    var settings = module.exports.settings;
+    // check if settings already set
+    if(settings !== null) return Q(settings);
+
+    // setting up settings
+    // obviously if settings dir does not exist settings is going to be empty
+    if(!fs.existsSync(plugmanConfigDir)) {
+        fs.mkdirSync(plugmanConfigDir);
+        fs.mkdirSync(plugmanCacheDir);
+    }
+
+    settings =
+    module.exports.settings =
+    rc('plugman', {
+        cache: plugmanCacheDir,
+        registry: 'http://registry.npmjs.org',
+        logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+        'cache-min': oneDay
+    });
+    return Q(settings);
+}
+
 
 // Send a message to the registry to update download counts.
 function bumpCounter(info, client) {
@@ -308,3 +320,68 @@ function makeRequest (method, where, what, cb_) {
 
     return req;
 }
+
+/**
+     * @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) {
+    events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
+    return initSettingsNPM()
+    .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() {
+        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);
+    });
+}
+
+
+/**
+ * @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) {
+    events.emit('log', 'Fetching plugin "' + plugin + '" via plugin registry');
+        return initSettings()
+        .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() {
+            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() {
+            events.emit('log', 'Fetching from plugin registry failed');
+        });
+}
+


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


[23/27] 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/master
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


[05/27] cordova-lib git commit: plugins are fetched from npm before cordova registry

Posted by st...@apache.org.
plugins are fetched from npm before cordova registry


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

Branch: refs/heads/master
Commit: 7db3df134aba1bb5b5c1ea547ff919d621c30575
Parents: 8fe6b47
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jan 23 15:25:33 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Mon Jan 26 16:59:29 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js             |   1 -
 cordova-lib/src/plugman/registry/registry.js | 121 ++++++++++++++++++----
 2 files changed, 99 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/7db3df13/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index e0f1cf4..dd78c84 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -124,7 +124,6 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                 ));
             }
             // If not found in local search path, fetch from the registry.
-            events.emit('log', 'Fetching plugin "' + plugin_src + '" via plugin registry');
             return registry.fetch([plugin_src], options.client)
             .then(function(dir) {
                 return {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/7db3df13/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 7c33b27..d6e86d0 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -149,29 +149,15 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return initSettings()
-        .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() {
-            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);
+        return fetchNPM(plugin, client)
+        .fail(function() {
+            events.emit('log', 'Fetching from npm failed');
+            //reset settings to fetch from cordova registry
+            module.exports.settings = null;
+            return fetchPlugReg(plugin,client);
         });
     },
-
+ 
     /**
      * @method info
      * @param {String} name Plugin name
@@ -192,7 +178,6 @@ module.exports = {
             // Plugin info should be accessed as info[version]. If a version
             // specifier like >=x.y.z was used when calling npm view, info
             // can contain several versions, but we take the first one here.
-            console.log(info);
             var version = Object.keys(info)[0];
             return info[version];
         });
@@ -227,6 +212,33 @@ function initSettings() {
     return Q(settings);
 }
 
+/**
+ * @method initSettingsNPM
+ * @return {Promise.<Object>} Promised settings.
+ */
+function initSettingsNPM() {
+    var settings = module.exports.settings;
+    // check if settings already set
+    if(settings !== null) return Q(settings);
+
+    // setting up settings
+    // obviously if settings dir does not exist settings is going to be empty
+    if(!fs.existsSync(plugmanConfigDir)) {
+        fs.mkdirSync(plugmanConfigDir);
+        fs.mkdirSync(plugmanCacheDir);
+    }
+
+    settings =
+    module.exports.settings =
+    rc('plugman', {
+        cache: plugmanCacheDir,
+        registry: 'http://registry.npmjs.org',
+        logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+        'cache-min': oneDay
+    });
+    return Q(settings);
+}
+
 
 // Send a message to the registry to update download counts.
 function bumpCounter(info, client) {
@@ -305,3 +317,68 @@ function makeRequest (method, where, what, cb_) {
 
     return req;
 }
+
+/**
+     * @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) {
+    events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
+    return initSettingsNPM()
+    .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() {
+        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);
+    });
+}
+
+
+/**
+ * @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) {
+    events.emit('log', 'Fetching plugin "' + plugin + '" via plugin registry');
+        return initSettings()
+        .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() {
+            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() {
+            events.emit('log', 'Fetching from plugin registry failed');
+        });
+}
+


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


[20/27] 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/master
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


[11/27] cordova-lib git commit: CB-8551 Skip CPR if pluginID isn't reverse domain name style

Posted by st...@apache.org.
CB-8551 Skip CPR if pluginID isn't reverse domain name style


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

Branch: refs/heads/master
Commit: 9b36f209427b46e8d199f535565815bcb3cfe4b0
Parents: db4d274
Author: Steve Gill <st...@gmail.com>
Authored: Thu Feb 26 19:57:17 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Thu Feb 26 19:57:17 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/9b36f209/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 2943a77..75e234c 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -167,9 +167,11 @@ module.exports = {
      */
     fetch: function(plugin, client) {
         plugin = plugin.shift();
-        return fetchPlugReg(plugin, client)
+        return checkPluginID(plugin)
+        .then(function() {
+            return fetchPlugReg(plugin, client);
+        })
         .fail(function() {
-            events.emit('log', 'Fetching from cordova plugin registry failed');
             module.exports.settings = null;
             return fetchNPM(plugin,client);
         });
@@ -352,7 +354,6 @@ function fetchNPM(plugin, client) {
         return unpack.unpackTgz(package_tgz, pluginDir);
     })
     .fail(function(error) {
-        //console.log(error)
         events.emit('log', 'Fetching from npm registry failed');
         return Q.reject(error)
     });
@@ -386,6 +387,39 @@ function fetchPlugReg(plugin, client) {
         // 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 cordova plugin registry failed');
+        return Q.reject(error)
+    });;
 }
 
+/**
+ * @method checkPluginID
+ * @param {Array} with one element - the plugin id or "id@version"
+ * @return {Promise.<string>} Promised path to fetched package.
+ */
+function checkPluginID(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();
+    } 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 + ' and moved to npm. Please use `cordova plugin add '
+                    + packageName + '` next time.');
+        }
+    }
+    return Q(); 
+}


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


[14/27] cordova-lib git commit: fixed merge conflict in package.json

Posted by st...@apache.org.
fixed merge conflict in package.json


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

Branch: refs/heads/master
Commit: d49159b783909bee31858eb92279253698c9ec9d
Parents: c063fde 7e225f3
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 00:30:24 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 00:41:15 2015 -0800

----------------------------------------------------------------------
 cordova-lib/.npmignore                        |  1 +
 cordova-lib/RELEASENOTES.md                   | 75 +++++++++++++++++++++-
 cordova-lib/package.json                      |  4 +-
 cordova-lib/spec-cordova/test-config.xml      |  2 +-
 cordova-lib/src/configparser/ConfigParser.js  |  5 +-
 cordova-lib/src/cordova/platform.js           |  8 +++
 cordova-lib/src/cordova/plugin.js             |  4 +-
 cordova-lib/src/hooks/HooksRunner.js          |  3 +-
 cordova-lib/src/plugman/init-defaults.js      | 19 ++++++
 cordova-lib/src/plugman/registry/registry.js  |  2 +-
 cordova-lib/src/plugman/registry/whitelist.js |  3 +-
 cordova-lib/src/util/unpack.js                | 19 ++++++
 12 files changed, 134 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d49159b7/cordova-lib/package.json
----------------------------------------------------------------------
diff --cc cordova-lib/package.json
index 4bca7d5,c61329c..b7eb682
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@@ -18,8 -18,7 +18,8 @@@
    "engineStrict": true,
    "dependencies": {
      "bplist-parser": "0.0.6",
-     "cordova-js": "3.7.3",
+     "cordova-js": "3.8.0",
 +    "cordova-registry-mapper": "0.0.2",
      "d8": "0.4.4",
      "dep-graph": "1.1.0",
      "elementtree": "0.1.5",

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d49159b7/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d49159b7/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --cc cordova-lib/src/plugman/registry/registry.js
index fb574b5,680027d..743f8e8
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@@ -236,14 -241,6 +236,14 @@@ function initSettings(npm) 
          userconfig: path.resolve(plugmanConfigDir, 'config'),
          'cache-min': oneDay
      });
 +
 +    // if npm is true, use npm registry. 
-     // ~/.plugman/config overides the above cofig if it exists. 
++    // ~/.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';
 +    }
 +
      return Q(settings);
  }
  


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


[24/27] 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/master
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


[22/27] 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/master
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


[13/27] cordova-lib git commit: fixed merge conflict in package.json

Posted by st...@apache.org.
fixed merge conflict in package.json


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

Branch: refs/heads/master
Commit: 45af7f84f040190f63b4d708cef5216c4bd825a8
Parents: c063fde 7e225f3
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 3 00:30:24 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 3 00:30:24 2015 -0800

----------------------------------------------------------------------
 cordova-lib/.npmignore                        |  1 +
 cordova-lib/RELEASENOTES.md                   | 75 +++++++++++++++++++++-
 cordova-lib/package.json                      |  4 +-
 cordova-lib/spec-cordova/test-config.xml      |  2 +-
 cordova-lib/src/configparser/ConfigParser.js  |  5 +-
 cordova-lib/src/cordova/platform.js           |  8 +++
 cordova-lib/src/cordova/plugin.js             |  4 +-
 cordova-lib/src/hooks/HooksRunner.js          |  3 +-
 cordova-lib/src/plugman/init-defaults.js      | 19 ++++++
 cordova-lib/src/plugman/registry/whitelist.js |  3 +-
 cordova-lib/src/util/unpack.js                | 19 ++++++
 11 files changed, 133 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/45af7f84/cordova-lib/package.json
----------------------------------------------------------------------
diff --cc cordova-lib/package.json
index 4bca7d5,c61329c..b7eb682
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@@ -18,8 -18,7 +18,8 @@@
    "engineStrict": true,
    "dependencies": {
      "bplist-parser": "0.0.6",
-     "cordova-js": "3.7.3",
+     "cordova-js": "3.8.0",
 +    "cordova-registry-mapper": "0.0.2",
      "d8": "0.4.4",
      "dep-graph": "1.1.0",
      "elementtree": "0.1.5",

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/45af7f84/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------


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


[21/27] 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/master
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


[08/27] cordova-lib git commit: added ability to remove plugin via package-name

Posted by st...@apache.org.
added ability to remove plugin via package-name


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

Branch: refs/heads/master
Commit: 38a0afbdaef58dd2bc9cff88c76b0e382d835592
Parents: fee6daa
Author: Steve Gill <st...@gmail.com>
Authored: Tue Jan 27 14:15:32 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Jan 27 14:15:32 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/plugin.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/38a0afbd/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index b044a2f..5c349bd 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -28,6 +28,7 @@ var cordova_util  = require('./util'),
     shell         = require('shelljs'),
     PluginInfoProvider = require('../PluginInfoProvider'),
     plugman       = require('../plugman/plugman'),
+    pluginMapper  = require('cordova-registry-mapper'),
     events        = require('../events');
 
 // Returns a promise.
@@ -178,6 +179,17 @@ module.exports = function plugin(command, targets, opts) {
             return hooksRunner.fire('before_plugin_rm', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
+                    // 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) {
+                            target = keys[i];
+                        }
+                    }
+
                     // Check if we have the plugin.
                     if (plugins.indexOf(target) < 0) {
                         return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `'+cordova_util.binname+' plugin list`.'));


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