Skip to content
This repository
Browse code

Rename reload mode to watch mode to match conventions established by …

…supervisor, nodemon, mocha, etc.
  • Loading branch information...
commit 5c2355f4e60bfaecc8a2b214dcf039aa8125f29c 1 parent 8384c91
Jared Hanson authored
2  bin/lcm.js
@@ -17,7 +17,7 @@ program.command('server')
17 17 .option('-p, --port [port]', 'listen on specified port (default: 3000)', parseInt)
18 18 .option('-e, --env [environment]', 'run in specified environment (default: development)')
19 19 .option('-A, --app [directory]', 'load app at specified directory (default: `pwd`)')
20   - .option('-R, --reload', 'enable automatic reloading when code changes')
  20 + .option('-w, --watch', 'watch for code changes and reload')
21 21 .option('--use-nodemon', 'use nodemon for automatic reloading (default: supervisor)')
22 22 .option('--debug [port]', 'enable V8 debugger on specified port (default: 5858)', parseInt)
23 23 .option('--debug-brk [port]', 'enable V8 debugger on specified port and break immediately (default: 5858)', parseInt)
18 lib/locomotive/cli/server.js
@@ -41,22 +41,14 @@ exports = module.exports = function server(dir, address, port, env, options) {
41 41 return;
42 42 }
43 43
44   - if (options.reload) {
  44 + if (options.watch) {
45 45 if (options.useNodemon) {
46   - // As of nodemon@0.6.14, there is an issue with passing the full path of a
47   - // script to nodemon, which causes the spawned command to fail. See here
48   - // for more discussion:
49   - // https://github.com/remy/nodemon/issues/78
50   - //
51   - // I've submitted a pull request to fix this issue, which will hopefully
52   - // find its way into a stable release.
53   - // https://github.com/remy/nodemon/pull/81
54 46 var command = 'nodemon';
55 47 var args = [ '-w', dir,
56   - path.join(__dirname, 'server/reload.js'),
  48 + path.join(__dirname, 'server/watch.js'),
57 49 dir, address, port, env ];
58 50
59   - debug('respawning in reload mode (%s %s)', command, args.join(' '));
  51 + debug('respawning in watch mode (%s %s)', command, args.join(' '));
60 52
61 53 var proc = spawn(command, args);
62 54 proc.stdout.pipe(process.stdout);
@@ -75,10 +67,10 @@ exports = module.exports = function server(dir, address, port, env, options) {
75 67 // supervisor@0.3.0
76 68 var command = 'supervisor';
77 69 var args = [ '-w', dir, '--no-restart-on', 'error',
78   - '--', path.join(__dirname, 'server/reload.js'),
  70 + '--', path.join(__dirname, 'server/watch.js'),
79 71 dir, address, port, env ];
80 72
81   - debug('respawning in reload mode (%s %s)', command, args.join(' '));
  73 + debug('respawning in watch mode (%s %s)', command, args.join(' '));
82 74
83 75 var proc = spawn(command, args);
84 76 proc.stdout.pipe(process.stdout);
4 lib/locomotive/cli/server/reload.js → lib/locomotive/cli/server/watch.js
... ... @@ -1,7 +1,7 @@
1 1 /**
2   - * server/reload.js
  2 + * server/watch.js
3 3 *
4   - * This is a shim script used by Locomotive when respawning in reload mode.
  4 + * This is a shim script used by Locomotive when respawning in watch mode.
5 5 */
6 6
7 7 // process.argv[0] -> nodemon

0 comments on commit 5c2355f

Please sign in to comment.
Something went wrong with that request. Please try again.