You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/09/19 19:09:12 UTC
[1/2] git commit: CB-4492 tracking which of cli or plugman is used to
fetch from registry
Updated Branches:
refs/heads/master 1fa97a416 -> d1515cb47
CB-4492 tracking which of cli or plugman is used to fetch from registry
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/ea1e9fa9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/ea1e9fa9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/ea1e9fa9
Branch: refs/heads/master
Commit: ea1e9fa9908a413fb84ef8d696f1f7bd40de4217
Parents: e7464d0
Author: Anis Kadri <an...@apache.org>
Authored: Thu Sep 19 19:08:54 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Sep 19 19:08:54 2013 +0200
----------------------------------------------------------------------
spec/fetch.spec.js | 15 +++++++++++++--
spec/install.spec.js | 4 ++--
src/fetch.js | 2 +-
src/install.js | 2 +-
src/registry/registry.js | 16 ++++++++++------
5 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ea1e9fa9/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index a52228f..29233d3 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -8,7 +8,8 @@ var fetch = require('../src/fetch'),
temp = path.join(os.tmpdir(), 'plugman'),
test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'),
test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'ChildBrowser'),
- plugins = require('../src/util/plugins');
+ plugins = require('../src/util/plugins'),
+ registry = require('../src/registry/registry');
describe('fetch', function() {
describe('local plugins', function() {
@@ -38,7 +39,7 @@ describe('fetch', function() {
expect(sym).toHaveBeenCalledWith(test_plugin, path.join(temp, 'id'), 'dir');
});
});
- describe('remote plugins', function() {
+ describe('git plugins', function() {
var clone;
beforeEach(function() {
clone = spyOn(plugins, 'clonePluginGitRepo');
@@ -85,4 +86,14 @@ describe('fetch', function() {
}).toThrow('--link is not supported for git URLs');
});
});
+ describe('registry plugins', function() {
+ var pluginId = 'dummyplugin', sFetch;
+ beforeEach(function() {
+ sFetch = spyOn(registry, 'fetch');
+ });
+ it('should get a plugin from registry and set the right client when argument is not a folder nor URL', function() {
+ fetch(pluginId, temp, {client: 'plugman'})
+ expect(sFetch).toHaveBeenCalledWith([pluginId], 'plugman', jasmine.any(Function));
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ea1e9fa9/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index c1cbdf9..84efd96 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -143,7 +143,7 @@ describe('install', function() {
exists.andReturn(false);
// Plugin A depends on C & D
install('android', temp, 'A', deps_dir, {});
- expect(s).toHaveBeenCalledWith('C', deps_dir, { link: false, subdir: undefined, git_ref: undefined}, jasmine.any(Function));
+ expect(s).toHaveBeenCalledWith('C', deps_dir, { link: false, subdir: undefined, git_ref: undefined, client: 'plugman'}, jasmine.any(Function));
expect(s.calls.length).toEqual(3);
});
it('should try to fetch any dependent plugins from registry when url is not defined', function() {
@@ -154,7 +154,7 @@ describe('install', function() {
exists.andReturn(false);
// Plugin A depends on C & D
install('android', temp, 'E', deps_dir, {});
- expect(s).toHaveBeenCalledWith('D', deps_dir, { link: false, subdir: undefined, git_ref: undefined}, jasmine.any(Function));
+ expect(s).toHaveBeenCalledWith('D', deps_dir, { link: false, subdir: undefined, git_ref: undefined, client: 'plugman'}, jasmine.any(Function));
expect(s.calls.length).toEqual(2);
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ea1e9fa9/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 5d36b3f..321e5a6 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -100,7 +100,7 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
if(!fs.existsSync(plugin_dir)) {
- registry.fetch([plugin_dir], function(err, plugin_dir) {
+ registry.fetch([plugin_dir], options.client, function(err, plugin_dir) {
if (err) {
if(callback) {
return callback(err);
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ea1e9fa9/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 1915f85..29f620c 100644
--- a/src/install.js
+++ b/src/install.js
@@ -49,7 +49,7 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options,
// Check that the plugin has already been fetched.
if (!fs.existsSync(plugin_dir)) {
// if plugin doesnt exist, use fetch to get it.
- require('../plugman').fetch(id, plugins_dir, { link: false, subdir: options.subdir, git_ref: options.git_ref }, function(err, plugin_dir) {
+ require('../plugman').fetch(id, plugins_dir, { link: false, subdir: options.subdir, git_ref: options.git_ref, client: 'plugman' }, function(err, plugin_dir) {
if (err) {
if (callback) callback(err);
else throw err;
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ea1e9fa9/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index 15d8b84..c8ff7ed 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -56,7 +56,7 @@ function getPackageInfo(args, cb) {
* @param {String} info Package info
* @param {Function} cb callback
*/
-function fetchPackage(info, cb) {
+function fetchPackage(info, cl, cb) {
var settings = module.exports.settings;
var cached = path.resolve(settings.cache, info.name, info.version, 'package');
@@ -88,10 +88,13 @@ function fetchPackage(info, cb) {
dlcReq.setHeader('Content-Type', 'application/json');
- dlcReq.write(JSON.stringify({
+ var message = {
day: now.getUTCFullYear() + '-' + (now.getUTCMonth()+1) + '-' + now.getUTCDate(),
- pkg: pkgId
- }));
+ pkg: pkgId,
+ client: cl
+ };
+
+ dlcReq.write(JSON.stringify(message));
dlcReq.end();
res.pipe(filestream);
@@ -203,12 +206,13 @@ module.exports = {
* @param {String} name Plugin name
* @param {Function} cb Command callback
*/
- fetch: function(args, cb) {
+ fetch: function(args, client, cb) {
initSettings(function(err, settings) {
if(err) return handleError(err, cb);
+ var cl = (client === 'plugman' ? 'plugman' : 'cordova-cli')
getPackageInfo(args, function(err, info) {
if(err) return handleError(err, cb);
- fetchPackage(info, cb);
+ fetchPackage(info, cl, cb);
});
});
},
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/cordova-plugman
Posted by an...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/d1515cb4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d1515cb4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d1515cb4
Branch: refs/heads/master
Commit: d1515cb476fad5a7fb8e8fae7e0e54051a842a50
Parents: ea1e9fa 1fa97a4
Author: Anis Kadri <an...@apache.org>
Authored: Thu Sep 19 19:09:01 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Sep 19 19:09:01 2013 +0200
----------------------------------------------------------------------
CHANGELOG.md | 17 -----------------
RELEASENOTES.md | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------