lib/dependencies.js
var deps = module.exports;

Retrieve the path to binaries installed as part of npm dependency packages. This is done by getting the path to any available module, then deconstructing the path to get the node_modules/.bin directory path. Currently the binary is assumed to have the same name as the module. This is fragile - it just happens that both casperjs and phantomjs meet that condition.

Parameters:

  • module must be a String.
    (name of the module)

Returns a String
(path to the binary)

deps.getbinpath = function(module) { log.debug('function getbinpath: ' + module); var modpath = require.resolve('shelljs').split('/'); var phantomidx = modpath.indexOf('shelljs'); var binpath = modpath.slice(0, phantomidx); binpath.push('.bin'); binpath.push(module); binpath = binpath.join('/'); log.debug('path for module :' + module + ': ' + binpath); return(binpath); };