"use strict"

var _ = require('underscore'),
  fs = require('fs'),
  sys = require('sys'),
  exec = require('child_process').exec,
  program = require('commander');

var path = require('path'),
  fs = require('fs'),
  lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');

// CLI
program.version('0.0.1')
  .parse(process.argv);

// Exec new Gruntfile
var execGrunt = function () {
  var pintConfig = require(path.join(process.cwd(), 'Pint.js'));
  var gruntfileTemplate = fs.readFileSync(path.join(lib, 'templates/Gruntfile.tmpl'), 'utf8');

  // Stringify config but remove open and closing braces
  var config=JSON.stringify(pintConfig.build.config);
  config = config.substring(1, config.length - 1)

  fs.writeFileSync("./Gruntfile.js", _.template(gruntfileTemplate)({
    gruntTasks : config
  }))

  exec("grunt", function(err, stdout) {
    sys.puts(stdout.trim());

    exec("rm -rf Gruntfile.js", function(err, stdout) {
      sys.puts(stdout.trim());
    });
  });
};

exports.drink = execGrunt;
@@ -160,14 +160,11 @@
 er')
-;%0A%0Avar
+,%0A 
  pat
@@ -186,37 +186,23 @@
 th')
-,%0A  fs = require('fs'),%0A  lib
+;%0A%0Avar pintPath
  = p
@@ -214,61 +214,54 @@
 oin(
-path.
+__
 dirname
-(fs.realpathSync(__filename)), '../lib');
+, '..'),%0A  targetPath = process.cwd()
 %0A%0A//
@@ -488,14 +488,23 @@
 oin(
-lib, '
+pintPath, 'lib/
 temp
@@ -722,14 +722,33 @@
 ync(
-%22./Gru
+path.join(targetPath, %22Pi
 ntfi
@@ -753,16 +753,17 @@
 file.js%22
+)
 , _.temp
@@ -832,16 +832,40 @@
 c(%22grunt
+ --gruntfile Pintfile.js
 %22, funct
@@ -930,19 +930,18 @@
 %22rm -rf 
-Gru
+Pi
 ntfile.j

Change files to be Pintfiles so as not to conflict with Grunt