Download this file

coffeelint    36 lines (27 with data), 1.1 kB

#!/usr/bin/env node

var path = require("path");
var fs   = require("fs");
var resolve = require('resolve').sync;

// path.existsSync was moved to fs.existsSync node 0.6 -> 0.8
var existsFn = fs.existsSync || path.existsSync;

var thisdir = path.dirname(fs.realpathSync(__filename));




// This setup allows for VERY fast development. I clear the lib directory so
// that every time coffeelint runs, it uses CoffeeScript to re-compile at
// runtime.
//
// I use this so vim runs the newest code while I work on CoffeeLint. -Asa
commandline = path.join(thisdir, '..', "lib", "commandline.js");
if (!existsFn(commandline)) {
    require('coffee-script/register');
    require('../src/commandline');
} else {
    // This is the code path that everyone else is really going to use.
    try {
        // Try to find a project-specific install first. This works the same
        // way grunt-cli does.
        filepath = resolve('coffeelint', { basedir: process.cwd() });
        commandline = path.dirname(filepath) + path.sep + 'commandline.js';
    } catch (ex) {
    }

    require(commandline);
}