feature(gulp) release: add --major, --minor, --patch

This commit is contained in:
coderaiser 2014-11-18 06:16:20 -05:00
parent 813da6a0f7
commit de30cfd10a
2 changed files with 15 additions and 4 deletions

View file

@ -1,16 +1,26 @@
(function() {
'use strict';
var DIR = '../',
minor = require('minor'),
Info = require(DIR + 'package');
exports.getVersion = function() {
var versionNew,
argv = process.argv,
length = argv.length - 1,
last = process.argv[length],
regExp = new RegExp('^--'),
isMatch = last.match(regExp);
regExp = /^--(major|minor|patch)?/,
match = last.match(regExp);
if (isMatch)
versionNew = last.substr(3);
if (regExp.test(last)) {
if (match[1])
versionNew = minor(match[1], Info.version);
else
versionNew = last.substr(3);
console.log(versionNew);
}
return versionNew;
};

View file

@ -45,6 +45,7 @@
"gulp-jshint": "~1.8.4",
"gulp-mocha": "~1.1.0",
"gulp-recess": "~1.0.0",
"minor": "~1.2.2",
"morgan": "~1.5.0",
"should": "~4.2.1",
"version-io": "~1.0.3"