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,6 +84,9 @@
phantom.injectJs(fs.pathJoin(phantom.casperPath, 'lib', lib));
});
phantom.casperLoaded = true;
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/');
......@@ -94,4 +101,5 @@
}
phantom.injectJs(phantom.casperScript);
}
})(phantom);
......