Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7d88a761
...
7d88a761df028712e2a7e994b48fd31e1a7c79ef
authored
2012-01-16 16:42:47 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed casper could not be used without the executable
1 parent
27398293
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
bin/bootstrap.js
bin/bootstrap.js
View file @
7d88a76
...
...
@@ -263,24 +263,16 @@ phantom.loadCasper = function() {
phantom
.
casperLoaded
=
true
;
};
if
(
!
phantom
.
casperLoaded
)
{
try
{
phantom
.
loadCasper
();
}
catch
(
e
)
{
console
.
error
(
"Unable to load casper environment: "
+
e
);
phantom
.
exit
();
}
}
phantom
.
initCasperCli
=
function
()
{
var
fs
=
require
(
"fs"
);
var
fs
=
require
(
"fs"
);
if
(
!!
phantom
.
casperArgs
.
options
.
version
)
{
if
(
!!
phantom
.
casperArgs
.
options
.
version
)
{
console
.
log
(
phantom
.
casperVersion
.
toString
());
phantom
.
exit
(
0
);
}
else
if
(
phantom
.
casperArgs
.
get
(
0
)
===
"test"
)
{
}
else
if
(
phantom
.
casperArgs
.
get
(
0
)
===
"test"
)
{
phantom
.
casperScript
=
fs
.
absolute
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'tests'
,
'run.js'
));
phantom
.
casperArgs
.
drop
(
"test"
);
}
else
if
(
phantom
.
casperArgs
.
args
.
length
===
0
||
!!
phantom
.
casperArgs
.
options
.
help
)
{
}
else
if
(
phantom
.
casperArgs
.
args
.
length
===
0
||
!!
phantom
.
casperArgs
.
options
.
help
)
{
var
phantomVersion
=
[
phantom
.
version
.
major
,
phantom
.
version
.
minor
,
phantom
.
version
.
patch
].
join
(
'.'
);
var
f
=
require
(
"utils"
).
format
;
console
.
log
(
f
(
'CasperJS version %s at %s, using PhantomJS version %s'
,
...
...
@@ -288,23 +280,39 @@ if (!!phantom.casperArgs.options.version) {
phantom
.
casperPath
,
phantomVersion
));
console
.
log
(
fs
.
read
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'bin'
,
'usage.txt'
)));
phantom
.
exit
(
0
);
}
}
if
(
!
phantom
.
casperScript
)
{
if
(
!
phantom
.
casperScript
)
{
phantom
.
casperScript
=
phantom
.
casperArgs
.
get
(
0
);
}
}
if
(
!
fs
.
isFile
(
phantom
.
casperScript
))
{
if
(
!
fs
.
isFile
(
phantom
.
casperScript
))
{
console
.
error
(
'Unable to open file: '
+
phantom
.
casperScript
);
phantom
.
exit
(
1
);
}
}
// filter out the called script name from casper args
phantom
.
casperArgs
.
drop
(
phantom
.
casperScript
);
// passed casperjs script execution
try
{
// filter out the called script name from casper args
phantom
.
casperArgs
.
drop
(
phantom
.
casperScript
);
// passed casperjs script execution
try
{
new
Function
(
phantom
.
getScriptCode
(
phantom
.
casperScript
))();
}
catch
(
e
)
{
}
catch
(
e
)
{
phantom
.
processScriptError
(
e
,
phantom
.
casperScript
);
}
};
if
(
!
phantom
.
casperLoaded
)
{
try
{
phantom
.
loadCasper
();
}
catch
(
e
)
{
console
.
error
(
"Unable to load casper environment: "
+
e
);
phantom
.
exit
();
}
}
if
(
true
===
phantom
.
casperArgs
.
get
(
'cli'
))
{
phantom
.
initCasperCli
();
}
...
...
Please
register
or
sign in
to post a comment