module.exports = function (grunt) {
  var semver = require('semver');
  var version = grunt.option('version');

  function bump () {
    //console.log(arguments[0][0]);
  }

  function file (path) {
    return {
      dest: path,
      src: path
    };
  }

  function pattern (find) {
    return {
      match: find,
      replacement: bump
    };
  }

  return {
    release: {
      options: {
        patterns: [
          pattern(/version: '([^\']+)';/),
          pattern(/"version": "([^\']+)"/)
        ]
      },
      files: [
        file('src/version.js'),
        file('bower.json'),
        file('package.json')
      ]
    }
  };
};

@@ -29,16 +29,70 @@
 runt) %7B%0A
+  var curver = require('../../package.json').version;%0A
   var se
@@ -188,37 +188,52 @@
     
-//console.log(arguments%5B0%5D%5B0%5D
+return version ? version : semver.inc(curver
 );%0A 
@@ -326,250 +326,161 @@
 %0A%0A  
-function pattern (find) %7B%0A    return %7B%0A      match: find,%0A      replacement: bump%0A    %7D;%0A  %7D%0A%0A  return %7B%0A    release: %7B%0A      options: %7B%0A        patterns: %5B%0A          pattern(/version: '(%5B%5E%5C'%5D+)';/),%0A          pattern(/%22version%22: %22(%5B%5E%5C'%5D+)%22/)
+return %7B%0A    release: %7B%0A      options: %7B%0A        patterns: %5B%0A          %7B%0A            match: new RegExp(curver),%0A            replacement: bump%0A          %7D
 %0A   

Use specified version or increment current version.