Add git debugging to publish command

This commit is contained in:
kpdecker
2013-08-25 18:55:21 -05:00
parent 1b4b8ed1da
commit dac055f01e
2 changed files with 27 additions and 7 deletions
+12 -7
View File
@@ -8,13 +8,18 @@ module.exports = function(grunt) {
var done = this.async();
initSDK();
git.commitInfo(function(err, info) {
if (info.isMaster) {
publish(fileMap(['-latest', '-' + info.head]), done);
} else {
// Silently ignore for branches
done();
}
git.debug(function(remotes, branches) {
grunt.log.writeln('remotes: ' + remotes);
grunt.log.writeln('branches: ' + branches);
git.commitInfo(function(err, info) {
if (info.isMaster) {
publish(fileMap(['-latest', '-' + info.head]), done);
} else {
// Silently ignore for branches
done();
}
});
});
});
grunt.registerTask('publish:version', function() {
+15
View File
@@ -1,6 +1,21 @@
var childProcess = require('child_process');
module.exports = {
debug: function(callback) {
childProcess.exec('git remote -v', {}, function(err, remotes) {
if (err) {
throw new Error('git.remote: ' + err.message);
}
childProcess.exec('git branch -a', {}, function(err, branches) {
if (err) {
throw new Error('git.branch: ' + err.message);
}
callback(remotes, branches);
});
});
},
clean: function(callback) {
childProcess.exec('git diff-index --name-only HEAD --', {}, function(err, stdout) {
callback(undefined, !err && !stdout);