You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/06/21 00:31:28 UTC
[4/5] git commit: Revert to fix bad merge from wrong repo
Revert to fix bad merge from wrong repo
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/1bb9c2f5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/1bb9c2f5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/1bb9c2f5
Branch: refs/heads/master
Commit: 1bb9c2f52dc0368921f40f5206ebf3c9d7336d4c
Parents: 836d4c0
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jun 20 15:15:39 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jun 20 15:15:39 2014 -0700
----------------------------------------------------------------------
cordova-lib/spec-plugman/fetch.spec.js | 59 +++--------------------------
cordova-lib/src/plugman/fetch.js | 5 +--
2 files changed, 6 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1bb9c2f5/cordova-lib/spec-plugman/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/fetch.spec.js b/cordova-lib/spec-plugman/fetch.spec.js
index 0b15ca0..4b9e234 100644
--- a/cordova-lib/spec-plugman/fetch.spec.js
+++ b/cordova-lib/spec-plugman/fetch.spec.js
@@ -27,7 +27,6 @@ var fetch = require('../src/plugman/fetch'),
test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'),
test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'ChildBrowser'),
plugins = require('../src/plugman/util/plugins'),
- pluginfo = require('../src/PluginInfo'),
Q = require('q'),
registry = require('../src/plugman/registry/registry');
@@ -42,10 +41,7 @@ describe('fetch', function() {
var xml, rm, sym, mkdir, cp, save_metadata;
beforeEach(function() {
xml = spyOn(xml_helpers, 'parseElementtreeSync').andReturn({
- getroot:function() { return {attrib:{id:'id', version:'version'}};},
- });
- plugin_info = spyOn(pluginfo, 'PluginInfo').andReturn({
- id:'id', version:'version'
+ getroot:function() { return {attrib:{id:'id'}};}
});
rm = spyOn(shell, 'rm');
sym = spyOn(fs, 'symlinkSync');
@@ -84,36 +80,20 @@ describe('fetch', function() {
expect(1).toBe(1);
});
});
- it('should fail when the expected ID with version specified doesn\'t match', function(done) {
- fetch(test_plugin, temp, { expected_id: 'id@wrongVersion' })
- .then(function() {
- expect('this call').toBe('fail');
- }, function(err) {
- expect(''+err).toContain('Expected fetched plugin to have ID "id@wrongVersion" but got "id@version".');
- }).fin(done);
- });
- it('should succeed when the plugin version specified is correct', function(done) {
- wrapper(fetch(test_plugin, temp, { expected_id: 'id@version' }), done, function() {
- expect(1).toBe(1);
- });
- });
});
describe('git plugins', function() {
- var clone, save_metadata, done, xml, plugin_info;
+ var clone, save_metadata, done, xml;
function fetchPromise(f) {
f.then(function() { done = true; }, function(err) { done = err; });
}
beforeEach(function() {
- plugin_info = spyOn(pluginfo, 'PluginInfo').andReturn({
- id:'id', version:'version'
- });
clone = spyOn(plugins, 'clonePluginGitRepo').andReturn(Q('somedir'));
save_metadata = spyOn(metadata, 'save_fetch_metadata');
done = false;
xml = spyOn(xml_helpers, 'parseElementtreeSync').andReturn({
- getroot:function() { return {attrib:{id:'id', version:'version'}};}
+ getroot:function() { return {attrib:{id:'id'}};}
});
});
it('should call clonePluginGitRepo for https:// and git:// based urls', function() {
@@ -206,34 +186,18 @@ describe('fetch', function() {
expect(''+err).toContain('Expected fetched plugin to have ID "wrongID" but got "id".');
}).fin(done);
});
- it('should fail when the expected ID with version specified doesn\'t match', function(done) {
- fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'id@wrongVersion' })
- .then(function() {
- expect('this call').toBe('fail');
- }, function(err) {
- expect(''+err).toContain('Expected fetched plugin to have ID "id@wrongVersion" but got "id@version".');
- }).fin(done);
- });
it('should succeed when the expected ID is correct', function(done) {
wrapper(fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'id' }), done, function() {
expect(1).toBe(1);
});
});
- it('should succeed when the plugin version specified is correct', function(done) {
- wrapper(fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'id@version' }), done, function() {
- expect(1).toBe(1);
- });
- });
});
describe('registry plugins', function() {
var pluginId = 'dummyplugin', sFetch;
- var xml, rm, sym, mkdir, cp, save_metadata, plugin_info;
+ var xml, rm, sym, mkdir, cp, save_metadata;
beforeEach(function() {
xml = spyOn(xml_helpers, 'parseElementtreeSync').andReturn({
- getroot:function() { return {attrib:{id:'id', version:'version'}};}
- });
- plugin_info = spyOn(pluginfo, 'PluginInfo').andReturn({
- id:'id', version:'version'
+ getroot:function() { return {attrib:{id:'id'}};}
});
rm = spyOn(shell, 'rm');
sym = spyOn(fs, 'symlinkSync');
@@ -256,23 +220,10 @@ describe('fetch', function() {
expect(''+err).toContain('Expected fetched plugin to have ID "wrongID" but got "id".');
}).fin(done);
});
- it('should fail when the expected ID with version specified doesn\'t match', function(done) {
- fetch(pluginId, temp, { expected_id: 'id@wrongVersion' })
- .then(function() {
- expect('this call').toBe('fail');
- }, function(err) {
- expect(''+err).toContain('Expected fetched plugin to have ID "id@wrongVersion" but got "id@version".');
- }).fin(done);
- });
it('should succeed when the expected ID is correct', function(done) {
wrapper(fetch(pluginId, temp, { expected_id: 'id' }), done, function() {
expect(1).toBe(1);
});
});
- it('should succeed when the plugin version specified is correct', function(done) {
- wrapper(fetch(pluginId, temp, { expected_id: 'id@version' }), done, function() {
- expect(1).toBe(1);
- });
- });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1bb9c2f5/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index f2640a4..0292ad1 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -140,10 +140,7 @@ function readId(dir) {
// Helper function for checking expected plugin IDs against reality.
function checkID(expected_id, dir) {
if ( expected_id ) {
- var info = require('../PluginInfo').PluginInfo(dir);
- // check for plugin version specified (like some.plugin@0.2.3)
- // if id with specific version provided (via '@' symbol), append version to id
- var id = expected_id.split('@').length == 1 ? info.id : info.id + "@" + info.version;
+ var id = readId(dir);
if (expected_id != id) {
throw new Error('Expected fetched plugin to have ID "' + expected_id + '" but got "' + id + '".');
}