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 ...@@ -7,4 +7,4 @@ while [ -h "$CASPER_EXECUTABLE" ]; do
7 done 7 done
8 8
9 CASPERJS_HOME="$( cd -PL "$( dirname "$CASPER_EXECUTABLE" )" && cd .. && pwd )" 9 CASPERJS_HOME="$( cd -PL "$( dirname "$CASPER_EXECUTABLE" )" && cd .. && pwd )"
10 phantomjs $CASPERJS_HOME/casper.js --casper-path=$CASPERJS_HOME $* 10 phantomjs $CASPERJS_HOME/casper.js --casper-path=$CASPERJS_HOME --cli $*
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
26 * 26 *
27 */ 27 */
28 (function(phantom) { 28 (function(phantom) {
29 if (true === phantom.casperLoaded) {
30 return;
31 }
32
29 var fs = require('fs'); 33 var fs = require('fs');
30 34
31 fs.pathJoin = function() { 35 fs.pathJoin = function() {
...@@ -80,6 +84,9 @@ ...@@ -80,6 +84,9 @@
80 phantom.injectJs(fs.pathJoin(phantom.casperPath, 'lib', lib)); 84 phantom.injectJs(fs.pathJoin(phantom.casperPath, 'lib', lib));
81 }); 85 });
82 86
87 phantom.casperLoaded = true;
88
89 if (true === phantom.casperArgs.options.cli) {
83 if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) { 90 if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) {
84 console.log('Usage: casperjs script.(js|coffee) [options...]'); 91 console.log('Usage: casperjs script.(js|coffee) [options...]');
85 console.log('Read the docs http://n1k0.github.com/casperjs/'); 92 console.log('Read the docs http://n1k0.github.com/casperjs/');
...@@ -94,4 +101,5 @@ ...@@ -94,4 +101,5 @@
94 } 101 }
95 102
96 phantom.injectJs(phantom.casperScript); 103 phantom.injectJs(phantom.casperScript);
104 }
97 })(phantom); 105 })(phantom);
......