Skip to content

Instantly share code, notes, and snippets.

@ahomu
Created September 2, 2012 10:10
Show Gist options
  • Save ahomu/3596427 to your computer and use it in GitHub Desktop.
Save ahomu/3596427 to your computer and use it in GitHub Desktop.
coffeedoc task
/**
coffeedoc: {
dist: {
target: 'src/coffee',
options: {
output: 'docs',
parser: 'requirejs',
renderer: 'html'
}
}
},
*/
module.exports = function(grunt) {
var exec = require('exec');
/**
* Task
*/
grunt.registerMultiTask('coffeedoc', 'Generate source documents from CoffeeScript files.', function() {
var target = this.data.target,
options = this.data.options || {},
cmds = ['coffeedoc'],
done = this.async();
Object.keys(options).forEach(function(opt) {
cmds.push('--' + opt + '=' + options[opt]);
});
cmds.push(target);
exec(cmds, function(err, out, code) {
if (code === 0) {
grunt.log.ok(cmds.join(' '));
grunt.log.ok('document created at '+target);
} else {
grunt.fail.warn('If you want to using coffeedoc task. Please global install (option with -g) coffeedoc pakage from npm.');
}
done();
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment