4edaf2d7959bf6ee8732d2472b3de73e56f39a48.svn-base
553 Bytes
#!/usr/bin/env node
// Nodejs libs.
var fs = require('fs');
var path = require('path');
// In Nodejs 0.8.0, existsSync moved from path -> fs.
var existsSync = fs.existsSync || path.existsSync;
// Badass internal grunt lib.
var findup = require('../lib/util/findup');
// Where might a locally-installed grunt live?
var dir = path.resolve(findup(process.cwd(), 'grunt.js'), '../node_modules/grunt');
// If grunt is installed locally, use it. Otherwise use this grunt.
if (!existsSync(dir)) { dir = '../lib/grunt'; }
// Run grunt.
require(dir).cli();