mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(gulp) if no features or not fixes do not add to changelog
This commit is contained in:
parent
181a22f61d
commit
3887206fd6
1 changed files with 42 additions and 6 deletions
48
gulpfile.js
48
gulpfile.js
|
|
@ -53,28 +53,64 @@
|
|||
gulp.task('changelog', function() {
|
||||
var version = 'v' + Info.version,
|
||||
name = 'ChangeLog',
|
||||
|
||||
gitTempl = 'git log {{ version }}..HEAD --pretty=format:"- %s" --grep {{ category }} | sed \'s/{{ category }}//g\'',
|
||||
|
||||
gitFix = Util.render(gitTempl, {
|
||||
category : 'fix' ,
|
||||
version : version
|
||||
}),
|
||||
|
||||
gitFeature = Util.render(gitTempl, {
|
||||
category: 'feature',
|
||||
version : version
|
||||
}),
|
||||
|
||||
versionNew = getNewVersion();
|
||||
|
||||
if (versionNew)
|
||||
versionNew = 'v' + versionNew;
|
||||
versionNew = 'v' + versionNew;
|
||||
else
|
||||
versionNew = version + '?';
|
||||
|
||||
Util.exec.parallel([
|
||||
Util.exec.with(exec, 'shell/log.sh ' + version),
|
||||
Util.exec.with(fs.readFile, name, 'utf8'),
|
||||
], function(error, execParams, fileData) {
|
||||
Util.exec.with(exec, gitFix),
|
||||
Util.exec.with(exec, gitFeature),
|
||||
], function(error, fileData, fixData, featureData) {
|
||||
var DATA = 0,
|
||||
STD_ERR = 1,
|
||||
execData = execParams[DATA],
|
||||
fix = fixData[DATA],
|
||||
feature = featureData[DATA],
|
||||
date = Util.getShortDate(),
|
||||
head = date + ', ' + versionNew + '\n\n',
|
||||
data = head + execData + fileData;
|
||||
data = '';
|
||||
|
||||
error = error || execParams[STD_ERR];
|
||||
console.log(fix || feature);
|
||||
|
||||
if (fix || feature) {
|
||||
data = head;
|
||||
|
||||
if (fix) {
|
||||
data += 'fix:' + '\n';
|
||||
data += fix + '\n\n';
|
||||
}
|
||||
|
||||
if (feature) {
|
||||
data += 'feature:' + '\n';
|
||||
data += feature + '\n\n';
|
||||
}
|
||||
|
||||
data += '\n';
|
||||
data += fileData;
|
||||
}
|
||||
|
||||
error = error || fixData[STD_ERR] || featureData[STD_ERR];
|
||||
|
||||
if (error)
|
||||
console.log(error);
|
||||
else if (!data)
|
||||
console.log('No new feature and fix commits from v', version);
|
||||
else
|
||||
fs.writeFile(name, data, function(error) {
|
||||
var msg = 'changelog: done';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue