Doc blocks

This commit is contained in:
Tim Schaub 2014-05-30 06:15:13 -06:00
parent d678d525e4
commit 9f845da8e4

View file

@ -45,6 +45,11 @@ function getRepo(options) {
}
/**
* Push a git branch to a remote (pushes gh-pages by default).
* @param {Object} config Publish options.
* @param {function(Error)} done Called upon completion.
*/
exports.publish = function publish(config, done) {
var defaults = {
add: false,
@ -59,14 +64,15 @@ exports.publish = function publish(config, done) {
push: true,
message: 'Updates',
silent: false,
logger: function(){}
logger: function() {}
};
// override defaults with any task options
var options = _.extend({}, defaults, config);
if (!grunt.file.isDir(options.base)) {
return done(new Error('The "base" option must be an existing directory'));
done(new Error('The "base" option must be an existing directory'));
return;
}
var files = grunt.file.expand({
@ -76,7 +82,8 @@ exports.publish = function publish(config, done) {
}, options.src);
if (!Array.isArray(files) || files.length === 0) {
return done(new Error('Files must be provided in the "src" property.'));
done(new Error('Files must be provided in the "src" property.'));
return;
}
var only = grunt.file.expand({cwd: options.base}, options.only);
@ -196,6 +203,10 @@ exports.publish = function publish(config, done) {
});
};
/**
* Clean the cache directory.
*/
exports.clean = function clean() {
wrench.rmdirSyncRecursive(getCacheDir(), true);
};