Skip to content

Commit

Permalink
Compute a release name for S3
Browse files Browse the repository at this point in the history
kriskowal committed Sep 22, 2013
1 parent 571d0e2 commit f2517e9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,28 @@
var fs = require("fs");
var path = require("path");

// compute a release name for S3 based on the version in package.json and
// whether the git HEAD matches the tag for the corresponding version
var config = require("./package.json");
var headPath = path.join(__dirname, ".git", "HEAD");
var tagPath = path.join(__dirname, ".git", "refs", "tags", "v" + config.version);
var releaseName;
if (fs.existsSync(headPath)) {
var headHash = fs.readFileSync(headPath, "ascii").trim();
if (fs.existsSync(tagPath)) {
var tagHash = fs.readFileSync(tagPath, "ascii").trim();
if (tagHash === headHash) {
releaseName = config.version;
} else {
releaseName = headHash;
}
} else {
releaseName = headHash;
}
} else {
releaseName = "default";
}

module.exports = function (grunt) {
["grunt-contrib-uglify",
"grunt-contrib-clean",

0 comments on commit f2517e9

Please sign in to comment.