mirror of
https://github.com/rschamp/gh-pages.git
synced 2026-03-29 00:33:44 +08:00
Doc blocks
This commit is contained in:
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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user