mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(gulp) add docs
This commit is contained in:
parent
482770af77
commit
af3bf577e4
1 changed files with 47 additions and 0 deletions
47
gulp/docs.js
Normal file
47
gulp/docs.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
var DIR = '../',
|
||||
|
||||
cl = require('./cl'),
|
||||
place = require('place'),
|
||||
rendy = require('rendy'),
|
||||
shortdate = require('shortdate'),
|
||||
Info = require(DIR + 'package');
|
||||
|
||||
module.exports = function(callback) {
|
||||
var history = 'Version history\n---------------\n',
|
||||
link = '//github.com/cloudcmd/archive/raw/master/cloudcmd',
|
||||
template = '- *{{ date }}*, ' +
|
||||
'**[v{{ version }}]' +
|
||||
'(' + link + '-v{{ version }}.zip)**\n',
|
||||
version = Info.version;
|
||||
|
||||
cl(function(error, versionNew) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else {
|
||||
replaceVersion('README.md', version, versionNew, callback);
|
||||
replaceVersion('HELP.md', version, versionNew, function() {
|
||||
var historyNew = history + rendy(template, {
|
||||
date : shortdate(),
|
||||
version : versionNew
|
||||
});
|
||||
|
||||
replaceVersion('HELP.md', history, historyNew, callback);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function replaceVersion(name, version, versionNew, callback) {
|
||||
place(name, version, versionNew, function(error) {
|
||||
var msg;
|
||||
|
||||
if (!error)
|
||||
msg = 'done: ' + name;
|
||||
|
||||
callback(error, msg);
|
||||
});
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue