forked from remy/nodemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If no script, default is null, not -1. Fixes remy#265
Includes test and exposing the command run for debugging.
- Loading branch information
Showing
13 changed files
with
111 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
module.exports = command; | ||
|
||
function command(options) { | ||
var executable = options.execOptions.exec, | ||
args = []; | ||
|
||
// after "executable" go the exec args (like --debug, etc) | ||
if (options.execOptions.execArgs) { | ||
[].push.apply(args, options.execOptions.execArgs); | ||
} | ||
|
||
// then goes the user's script arguments | ||
if (options.args) { | ||
[].push.apply(args, options.args); | ||
} | ||
|
||
// after the "executable" goes the user's script | ||
if (options.script) { | ||
args.splice((options.scriptPosition || 0) + options.execOptions.execArgs.length, 0, options.script); | ||
} | ||
|
||
return { | ||
executable: executable, | ||
args: args | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ | |
"watch": ["four"], | ||
"env": { | ||
"USER": "remysharp" | ||
}, | ||
"execMap": { | ||
"js": "node --harmony" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"main": "app.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
/*global describe:true, it: true, afterEach:true, beforeEach:true */ | ||
var assert = require('assert'), | ||
utils = require('../utils'), | ||
path = require('path'), | ||
match = utils.match, | ||
cleanup = utils.cleanup, | ||
run = utils.run; | ||
|
||
describe('nodemon full config test', function () { | ||
var pwd = process.cwd(); | ||
|
||
afterEach(function () { | ||
process.chdir(pwd); | ||
}); | ||
|
||
beforeEach(function () { | ||
// move to the fixtures directory to allow for config loading | ||
process.chdir(path.resolve(pwd, 'test/fixtures')); | ||
}); | ||
|
||
it('should allow execMap.js to be overridden', function (done) { | ||
var p = run({ exec: '../../bin/nodemon.js', | ||
args: ['-V'] | ||
}, { | ||
error: function (data) { | ||
p.send('quit'); | ||
cleanup(p, done, new Error(data)); | ||
} | ||
}); | ||
|
||
p.on('message', function (event) { | ||
if (event.type === 'log') { | ||
if (match(event.data.message, 'starting `')) { | ||
event.data.message.replace(/`(.*)`/, function (all, m) { | ||
assert(m === 'node --harmony app.js', 'Arguments in the correct order: ' + m); | ||
p.send('quit'); | ||
cleanup(p, done); | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters