Skip to content

Commit

Permalink
Added support for pluggable nodemon
Browse files Browse the repository at this point in the history
  • Loading branch information
IOAyman committed Sep 25, 2016
1 parent d4d46a1 commit d2e5de7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ gulp.task('afterstart', function (){

gulp.task('test', ['lint'], function () {
var stream = nodemon({
script: './test/server.js'
nodemon: require('nodemon')
, script: './test/server.js'
, verbose: true
, env : {
'NODE_ENV': 'development'
Expand Down
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var nodemon = require('nodemon')
var nodemon
, colors = require('colors')
, gulp = require('gulp')
, cp = require('child_process')
Expand All @@ -9,6 +9,13 @@ var nodemon = require('nodemon')
module.exports = function (options){
options = options || {};

// plug nodemon
if (options.nodemon && typeof options.nodemon === 'function') {
nodemon = options.nodemon;
delete options.nodemon
} else
nodemon = require('nodemon');

// Our script
var script = nodemon(options)
, originalOn = script.on
Expand Down Expand Up @@ -96,7 +103,7 @@ module.exports = function (options){
return script

// Synchronous alternative to gulp.run()
function run(tasks){
function run(tasks) {
if (typeof tasks === 'string') tasks = [tasks]
if (tasks.length === 0) return
if (!(tasks instanceof Array)) throw new Error('Expected task name or array but found: ' + tasks)
Expand Down

0 comments on commit d2e5de7

Please sign in to comment.