mirror of
https://github.com/rschamp/gh-pages.git
synced 2026-04-03 12:44:19 +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) {
|
exports.publish = function publish(config, done) {
|
||||||
var defaults = {
|
var defaults = {
|
||||||
add: false,
|
add: false,
|
||||||
@@ -59,14 +64,15 @@ exports.publish = function publish(config, done) {
|
|||||||
push: true,
|
push: true,
|
||||||
message: 'Updates',
|
message: 'Updates',
|
||||||
silent: false,
|
silent: false,
|
||||||
logger: function(){}
|
logger: function() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// override defaults with any task options
|
// override defaults with any task options
|
||||||
var options = _.extend({}, defaults, config);
|
var options = _.extend({}, defaults, config);
|
||||||
|
|
||||||
if (!grunt.file.isDir(options.base)) {
|
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({
|
var files = grunt.file.expand({
|
||||||
@@ -76,7 +82,8 @@ exports.publish = function publish(config, done) {
|
|||||||
}, options.src);
|
}, options.src);
|
||||||
|
|
||||||
if (!Array.isArray(files) || files.length === 0) {
|
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);
|
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() {
|
exports.clean = function clean() {
|
||||||
wrench.rmdirSyncRecursive(getCacheDir(), true);
|
wrench.rmdirSyncRecursive(getCacheDir(), true);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user