You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/01/25 12:22:07 UTC
fauxton commit: updated refs/heads/master to 28c402f
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master e3ec1acb5 -> 28c402ff3
Convert copy dependencies to use fs-extra
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/28c402ff
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/28c402ff
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/28c402ff
Branch: refs/heads/master
Commit: 28c402ff36eb295ea3c67b1e79983c4e56c30539
Parents: e3ec1ac
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jan 25 10:42:29 2017 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Jan 25 13:57:55 2017 +0200
----------------------------------------------------------------------
package.json | 1 +
tasks/fauxton.js | 44 ++++++++++++++------------------------------
2 files changed, 15 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/28c402ff/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9557031..59c152b 100644
--- a/package.json
+++ b/package.json
@@ -61,6 +61,7 @@
"express": "^4.13.4",
"file-loader": "^0.8.5",
"flux": "^3.1.0",
+ "fs-extra": "^2.0.0",
"grunt": "~0.4.1",
"grunt-chmod": "^1.0.3",
"grunt-cli": "~0.1.6",
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/28c402ff/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/tasks/fauxton.js b/tasks/fauxton.js
index d929e89..5b03b03 100644
--- a/tasks/fauxton.js
+++ b/tasks/fauxton.js
@@ -26,44 +26,28 @@ module.exports = function (grunt) {
grunt.registerMultiTask('get_deps', 'Fetch external dependencies', function () {
grunt.log.writeln('Fetching external dependencies');
- var done = this.async(),
- data = this.data,
+ const data = this.data,
target = data.target || 'app/addons/',
settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default.json',
- settings = grunt.file.readJSON(settingsFile),
- _ = grunt.util._;
-
- // This should probably be a helper, though they seem to have been removed
- var fetch = function (deps, command) {
- var child_process = require('child_process');
- var async = require('async');
- async.forEach(deps, function (dep, cb) {
- var path = target + dep.name;
- var location = dep.url || dep.path;
- grunt.log.writeln('Fetching: ' + dep.name + ' (' + location + ')');
+ settings = grunt.file.readJSON(settingsFile);
- child_process.exec(command(dep, path), function (error, stdout, stderr) {
- grunt.log.writeln(stderr);
- grunt.log.writeln(stdout);
- cb(error);
- });
- }, function (error) {
- if (error) {
- grunt.log.writeln('ERROR: ' + error.message);
+ const fetch = deps => {
+ var fs = require('fs-extra');
+ deps.forEach(dep => {
+ const path = target + dep.name;
+ const location = dep.url || dep.path;
+ grunt.log.writeln('Fetching: ' + dep.name + ' (' + location + ')');
+ try {
+ fs.copySync(dep.path, path);
+ } catch (e) {
+ grunt.log.writeln('ERROR: ' + e.message);
}
-
- done();
});
};
- var localDeps = _.filter(settings.deps, function (dep) { return !! dep.path; });
+ const localDeps = settings.deps.filter(dep => !!dep.path);
grunt.log.writeln(localDeps.length + ' local dependencies');
- fetch(localDeps, function (dep, destination) {
- // TODO: Windows
- var command = 'cp -r ' + dep.path + '/ ' + destination + '/';
- grunt.log.writeln(command);
- return command;
- });
+ fetch(localDeps);
});
grunt.registerMultiTask('gen_load_addons', 'Generate the load_addons.js file', function () {