Only commit rc and watched files

This commit is contained in:
Jeroen Engels 2016-03-30 20:11:37 +02:00
parent cb5895dbfd
commit 906d70667c

View file

@ -1,5 +1,6 @@
'use strict'; 'use strict';
var path = require('path');
var _ = require('lodash/fp'); var _ = require('lodash/fp');
var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor'; var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor';
@ -36,19 +37,23 @@ function getRepoInfo(cb) {
}); });
} }
function spawnCommand(args, cb) { function spawnGitCommand(args, cb) {
var git = spawn('git', args); var git = spawn('git', args);
git.stderr.on('data', cb); git.stderr.on('data', cb);
git.on('close', cb); git.on('close', cb);
} }
function commit(options, data, cb) { function commit(options, data, cb) {
spawnCommand(['add', '.'], function (error) { var files = options.files.concat(options.config);
var absolutePathFiles = files.map(function (file) {
return path.resolve(process.cwd(), file);
});
spawnGitCommand(['add'].concat(absolutePathFiles), function (error) {
if (error) { if (error) {
return cb(error); return cb(error);
} }
var commitMessage = _.template(options.commitTemplate || commitTemplate)(data); var commitMessage = _.template(options.commitTemplate || commitTemplate)(data);
spawnCommand(['commit', '-m', commitMessage], cb); spawnGitCommand(['commit', '-m', commitMessage], cb);
}); });
} }