diff --git a/bin/lcm.js b/bin/lcm.js index 6d1741b..f30d524 100755 --- a/bin/lcm.js +++ b/bin/lcm.js @@ -17,7 +17,7 @@ program.command('server') .option('-p, --port [port]', 'listen on specified port (default: 3000)', parseInt) .option('-e, --env [environment]', 'run in specified environment (default: development)') .option('-A, --app [directory]', 'load app at specified directory (default: `pwd`)') - .option('-R, --reload', 'enable automatic reloading when code changes') + .option('-w, --watch', 'watch for code changes and reload') .option('--use-nodemon', 'use nodemon for automatic reloading (default: supervisor)') .option('--debug [port]', 'enable V8 debugger on specified port (default: 5858)', parseInt) .option('--debug-brk [port]', 'enable V8 debugger on specified port and break immediately (default: 5858)', parseInt) diff --git a/lib/locomotive/cli/server.js b/lib/locomotive/cli/server.js index eb22263..406d063 100644 --- a/lib/locomotive/cli/server.js +++ b/lib/locomotive/cli/server.js @@ -41,22 +41,14 @@ exports = module.exports = function server(dir, address, port, env, options) { return; } - if (options.reload) { + if (options.watch) { if (options.useNodemon) { - // As of nodemon@0.6.14, there is an issue with passing the full path of a - // script to nodemon, which causes the spawned command to fail. See here - // for more discussion: - // https://github.com/remy/nodemon/issues/78 - // - // I've submitted a pull request to fix this issue, which will hopefully - // find its way into a stable release. - // https://github.com/remy/nodemon/pull/81 var command = 'nodemon'; var args = [ '-w', dir, - path.join(__dirname, 'server/reload.js'), + path.join(__dirname, 'server/watch.js'), dir, address, port, env ]; - debug('respawning in reload mode (%s %s)', command, args.join(' ')); + debug('respawning in watch mode (%s %s)', command, args.join(' ')); var proc = spawn(command, args); proc.stdout.pipe(process.stdout); @@ -75,10 +67,10 @@ exports = module.exports = function server(dir, address, port, env, options) { // supervisor@0.3.0 var command = 'supervisor'; var args = [ '-w', dir, '--no-restart-on', 'error', - '--', path.join(__dirname, 'server/reload.js'), + '--', path.join(__dirname, 'server/watch.js'), dir, address, port, env ]; - debug('respawning in reload mode (%s %s)', command, args.join(' ')); + debug('respawning in watch mode (%s %s)', command, args.join(' ')); var proc = spawn(command, args); proc.stdout.pipe(process.stdout); diff --git a/lib/locomotive/cli/server/reload.js b/lib/locomotive/cli/server/watch.js similarity index 74% rename from lib/locomotive/cli/server/reload.js rename to lib/locomotive/cli/server/watch.js index e5a3621..90bb9de 100644 --- a/lib/locomotive/cli/server/reload.js +++ b/lib/locomotive/cli/server/watch.js @@ -1,7 +1,7 @@ /** - * server/reload.js + * server/watch.js * - * This is a shim script used by Locomotive when respawning in reload mode. + * This is a shim script used by Locomotive when respawning in watch mode. */ // process.argv[0] -> nodemon