From f68a43e7197b791ef04af03ba2b1381954dce6d1 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Mon, 2 Jun 2014 10:09:01 +0100 Subject: [PATCH] Add gulp binary check for process.cwd node_modules --- bin/sequelize | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/sequelize b/bin/sequelize index f645667b..99922c37 100755 --- a/bin/sequelize +++ b/bin/sequelize @@ -3,12 +3,21 @@ 'use strict'; var spawn = require('child_process').spawn + , fs = require('fs') , path = require('path') , gulp = path.resolve(__dirname, '..', 'node_modules', '.bin', 'gulp') , args = process.argv.slice(2) , yargs = require('yargs') , _ = require('lodash') +if (!fs.existsSync(gulp)) { + gulp = path.resolve(process.cwd(), 'node_modules', '.bin', 'gulp') +} + +if (!fs.existsSync(gulp)) { + throw new Error('Unable to find the `gulp` binary'); +} + if ((args[0] === '-v') || (args[0] === '-V')) { args = ['version'] }