-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the semver stuff in #17 and took into account beta releases as …
…per #15
- Loading branch information
1 parent
ba681f7
commit f72fe0e
Showing
3 changed files
with
109 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,90 @@ | ||
exports = module.exports = {} | ||
|
||
exports.bumpPatch = function(version){ | ||
exports.bumpPatch = function(version) | ||
{ | ||
var stringarray = version.split("."); | ||
var patchnumber = Number(stringarray[2]); | ||
var patchnumber = parseInt(stringarray[2]); | ||
patchnumber = patchnumber+1; | ||
|
||
var result = (stringarray[0]+"."+stringarray[1]+"."+patchnumber); | ||
return result; | ||
} | ||
|
||
exports.bumpMinor = function(version){ | ||
exports.bumpMinor = function(version) | ||
{ | ||
var stringarray = version.split("."); | ||
var patchnumber = Number(stringarray[1]); | ||
var patchnumber = parseInt(stringarray[1]); | ||
patchnumber = patchnumber+1; | ||
|
||
var result = (stringarray[0]+"."+patchnumber+"."+stringarray[2]); | ||
var result = (stringarray[0]+"."+patchnumber+".0"); | ||
return result; | ||
} | ||
|
||
exports.bumpMajor = function(version){ | ||
exports.bumpMajor = function(version) | ||
{ | ||
var stringarray = version.split("."); | ||
var patchnumber = Number(stringarray[0]); | ||
var patchnumber = parseInt(stringarray[0]); | ||
patchnumber = patchnumber+1; | ||
|
||
var result = (patchnumber+"."+stringarray[1]+"."+stringarray[2]); | ||
var result = (patchnumber+".0.0"); | ||
return result; | ||
} | ||
|
||
exports.bumpAlpha = function(version) | ||
{ | ||
if (version.indexOf("beta") > -1) | ||
{ | ||
return version; | ||
} | ||
else | ||
if (version.indexOf("alpha") > -1) | ||
{ | ||
var stringarray = version.split("."); | ||
var patchnumber; | ||
if (stringarray.length > 3) | ||
{ | ||
patchnumber = parseInt(stringarray[3]); | ||
patchnumber = patchnumber + 1; | ||
} | ||
else | ||
{ | ||
patchnumber = 1; | ||
} | ||
return stringarray[0]+"."+stringarray[1]+"."+stringarray[2]+"."+patchnumber; | ||
} | ||
else | ||
{ | ||
return version+"-alpha.1"; | ||
} | ||
} | ||
|
||
exports.bumpBeta = function(version) | ||
{ | ||
var testVersion = version; | ||
|
||
if (testVersion.indexOf("alpha") > -1) | ||
{ | ||
var tempArray = testVersion.split("."); | ||
testVersion = parseInt(tempArray[0])+"."+parseInt(tempArray[1])+"."+parseInt(tempArray[2]); | ||
} | ||
|
||
if (testVersion.indexOf("beta") > -1) | ||
{ | ||
var stringarray = testVersion.split("."); | ||
var patchnumber; | ||
if (stringarray.length > 3) | ||
{ | ||
patchnumber = parseInt(stringarray[3]); | ||
patchnumber = patchnumber + 1; | ||
} | ||
else | ||
{ | ||
patchnumber = 1; | ||
} | ||
return stringarray[0]+"."+stringarray[1]+"."+stringarray[2]+"."+patchnumber; | ||
} | ||
else | ||
{ | ||
return testVersion+"-beta.1"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters