Created
September 2, 2012 10:10
-
-
Save ahomu/3596427 to your computer and use it in GitHub Desktop.
coffeedoc task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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