aboutsummaryrefslogtreecommitdiffstats
path: root/lib/grunt/utils.js
diff options
context:
space:
mode:
authorIgor Minar2013-09-04 14:28:14 +0200
committerIgor Minar2013-09-04 14:50:39 +0200
commit7b203fcff6dd01da0bebb43130a0e861c05c4e9c (patch)
tree4aba332a4e86ba3c31ceaaa8b4d18e51df8c948c /lib/grunt/utils.js
parent9a7adb545543fe725bb13919ab15c9ddeb3e5d9d (diff)
downloadangular.js-7b203fcff6dd01da0bebb43130a0e861c05c4e9c.tar.bz2
chore(grunt): support semver v2 version number format
previously we couldn't use it because of bower bugs
Diffstat (limited to 'lib/grunt/utils.js')
-rw-r--r--lib/grunt/utils.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js
index 3c4b7254..fd2e022f 100644
--- a/lib/grunt/utils.js
+++ b/lib/grunt/utils.js
@@ -17,13 +17,17 @@ module.exports = {
if (version) return version;
var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
- // TODO(brian): change `(-|rc)` to `-` in the regex below after bower
- // fixes this issue: https://github.com/bower/bower/issues/782
- var match = package.version.match(/^([^\-]*)(?:(-|rc)(.+))?$/);
+ var match = package.version.match(/^([^\-]*)(?:\-(.+))?$/);
var semver = match[1].split('.');
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
- var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
+ var fullVersion = match[1];
+
+ if (match[2]) {
+ fullVersion += '-';
+ fullVersion += (match[2] == 'snapshot') ? hash : match[2];
+ }
+
version = {
full: fullVersion,
major: semver[0],