var fs = require('fs');
var semver = require('semver');
var bail = require('./bail');

Config = function(fileName) {
  this.fileName = fileName;
  this.file = fs.readFileSync(fileName);
  this.json = JSON.parse(this.file);
}

Config.prototype = {
  check: function () {
    if (!('version' in this.json)) {
      bail('ERROR: Could not find version in ' + this.fileName);
    }

    this.ver = semver.valid(this.json.version);
    if (this.ver === null) {
      bail('ERROR: Incorrect version in ' + this.fileName);
    }
  }
};

module.exports = Config

@@ -138,16 +138,86 @@
 leName;%0A
+  this.readFile();%0A%7D%0A%0AConfig.prototype = %7B%0A  readFile: function() %7B%0A  
   this.f
@@ -238,16 +238,21 @@
 ileSync(
+this.
 fileName
@@ -252,24 +252,26 @@
 ileName);%0A  
+ 
+ 
 this.json = 
@@ -293,39 +293,21 @@
 .file);%0A
-%7D%0A%0AConfig.prototype = %7B
+  %7D,%0A
 %0A  check
@@ -457,13 +457,13 @@
 ver.
-valid
+parse
 (thi
@@ -574,16 +574,374 @@
 ;%0A    %7D%0A
+  %7D,%0A%0A  incVer: function(type) %7B%0A    var defaultType = %22patch%22;%0A    var newVer = this.ver.inc(defaultType);%0A    this.json.version = newVer.toString();%0A  %7D,%0A%0A  save: function() %7B%0A    var replacer = undefined;%0A    var space = 2;%0A    var jsonData = JSON.stringify(this.json, replacer, space);%0A    fs.writeFileSync(this.fileName, jsonData);%0A    this.readFile();%0A
   %7D%0A%7D;%0A%0A

Update config js class