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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
35 deletions
bin/bootstrap.js
bin/bootstrap.js
View file @
7d88a76
...
...
@@ -263,6 +263,47 @@ phantom.loadCasper = function() {
phantom
.
casperLoaded
=
true
;
};
phantom
.
initCasperCli
=
function
()
{
var
fs
=
require
(
"fs"
);
if
(
!!
phantom
.
casperArgs
.
options
.
version
)
{
console
.
log
(
phantom
.
casperVersion
.
toString
());
phantom
.
exit
(
0
);
}
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
)
{
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'
,
phantom
.
casperVersion
.
toString
(),
phantom
.
casperPath
,
phantomVersion
));
console
.
log
(
fs
.
read
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'bin'
,
'usage.txt'
)));
phantom
.
exit
(
0
);
}
if
(
!
phantom
.
casperScript
)
{
phantom
.
casperScript
=
phantom
.
casperArgs
.
get
(
0
);
}
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
{
new
Function
(
phantom
.
getScriptCode
(
phantom
.
casperScript
))();
}
catch
(
e
)
{
phantom
.
processScriptError
(
e
,
phantom
.
casperScript
);
}
};
if
(
!
phantom
.
casperLoaded
)
{
try
{
phantom
.
loadCasper
();
...
...
@@ -272,39 +313,6 @@ if (!phantom.casperLoaded) {
}
}
var
fs
=
require
(
"fs"
);
if
(
!!
phantom
.
casperArgs
.
options
.
version
)
{
console
.
log
(
phantom
.
casperVersion
.
toString
());
phantom
.
exit
(
0
);
}
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
)
{
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'
,
phantom
.
casperVersion
.
toString
(),
phantom
.
casperPath
,
phantomVersion
));
console
.
log
(
fs
.
read
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'bin'
,
'usage.txt'
)));
phantom
.
exit
(
0
);
}
if
(
!
phantom
.
casperScript
)
{
phantom
.
casperScript
=
phantom
.
casperArgs
.
get
(
0
);
}
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
{
new
Function
(
phantom
.
getScriptCode
(
phantom
.
casperScript
))();
}
catch
(
e
)
{
phantom
.
processScriptError
(
e
,
phantom
.
casperScript
);
if
(
true
===
phantom
.
casperArgs
.
get
(
'cli'
))
{
phantom
.
initCasperCli
();
}
...
...
Please
register
or
sign in
to post a comment