Skip to content
Permalink
Browse files

fix(gulp): make gulp a dep if app is using gulp

  • Loading branch information
jyounce committed May 28, 2015
1 parent 05e3d08 commit 4184bf411dc9f2ebdaa20d5a2cf5fb1a38949fd4
Showing with 28 additions and 10 deletions.
  1. +4 −7 gulpfile.coffee
  2. +24 −3 gulpfile.js
@@ -1,14 +1,11 @@
# rapid sequence
# ==============
module.exports = (options={}) ->
module.exports = (gulp, options={}) ->
# try to load gulp from app's node_modules directory
# if it isn't there, load it from rapid-build's node_modules
# ==========================================================
try
gulp = require '../gulp'
catch e
gulp = require 'gulp'
# if gulp isn't supplied, load it from rapid-build's node_modules
# ===============================================================
rbDir = __dirname
gulp = require 'gulp' if not gulp
bootstrap = require("#{rbDir}/bootstrap")()
config = require("#{rbDir}/config") rbDir, options
tasks = require("#{config.req.init}/tasks") gulp, config
@@ -1,5 +1,26 @@
// init rapid-build
module.exports = function(options) {
/**
* init rapid-build
* arguments are: gulp and options
* argument order does not matter
* pass in gulp if your app is using gulp
* options are optional
*/
module.exports = function() {
var gulp, options;

if (arguments.length) {
var getGulp = function(args) {
if (!!args[0].seq) return args[0]
else if (!!args[1] && !!args[1].seq) return args[1]
}
var getOptions = function(args) {
if (!args[0].seq) return args[0]
else if (!!args[1] && !args[1].seq) return args[1]
}
gulp = getGulp(arguments)
options = getOptions(arguments)
}

require('coffee-script/register')
return require('./gulpfile.coffee')(options)
return require('./gulpfile.coffee')(gulp, options)
}

0 comments on commit 4184bf4

Please sign in to comment.
You can’t perform that action at this time.