|
@@ -1,6 +1,7 @@
|
|
var async = require('async');
|
|
var async = require('async');
|
|
var Q = require('q');
|
|
var Q = require('q');
|
|
var ps = require('ps-node');
|
|
var ps = require('ps-node');
|
|
|
|
+var path = require('path');
|
|
var debug = require('debug')('ylt:phantomaswrapper');
|
|
var debug = require('debug')('ylt:phantomaswrapper');
|
|
var phantomas = require('phantomas');
|
|
var phantomas = require('phantomas');
|
|
|
|
|
|
@@ -46,8 +47,8 @@ var PhantomasWrapper = function() {
|
|
'windowPerformance' // overriden
|
|
'windowPerformance' // overriden
|
|
].join(','),
|
|
].join(','),
|
|
'include-dirs': [
|
|
'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(',')
|
|
].join(',')
|
|
};
|
|
};
|
|
|
|
|
|
@@ -55,7 +56,14 @@ var PhantomasWrapper = function() {
|
|
debug('If you want to reproduce the phantomas task only, copy the following command line:');
|
|
debug('If you want to reproduce the phantomas task only, copy the following command line:');
|
|
var optionsString = '';
|
|
var optionsString = '';
|
|
for (var opt in options) {
|
|
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');
|
|
debug('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');
|
|
|
|
|