Merge pull request #711 from wycats/git-tag

Attempt to resolve git tag using describe
This commit is contained in:
Kevin Decker
2014-01-17 15:51:30 -08:00
2 changed files with 11 additions and 6 deletions
-2
View File
@@ -20,8 +20,6 @@ env:
matrix:
include:
- node_js: "0.10"
before_install:
- sudo apt-get install git
env:
- PUBLISH=true
- secure: pLTzghtVll9yGKJI0AaB0uI8GypfWxLTaIB0ZL8//yN3nAEIKMhf/RRilYTsn/rKj2NUa7vt2edYILi3lttOUlCBOwTc9amiRms1W8Lwr/3IdWPeBLvLuH1zNJRm2lBAwU4LBSqaOwhGaxOQr6KHTnWudhNhgOucxpZfvfI/dFw=
+11 -4
View File
@@ -80,20 +80,27 @@ module.exports = {
childProcess.exec('git tag -a --message=' + name + ' ' + name, {}, function(err, stdout, stderr) {
if (err) {
throw new Error('git.tag: ' + err.message);
throw err;
}
callback();
});
},
tagName: function(callback) {
childProcess.exec('git tag -l --points-at HEAD', {}, function(err, stdout) {
childProcess.exec('git describe --tags', {}, function(err, stdout) {
if (err) {
throw new Error('git.tagName: ' + err.message);
}
var tags = stdout.trim().split(/\n/),
versionTags = tags.filter(function(tag) { return /^v/.test(tag); });
var tags = stdout.trim().split(/\n/);
tags = tags.filter(function(info) {
info = info.split('-');
return info.length == 1;
});
var versionTags = tags.filter(function(info) {
return /^v/.test(info[0]);
});
callback(undefined, versionTags[0] || tags[0]);
});
}