Skip to content

Commit

Permalink
make opts optional
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Jan 19, 2016
1 parent af4f8f1 commit 3580100
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion download.js
Expand Up @@ -13,7 +13,7 @@ function downloadPrebuild (opts, cb) {
var localPrebuild = util.localPrebuild(downloadUrl)
var tempFile = util.tempFile(cachedPrebuild)

var rc = opts.rc
var rc = opts.rc || {}
var log = opts.log || noop

if (opts.nolocal) return download()
Expand Down
9 changes: 5 additions & 4 deletions gypbuild.js
Expand Up @@ -3,17 +3,18 @@ var util = require('./util')

function runGyp (opts, version, cb) {
var log = opts.log
if (!opts.rc.preinstall) return run()
var rc = opts.rc || {}
if (!rc.preinstall) return run()

log.verbose('executing preinstall')
util.spawn(opts.rc.preinstall, function (err) {
util.spawn(rc.preinstall, function (err) {
if (err) return cb(err)
run()
})

function run () {
var args = ['node', 'index.js', 'rebuild', '--target=' + version, '--target_arch=' + opts.rc.arch]
if (opts.rc.debug) args.push('--debug')
var args = ['node', 'index.js', 'rebuild', '--target=' + version, '--target_arch=' + rc.arch]
if (rc.debug) args.push('--debug')

gyp({
gyp: opts.gyp,
Expand Down
2 changes: 1 addition & 1 deletion util.js
Expand Up @@ -113,7 +113,7 @@ function platform () {
}

function releaseFolder (opts) {
var type = (opts.rc.debug ? 'Debug' : 'Release')
var type = ((opts.rc && opts.rc.debug) ? 'Debug' : 'Release')
var binary = opts.pkg.binary
return (binary && binary.module_path) || 'build/' + type
}
Expand Down

0 comments on commit 3580100

Please sign in to comment.