mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(gulp) add docs
This commit is contained in:
parent
fcb97fe422
commit
bd3e1e5e64
1 changed files with 31 additions and 1 deletions
32
gulpfile.js
32
gulpfile.js
|
|
@ -104,8 +104,22 @@
|
|||
}
|
||||
});
|
||||
|
||||
gulp.task('docs', function() {
|
||||
var version = Info.version,
|
||||
versionNew = getNewVersion(),
|
||||
msg = 'ERROR: version is missing. gulp readme --v<version>';
|
||||
|
||||
if (!versionNew) {
|
||||
console.log(msg);
|
||||
} else {
|
||||
replaceVersion('README.md', version, versionNew);
|
||||
replaceVersion('HELP.md', version, versionNew);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gulp.task('default', ['jshint', 'css', 'test']);
|
||||
gulp.task('release', ['changelog', 'package']);
|
||||
gulp.task('release', ['changelog', 'package', 'docs']);
|
||||
|
||||
function onError(params) {
|
||||
console.log(params.message);
|
||||
|
|
@ -125,4 +139,20 @@
|
|||
return versionNew;
|
||||
}
|
||||
|
||||
function replaceVersion(name, version, versionNew) {
|
||||
fs.readFile(name, 'utf8', function(error, data) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
data = data.replace(version, versionNew);
|
||||
|
||||
fs.writeFile(name, data, function(error) {
|
||||
var msg = 'done: ' + name;
|
||||
|
||||
console.log(error || msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue