diff --git a/lib/tools/phantomas/phantomasWrapper.js b/lib/tools/phantomas/phantomasWrapper.js index bdef3d7..6c7937f 100644 --- a/lib/tools/phantomas/phantomasWrapper.js +++ b/lib/tools/phantomas/phantomasWrapper.js @@ -1,6 +1,7 @@ var async = require('async'); var Q = require('q'); var ps = require('ps-node'); +var path = require('path'); var debug = require('debug')('ylt:phantomaswrapper'); var phantomas = require('phantomas'); @@ -46,8 +47,8 @@ var PhantomasWrapper = function() { 'windowPerformance' // overriden ].join(','), 'include-dirs': [ - 'lib/tools/phantomas/custom_modules/core', - 'lib/tools/phantomas/custom_modules/modules' + path.join(__dirname, 'custom_modules/core'), + path.join(__dirname, 'custom_modules/modules') ].join(',') }; @@ -55,7 +56,14 @@ var PhantomasWrapper = function() { debug('If you want to reproduce the phantomas task only, copy the following command line:'); var optionsString = ''; for (var opt in options) { - optionsString += ' ' + '--' + opt + '=' + options[opt]; + var value = options[opt]; + + if ((typeof value === 'string' || value instanceof String) && value.indexOf(' ') >= 0) { + value = '"' + value + '"'; + } + + optionsString += ' ' + '--' + opt + '=' + value; + } debug('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');