mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(gulp) add changelog
This commit is contained in:
parent
0ce853c147
commit
bd83ba44ca
1 changed files with 33 additions and 0 deletions
33
gulpfile.js
33
gulpfile.js
|
|
@ -7,6 +7,10 @@
|
|||
concat = require('gulp-concat'),
|
||||
stylestats = require('gulp-stylestats'),
|
||||
test = require('./test/test.js'),
|
||||
Util = require('./lib/util'),
|
||||
fs = require('fs'),
|
||||
exec = require('child_process').exec,
|
||||
Info = require('./package'),
|
||||
|
||||
LIB = './lib/',
|
||||
LIB_CLIENT = LIB + 'client/',
|
||||
|
|
@ -41,6 +45,35 @@
|
|||
test.check();
|
||||
});
|
||||
|
||||
gulp.task('changelog', function() {
|
||||
var version = 'v' + Info.version,
|
||||
name = 'ChangeLog';
|
||||
|
||||
Util.asyncCall([
|
||||
Util.bind(exec, 'shell/log.sh ' + version),
|
||||
Util.bind(fs.readFile, name),
|
||||
], function(execParams, readParams) {
|
||||
var ERROR = 0,
|
||||
DATA = 1,
|
||||
STD_ERR = 2,
|
||||
error = execParams[ERROR] || execParams[STD_ERR] || readParams[ERROR],
|
||||
execData = execParams[DATA],
|
||||
fileData = readParams[DATA],
|
||||
date = Util.getShortDate(),
|
||||
head = date + ', ' + version + '?\n\n',
|
||||
data = head + execData + fileData;
|
||||
|
||||
if (error)
|
||||
console.log(error);
|
||||
else
|
||||
fs.writeFile(name, data, function(error) {
|
||||
var msg = 'changelog: done';
|
||||
|
||||
console.log(error || msg);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('default', ['jshint', 'css', 'test']);
|
||||
|
||||
function onError(params) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue