#!/usr/bin/env node var Jackson = require(__dirname + '/../'); try { require('coffee-script/register'); // enables us to load CoffeeScript modules } catch(e) {} function findApp(moduleNames) { var app = null; var cwd = process.cwd(); moduleNames.forEach(function(name) { try { app = require(cwd + '/' + name); } catch(e) { if(e.code != 'MODULE_NOT_FOUND') { throw e; // exception thrown in app code, bubble } } }); return app; } var moduleNames = ['app', 'index', 'server']; var app = null; try { app = findApp(moduleNames); } catch(e) { console.error("Your application threw an exception:\n"); console.error(e.stack); process.exit(1); } if(app && app.jacksonVersion) { new Jackson.CLI(app).run(); } else { new Jackson.CLI().run(); }