Good call - thanks!

On Feb 14, 2013, at 3:26 AM, hitsthings <notifications@github.com> wrote:

In tasks/lib/heroku-deploy.js:

> +}
> +
> +function allOutput(proc, next) {
> + var out = '';
> + proc.stdout.on('data', function(data) { out += data; });
> + proc.stdout.on('end', function() {
> +   next(null, out);
> + });
> +}
> +
> +function trim(str){
> +  return str.replace(/^\s+/,'').replace(/\s+$/,'');
> +}
> +
> +function tagExists(tag,next){
> +   exec('git tag | grep ' + tag,function(err,stdout,stderr){

Using grep is going to stop this from working on Windows. Also would fail
if they were tagging 1.0 and 0.1.0 already existed. I think this would work
instead (I haven't tested though):

function escapeRE(s) {
    return s.replace(/[\-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
// ...
exec('git tag', function(err,stdout, stderr) {
  var tagRE = new RegExp('^\\s*' + escapeRE(tag) + '\\s*$');
  var isListed = stdout.split('\n').some(tagRE.test.bind(tagRE));
  next(isListed);
});

 —
Reply to this email directly or view it on
GitHub<https://github.com/hitsthings/grunt-heroku-deploy/pull/4/files#r3011521>.