Commit 6bab3e19 6bab3e19edcd8333ac2a540054f24ee274057473 by Nicolas Perriault

fixed broken ability to use Casper without using the executable

1 parent 1c3b0b8d
......@@ -7,4 +7,4 @@ while [ -h "$CASPER_EXECUTABLE" ]; do
done
CASPERJS_HOME="$( cd -PL "$( dirname "$CASPER_EXECUTABLE" )" && cd .. && pwd )"
phantomjs $CASPERJS_HOME/casper.js --casper-path=$CASPERJS_HOME $*
phantomjs $CASPERJS_HOME/casper.js --casper-path=$CASPERJS_HOME --cli $*
......
......@@ -26,6 +26,10 @@
*
*/
(function(phantom) {
if (true === phantom.casperLoaded) {
return;
}
var fs = require('fs');
fs.pathJoin = function() {
......@@ -80,18 +84,22 @@
phantom.injectJs(fs.pathJoin(phantom.casperPath, 'lib', lib));
});
if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) {
console.log('Usage: casperjs script.(js|coffee) [options...]');
console.log('Read the docs http://n1k0.github.com/casperjs/');
phantom.exit(0);
}
phantom.casperLoaded = true;
phantom.casperScript = phantom.casperArgs.args[0];
if (true === phantom.casperArgs.options.cli) {
if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) {
console.log('Usage: casperjs script.(js|coffee) [options...]');
console.log('Read the docs http://n1k0.github.com/casperjs/');
phantom.exit(0);
}
if (!fs.isFile(phantom.casperScript)) {
console.log('Unable to open file: ' + phantom.casperScript);
phantom.exit(1);
}
phantom.casperScript = phantom.casperArgs.args[0];
if (!fs.isFile(phantom.casperScript)) {
console.log('Unable to open file: ' + phantom.casperScript);
phantom.exit(1);
}
phantom.injectJs(phantom.casperScript);
phantom.injectJs(phantom.casperScript);
}
})(phantom);
......