Commit a3ca065c a3ca065c8306ebfc6a1931257eab257e943cf1dd by Nicolas Perriault

closes #79 - use phantomjs system module

1 parent c3b5e34b
......@@ -30,11 +30,13 @@
/*global console phantom require*/
if (phantom.version.major !== 1 || phantom.version.minor < 5) {
if (!phantom || phantom.version.major !== 1 || phantom.version.minor < 5) {
console.error('CasperJS needs at least PhantomJS v1.5.0');
phantom.exit(1);
}
var system = require('system');
(function bootstrap(global) {
"use strict";
/**
......@@ -71,7 +73,7 @@ if (phantom.version.major !== 1 || phantom.version.minor < 5) {
// casper root path
if (!phantom.casperPath) {
try {
phantom.casperPath = phantom.args.map(function _map(i) {
phantom.casperPath = system.args.map(function _map(i) {
var match = i.match(/^--casper-path=(.*)/);
if (match) {
return fs.absolute(match[1]);
......@@ -232,7 +234,7 @@ if (phantom.version.major !== 1 || phantom.version.minor < 5) {
phantom.Casper = require('casper').Casper;
// casper cli args
phantom.casperArgs = require('cli').parse(phantom.args);
phantom.casperArgs = require('cli').parse(system.args);
// loaded status
phantom.casperLoaded = true;
......
......@@ -30,13 +30,14 @@
/*global CasperError console exports phantom require*/
var system = require('system');
var utils = require('utils');
/**
* Extracts, normalize ad organize PhantomJS CLI arguments in a dedicated
* Object.
*
* @param array phantomArgs phantom.args value
* @param array phantomArgs system.args value
* @return Object
*/
exports.parse = function parse(phantomArgs) {
......