Brikou CARRE 2012-05-16 09:37:26 +02:00 committed by Ariya Hidayat
parent 71425850f6
commit 1125b86e72
30 changed files with 33 additions and 33 deletions

View File

@ -21,7 +21,7 @@ page.onInitialized = ->
if system.args.length is 1
console.log 'Usage: unsniff.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
console.log 'Checking ' + address + '...'

View File

@ -34,7 +34,7 @@ page.onInitialized = function () {
if (system.args.length === 1) {
console.log('Usage: unsniff.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];
console.log('Checking ' + address + '...');

View File

@ -6,7 +6,7 @@ system = require 'system'
if system.args.length < 3
console.log 'Usage: direction.coffee origin destination'
console.log 'Example: direction.coffee "San Diego" "Palo Alto"'
phantom.exit(1)
phantom.exit 1
else
origin = system.args[1]
dest = system.args[2]

View File

@ -4,7 +4,7 @@ system = require 'system'
if system.args.length < 3
console.log "Usage: echoToFile.coffee DESTINATION_FILE <arguments to echo...>"
phantom.exit()
phantom.exit 1
else
content = ""
f = null

View File

@ -4,7 +4,7 @@ var fs = require('fs'),
if (system.args.length < 3) {
console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
phantom.exit();
phantom.exit(1);
} else {
var content = '',
f = null;

View File

@ -5,7 +5,7 @@ system = require 'system'
if system.args.length isnt 2
console.log 'Usage: imagebin.coffee filename'
phantom.exit()
phantom.exit 1
else
fname = system.args[1]
page.open 'http://imagebin.org/index.php?page=add', ->

View File

@ -6,7 +6,7 @@ var page = require('webpage').create(),
if (system.args.length !== 2) {
console.log('Usage: imagebin.js filename');
phantom.exit();
phantom.exit(1);
} else {
fname = system.args[1];
page.open("http://imagebin.org/index.php?page=add", function () {

View File

@ -3,7 +3,7 @@ system = require 'system'
if system.args.length is 1
console.log 'Usage: loadspeed.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
t = Date.now()
address = system.args[1]

View File

@ -4,7 +4,7 @@ var page = require('webpage').create(),
if (system.args.length === 1) {
console.log('Usage: loadspeed.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
t = Date.now();
address = system.args[1];

View File

@ -3,7 +3,7 @@ system = require 'system'
if system.args.length is 1
console.log 'Usage: netlog.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
page.onResourceRequested = (req) ->

View File

@ -4,7 +4,7 @@ var page = require('webpage').create(),
if (system.args.length === 1) {
console.log('Usage: netlog.js <some URL>');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];

View File

@ -78,7 +78,7 @@ system = require 'system'
if system.args.length is 1
console.log 'Usage: netsniff.coffee <some URL>'
phantom.exit()
phantom.exit 1
else
page.address = system.args[1]
page.resources = []

View File

@ -89,7 +89,7 @@ var page = require('webpage').create(),
if (system.args.length === 1) {
console.log('Usage: netsniff.coffee <some URL>');
phantom.exit();
phantom.exit(1);
} else {
page.address = system.args[1];

View File

@ -7,7 +7,7 @@ var page = require('webpage').create(),
if (system.args.length !== 2) {
console.log('Usage: postserver.js <portnumber>');
phantom.exit();
phantom.exit(1);
}
var port = system.args[1];

View File

@ -7,7 +7,7 @@ function someCallback(pageNum, numPages) {
if (system.args.length < 3) {
console.log('Usage: printheaderfooter.js URL filename');
phantom.exit();
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];

View File

@ -4,7 +4,7 @@ var page = require('webpage').create(),
if (system.args.length < 7) {
console.log('Usage: printmargins.js URL filename LEFT TOP RIGHT BOTTOM');
console.log(' margin examples: "1cm", "10px", "7mm", "5in"');
phantom.exit();
phantom.exit(1);
} else {
var address = system.args[1];
var output = system.args[2];

View File

@ -4,7 +4,7 @@ system = require 'system'
if system.args.length < 3 or system.args.length > 4
console.log 'Usage: rasterize.coffee URL filename [paperwidth*paperheight|paperformat]'
console.log ' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'
phantom.exit()
phantom.exit 1
else
address = system.args[1]
output = system.args[2]

View File

@ -5,7 +5,7 @@ var page = require('webpage').create(),
if (system.args.length < 3 || system.args.length > 4) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
phantom.exit();
phantom.exit(1);
} else {
address = system.args[1];
output = system.args[2];

View File

@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
@ -33,7 +33,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if system.args.length isnt 2
console.log 'Usage: run-jasmine.coffee URL'
phantom.exit()
phantom.exit 1
page = require('webpage').create()

View File

@ -38,7 +38,7 @@ function waitFor(testFx, onReady, timeOutMillis) {
if (system.args.length !== 2) {
console.log('Usage: run-jasmine.js URL');
phantom.exit();
phantom.exit(1);
}
var page = require('webpage').create();

View File

@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
@ -33,7 +33,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if system.args.length isnt 2
console.log 'Usage: run-qunit.coffee URL'
phantom.exit(1)
phantom.exit 1
page = require('webpage').create()
@ -44,7 +44,7 @@ page.onConsoleMessage = (msg) ->
page.open system.args[1], (status) ->
if status isnt 'success'
console.log 'Unable to access network'
phantom.exit(1)
phantom.exit 1
else
waitFor ->
page.evaluate ->

View File

@ -3,7 +3,7 @@ system = require 'system'
if system.args.length != 2
console.log "Usage: phantomjs scandir.coffee DIRECTORY_TO_SCAN"
phantom.exit()
phantom.exit 1
scanDirectory = (path) ->
fs = require 'fs'
if fs.exists(path) and fs.isFile(path)

View File

@ -3,7 +3,7 @@ var system = require('system');
if (system.args.length !== 2) {
console.log("Usage: phantomjs scandir.js DIRECTORY_TO_SCAN");
phantom.exit();
phantom.exit(1);
}
var scanDirectory = function (path) {

View File

@ -5,7 +5,7 @@ var host, port;
if (system.args.length !== 2) {
console.log('Usage: server.js <some port>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
var listening = server.listen(port, function (request, response) {

View File

@ -3,7 +3,7 @@ var port, server, service,
if (system.args.length !== 2) {
console.log('Usage: serverkeepalive.js <portnumber>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
server = require('webserver').create();

View File

@ -2,7 +2,7 @@ system = require 'system'
if system.args.length is 1
console.log "Usage: simpleserver.coffee <portnumber>"
phantom.exit()
phantom.exit 1
else
port = system.args[1]
server = require("webserver").create()

View File

@ -3,7 +3,7 @@ var port, server, service,
if (system.args.length !== 2) {
console.log('Usage: simpleserver.js <portnumber>');
phantom.exit();
phantom.exit(1);
} else {
port = system.args[1];
server = require('webserver').create();

View File

@ -6,7 +6,7 @@ system = require 'system'
if system.args.length < 2
console.log "Usage: phantomjs sleepsort.coffee PUT YOUR INTEGERS HERE SEPARATED BY SPACES"
phantom.exit()
phantom.exit 1
else
sortedCount = 0
args = Array.prototype.slice.call(system.args, 1)

View File

@ -17,7 +17,7 @@ function sleepSort(array, callback) {
if ( system.args < 2 ) {
console.log("Usage: phantomjs sleepsort.js PUT YOUR INTEGERS HERE SEPARATED BY SPACES");
phantom.exit();
phantom.exit(1);
} else {
sleepSort(Array.prototype.slice.call(system.args, 1), function() {
phantom.exit();

View File

@ -21,7 +21,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
if not condition
# If condition still not fulfilled (timeout but condition is 'false')
console.log "'waitFor()' timeout"
phantom.exit(1)
phantom.exit 1
else
# Condition fulfilled (timeout and/or condition is 'true')
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."