4 var fs = require('fs');
5 var path = require('path');
6 // In Nodejs 0.8.0, existsSync moved from path -> fs.
7 var existsSync = fs.existsSync || path.existsSync;
9 // Badass internal grunt lib.
10 var findup = require('../lib/util/findup');
12 // Where might a locally-installed grunt live?
13 var dir = path.resolve(findup(process.cwd(), 'grunt.js'), '../node_modules/grunt');
15 // If grunt is installed locally, use it. Otherwise use this grunt.
16 if (!existsSync(dir)) { dir = '../lib/grunt'; }