mirror of
https://github.com/scratchfoundation/gh-pages.git
synced 2024-11-28 18:25:38 -05:00
Doc blocks
This commit is contained in:
parent
d678d525e4
commit
9f845da8e4
1 changed files with 14 additions and 3 deletions
17
lib/index.js
17
lib/index.js
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue