diff options
Diffstat (limited to 'lib/grunt/utils.js')
| -rw-r--r-- | lib/grunt/utils.js | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js index 9e0aab99..51ebcc70 100644 --- a/lib/grunt/utils.js +++ b/lib/grunt/utils.js @@ -36,13 +36,12 @@ module.exports = {      var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));      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];      if (match[2]) {        fullVersion += '-'; -      fullVersion += (match[2] == 'snapshot') ? hash : match[2]; +      fullVersion += (match[2] == 'snapshot') ? getSnapshotSuffix() : match[2];      }      version = { @@ -55,6 +54,12 @@ module.exports = {      };      return version; + +    function getSnapshotSuffix() { +      var jenkinsBuild = process.env.BUILD_NUMBER || 'local'; +      var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', ''); +      return 'build.'+jenkinsBuild+'+sha.'+hash; +    }    }, | 
