You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/05/14 23:19:47 UTC
[1/3] git commit: Add git ref support to fetch. Not used anywhere yet.
Updated Branches:
refs/heads/dependencies 67f1f8b0c -> e75bdf6d2
Add git ref support to fetch. Not used anywhere yet.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/e2f1c879
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/e2f1c879
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/e2f1c879
Branch: refs/heads/dependencies
Commit: e2f1c87939d1c0d13e6370cf0f752ce00285870e
Parents: 14eed99
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue May 14 17:10:50 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue May 14 17:10:50 2013 -0400
----------------------------------------------------------------------
spec/fetch.spec.js | 10 +++++++++-
src/fetch.js | 4 ++--
src/install.js | 3 ++-
src/util/dependencies.js | 3 ++-
src/util/plugins.js | 12 +++++++++++-
5 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e2f1c879/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 8f7c678..79afaa4 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -42,7 +42,15 @@ describe('fetch', function() {
var url = "https://github.com/bobeast/GAPlugin.git";
var dir = 'fakeSubDir';
fetch(url, temp, false, dir);
- expect(s).toHaveBeenCalledWith(url, temp, dir, undefined);
+ expect(s).toHaveBeenCalledWith(url, temp, dir, undefined, undefined);
+ });
+ it('should call clonePluginGitRepo with subdir and git ref if applicable', function() {
+ var s = spyOn(plugins, 'clonePluginGitRepo');
+ var url = "https://github.com/bobeast/GAPlugin.git";
+ var dir = 'fakeSubDir';
+ var ref = 'fakeGitRef';
+ fetch(url, temp, false, dir, ref);
+ expect(s).toHaveBeenCalledWith(url, temp, dir, ref, undefined);
});
it('should throw if used with url and `link` param', function() {
expect(function() {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e2f1c879/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 73bf4e2..a222af6 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -4,7 +4,7 @@ var shell = require('shelljs'),
xml_helpers = require('./util/xml-helpers'),
path = require('path');
-module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, callback) {
+module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, git_ref, callback) {
// Ensure the containing directory exists.
shell.mkdir('-p', plugins_dir);
@@ -17,7 +17,7 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, cal
if (callback) callback(err);
else throw err;
} else {
- plugins.clonePluginGitRepo(plugin_dir, plugins_dir, subdir, callback);
+ plugins.clonePluginGitRepo(plugin_dir, plugins_dir, subdir, git_ref, callback);
}
} else {
// Copy from the local filesystem.
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e2f1c879/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 37d789c..c3ec3bc 100644
--- a/src/install.js
+++ b/src/install.js
@@ -21,7 +21,8 @@ module.exports = function installPlugin(platform, project_dir, name, plugins_dir
// 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(name, plugins_dir, false, '.', function(err, plugin_dir) {
+ // TODO: Actual value for git_ref.
+ require('../plugman').fetch(name, plugins_dir, false, '.', undefined /* git_ref */, function(err, plugin_dir) {
if (err) {
callback(err);
} else {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e2f1c879/src/util/dependencies.js
----------------------------------------------------------------------
diff --git a/src/util/dependencies.js b/src/util/dependencies.js
index 9f7a594..5608249 100644
--- a/src/util/dependencies.js
+++ b/src/util/dependencies.js
@@ -49,7 +49,8 @@ exports.installAll = function(platform, project_dir, name, plugins_dir, cli_vari
}
console.log('Fetching dependency ' + dep.attrib.id);
- fetch(dep.attrib.url, plugins_dir, false /* no link */, subdir, doInstall);
+ // TODO: Actual value for git_ref.
+ fetch(dep.attrib.url, plugins_dir, false /* no link */, subdir, undefined /* git_ref */, doInstall);
}
});
};
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e2f1c879/src/util/plugins.js
----------------------------------------------------------------------
diff --git a/src/util/plugins.js b/src/util/plugins.js
index ff9cace..f570026 100644
--- a/src/util/plugins.js
+++ b/src/util/plugins.js
@@ -30,7 +30,7 @@ var http = require('http'),
module.exports = {
searchAndReplace:require('./search-and-replace'),
// Fetches plugin information from remote server
- clonePluginGitRepo:function(plugin_git_url, plugins_dir, subdir, callback) {
+ clonePluginGitRepo:function(plugin_git_url, plugins_dir, subdir, git_ref, callback) {
if(!shell.which('git')) {
var err = new Error('git command line is not installed');
if (callback) callback(err);
@@ -46,6 +46,16 @@ module.exports = {
if (callback) callback(err)
else throw err;
} else {
+ // Check out the specified revision, if provided.
+ if (git_ref) {
+ var result = shell.exec(util.format('git checkout "%s"', git_ref), { silent: true });
+ if (result.code > 0) {
+ var err = new Error('failed to checkout git ref "' + git_ref + '"');
+ if (callback) callback(err);
+ else throw err;
+ }
+ }
+
// Read the plugin.xml file and extract the plugin's ID.
tmp_dir = path.join(tmp_dir, subdir);
// TODO: what if plugin.xml does not exist?
[2/3] git commit: Merge branch 'dependencies' of
https://git-wip-us.apache.org/repos/asf/cordova-plugman into dependencies
Posted by br...@apache.org.
Merge branch 'dependencies' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into dependencies
Conflicts:
src/install.js
src/util/dependencies.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/272a8fc8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/272a8fc8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/272a8fc8
Branch: refs/heads/dependencies
Commit: 272a8fc84f547218f66022c0fcd96e6f6e08946c
Parents: e2f1c87 7ea9eda
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue May 14 17:19:18 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue May 14 17:19:18 2013 -0400
----------------------------------------------------------------------
main.js | 2 +-
package.json | 3 +-
src/install.js | 183 +++++++++++++----------------
src/platforms/android.js | 65 ++---------
src/platforms/blackberry.js | 55 ++-------
src/platforms/common.js | 13 ++
src/platforms/ios.js | 235 ++++++++++++++++++--------------------
src/util/action-stack.js | 50 ++++++++
src/util/dependencies.js | 57 ---------
src/util/plugins.js | 2 +
10 files changed, 283 insertions(+), 382 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/272a8fc8/src/install.js
----------------------------------------------------------------------
diff --cc src/install.js
index c3ec3bc,f73f5f3..5cc51e9
--- a/src/install.js
+++ b/src/install.js
@@@ -21,8 -21,7 +21,8 @@@ module.exports = function installPlugin
// 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, false, subdir, function(err, plugin_dir) {
+ // TODO: Actual value for git_ref.
- require('../plugman').fetch(name, plugins_dir, false, '.', undefined /* git_ref */, function(err, plugin_dir) {
++ require('../plugman').fetch(id, plugins_dir, false, subdir, undefined /* git_ref */, function(err, plugin_dir) {
if (err) {
callback(err);
} else {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/272a8fc8/src/util/plugins.js
----------------------------------------------------------------------
[3/3] git commit: Merge branch 'dependencies' of
https://git-wip-us.apache.org/repos/asf/cordova-plugman into dependencies
Posted by br...@apache.org.
Merge branch 'dependencies' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into dependencies
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/e75bdf6d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/e75bdf6d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/e75bdf6d
Branch: refs/heads/dependencies
Commit: e75bdf6d2c2957e64056bf9c54417879056ee362
Parents: 272a8fc 67f1f8b
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue May 14 17:19:37 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue May 14 17:19:37 2013 -0400
----------------------------------------------------------------------
src/install.js | 2 +-
src/platforms/ios.js | 121 +++++++++++++++--------------------------
src/util/action-stack.js | 15 +++++-
3 files changed, 60 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e75bdf6d/src/install.js
----------------------------------------------------------------------