diff --git a/gulp/cl.js b/gulp/cl.js index a6b5498d..2fd3c5fe 100644 --- a/gulp/cl.js +++ b/gulp/cl.js @@ -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; }; diff --git a/package.json b/package.json index 9c36b709..7caa899c 100644 --- a/package.json +++ b/package.json @@ -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"