Repository: cordova-lib
Updated Branches:
  refs/heads/master 39a6bdf9d -> 0c61fb097


CB-10761 Resore plugins saved without spec attribute


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

Branch: refs/heads/master
Commit: 0c61fb097d5f6a317560adbb2165ff916642c5c7
Parents: 39a6bdf
Author: Vladimir Kotikov <v-vlk...@microsoft.com>
Authored: Tue Apr 19 14:37:46 2016 +0300
Committer: Vladimir Kotikov <v-vlk...@microsoft.com>
Committed: Wed Apr 20 12:50:36 2016 +0300

----------------------------------------------------------------------
 cordova-lib/spec-cordova/save.spec.js   | 15 +++++++++++++++
 cordova-lib/src/cordova/restore-util.js |  6 +++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0c61fb09/cordova-lib/spec-cordova/save.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/save.spec.js 
b/cordova-lib/spec-cordova/save.spec.js
index 550af26..e2be5a5 100644
--- a/cordova-lib/spec-cordova/save.spec.js
+++ b/cordova-lib/spec-cordova/save.spec.js
@@ -614,6 +614,21 @@ describe('(save flag)', function () {
             });
         }, TIMEOUT);
 
+        it('spec.23.2 should restore plugins without spec attribute', function 
(done) {
+            redirectRegistryCalls(pluginName2);
+            helpers.setEngineSpec(appPath, platformName, 
platformLocalPathNewer);
+            helpers.setPluginSpec(appPath, pluginName2/**, do not specify spec 
here */);
+            prepare()
+            .then(function () {
+                expect(registry.fetch).toHaveBeenCalledWith([pluginName2]);
+                expect(path.join(appPath, 'plugins', pluginName2)).toExist();
+            }).catch(function (err) {
+                expect(true).toBe(false);
+                console.log(err.message);
+            })
+            .fin(done);
+        }, TIMEOUT);
+
         it('spec.24 should restore only specified platform', function (done) {
             helpers.setEngineSpec(appPath, platformName, 
platformLocalPathNewer);
             helpers.setEngineSpec(appPath, otherPlatformName, 
otherPlatformSpec);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0c61fb09/cordova-lib/src/cordova/restore-util.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/restore-util.js 
b/cordova-lib/src/cordova/restore-util.js
index 9b0f585..b816a35 100644
--- a/cordova-lib/src/cordova/restore-util.js
+++ b/cordova-lib/src/cordova/restore-util.js
@@ -112,7 +112,11 @@ function installPluginsFromConfigXML(args) {
         // assume it is the location to install from.
         var pluginSpec = pluginEntry.spec;
         pluginName = pluginEntry.name;
-        var installFrom = semver.validRange(pluginSpec, true) ? pluginName + 
'@' + pluginSpec : pluginSpec;
+
+        // CB-10761 If plugin spec is not specified, use plugin name
+        var installFrom = pluginSpec || pluginName;
+        if (pluginSpec && semver.validRange(pluginSpec, true))
+            installFrom = pluginName + '@' + pluginSpec;
 
         // Add feature preferences as CLI variables if have any
         var options = {


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

Reply via email to