phantomjs-binaries 1.8.0 → 1.8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module Phantomjs
2
2
  module Binaries
3
- VERSION = "1.8.0"
3
+ VERSION = "1.8.0.1"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Phantomjs::Binaries::VERSION
8
8
  s.authors = ["Anton Vaynshtok"]
9
9
  s.email = ["avaynshtok@gmail.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/avaynshtok/phantomjs-binaries"
11
11
  s.summary = %q{phantom.js binaries wrapped as a ruby gem}
12
12
  s.description = %q{This package prevents you from having to install phantom.js independently outside your app.}
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantomjs-binaries
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sys-uname
@@ -32,42 +32,22 @@ description: This package prevents you from having to install phantom.js indepen
32
32
  email:
33
33
  - avaynshtok@gmail.com
34
34
  executables:
35
- - bootstrap.js
36
- - casperjs
37
35
  - phantomjs
38
36
  - phantomjs-1.8.0-darwin-x86_64
39
37
  - phantomjs-1.8.0-linux-x86_64
40
- - usage.txt
41
38
  extensions: []
42
39
  extra_rdoc_files: []
43
40
  files:
44
41
  - Gemfile
45
42
  - Gemfile.lock
46
43
  - Rakefile
47
- - bin/bootstrap.js
48
- - bin/casperjs
49
44
  - bin/phantomjs
50
45
  - bin/phantomjs-1.8.0-darwin-x86_64
51
46
  - bin/phantomjs-1.8.0-linux-x86_64
52
- - bin/usage.txt
53
47
  - lib/phantomjs-binaries.rb
54
48
  - lib/phantomjs-binaries/version.rb
55
- - modules/casper.js
56
- - modules/cli.js
57
- - modules/clientutils.js
58
- - modules/colorizer.js
59
- - modules/events.js
60
- - modules/http.js
61
- - modules/mouse.js
62
- - modules/pagestack.js
63
- - modules/querystring.js
64
- - modules/tester.js
65
- - modules/utils.js
66
- - modules/vendors/coffee-script.js
67
- - modules/xunit.js
68
- - package.json
69
49
  - phantomjs-binaries.gemspec
70
- homepage: ''
50
+ homepage: https://github.com/avaynshtok/phantomjs-binaries
71
51
  licenses: []
72
52
  post_install_message:
73
53
  rdoc_options: []
data/bin/bootstrap.js DELETED
@@ -1,342 +0,0 @@
1
- /*!
2
- * Casper is a navigation utility for PhantomJS.
3
- *
4
- * Documentation: http://casperjs.org/
5
- * Repository: http://github.com/n1k0/casperjs
6
- *
7
- * Copyright (c) 2011-2012 Nicolas Perriault
8
- *
9
- * Part of source code is Copyright Joyent, Inc. and other Node contributors.
10
- *
11
- * Permission is hereby granted, free of charge, to any person obtaining a
12
- * copy of this software and associated documentation files (the "Software"),
13
- * to deal in the Software without restriction, including without limitation
14
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
- * and/or sell copies of the Software, and to permit persons to whom the
16
- * Software is furnished to do so, subject to the following conditions:
17
- *
18
- * The above copyright notice and this permission notice shall be included
19
- * in all copies or substantial portions of the Software.
20
- *
21
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
- * DEALINGS IN THE SOFTWARE.
28
- *
29
- */
30
-
31
- /*global console phantom require*/
32
- /*jshint maxstatements:30 maxcomplexity:10*/
33
-
34
- if (!phantom) {
35
- console.error('CasperJS needs to be executed in a PhantomJS environment http://phantomjs.org/');
36
- phantom.exit(1);
37
- }
38
-
39
- if (phantom.version.major === 1 && phantom.version.minor < 7) {
40
- console.error('CasperJS needs at least PhantomJS v1.7 or later.');
41
- phantom.exit(1);
42
- } else {
43
- bootstrap(window);
44
- }
45
-
46
- // Polyfills
47
- if (typeof Function.prototype.bind !== "function") {
48
- Function.prototype.bind = function(scope) {
49
- "use strict";
50
- var _function = this;
51
- return function() {
52
- return _function.apply(scope, arguments);
53
- };
54
- };
55
- }
56
-
57
- /**
58
- * CasperJS ships with its own implementation of CommonJS' require() because
59
- * PhantomJS' native one doesn't allow to specify supplementary, alternative
60
- * lookup directories to fetch modules from.
61
- *
62
- */
63
- function patchRequire(require, requireDirs) {
64
- "use strict";
65
- require('webserver'); // force generation of phantomjs' require.cache for the webserver module
66
- var fs = require('fs');
67
- var phantomBuiltins = ['fs', 'webpage', 'system', 'webserver'];
68
- var phantomRequire = phantom.__orig__require = require;
69
- var requireCache = {};
70
- function possiblePaths(path, requireDir) {
71
- var dir, paths = [];
72
- if (path[0] === '.') {
73
- paths.push.apply(paths, [
74
- fs.absolute(path),
75
- fs.absolute(fs.pathJoin(requireDir, path))
76
- ]);
77
- } else if (path[0] === '/') {
78
- paths.push(path);
79
- } else {
80
- dir = fs.absolute(requireDir);
81
- while (dir !== '' && dir.lastIndexOf(':') !== dir.length - 1) {
82
- paths.push(fs.pathJoin(dir, 'modules', path));
83
- // nodejs compatibility
84
- paths.push(fs.pathJoin(dir, 'node_modules', path));
85
- dir = fs.dirname(dir);
86
- }
87
- paths.push(fs.pathJoin(requireDir, 'lib', path));
88
- paths.push(fs.pathJoin(requireDir, 'modules', path));
89
- }
90
- return paths;
91
- }
92
- var patchedRequire = function _require(path) {
93
- var i, paths = [],
94
- fileGuesses = [],
95
- file,
96
- module = {
97
- exports: {}
98
- };
99
- if (phantomBuiltins.indexOf(path) !== -1) {
100
- return phantomRequire(path);
101
- }
102
- requireDirs.forEach(function(requireDir) {
103
- paths = paths.concat(possiblePaths(path, requireDir));
104
- });
105
- paths.forEach(function _forEach(testPath) {
106
- fileGuesses.push.apply(fileGuesses, [
107
- testPath,
108
- testPath + '.js',
109
- testPath + '.json',
110
- testPath + '.coffee',
111
- fs.pathJoin(testPath, 'index.js'),
112
- fs.pathJoin(testPath, 'index.json'),
113
- fs.pathJoin(testPath, 'index.coffee'),
114
- fs.pathJoin(testPath, 'lib', fs.basename(testPath) + '.js'),
115
- fs.pathJoin(testPath, 'lib', fs.basename(testPath) + '.json'),
116
- fs.pathJoin(testPath, 'lib', fs.basename(testPath) + '.coffee')
117
- ]);
118
- });
119
- file = null;
120
- for (i = 0; i < fileGuesses.length && !file; ++i) {
121
- if (fs.isFile(fileGuesses[i])) {
122
- file = fileGuesses[i];
123
- }
124
- }
125
- if (!file) {
126
- throw new window.CasperError("CasperJS couldn't find module " + path);
127
- }
128
- if (file in requireCache) {
129
- return requireCache[file].exports;
130
- }
131
- if (/\.json/i.test(file)) {
132
- var parsed = JSON.parse(fs.read(file));
133
- requireCache[file] = parsed;
134
- return parsed;
135
- }
136
- var scriptCode = (function getScriptCode(file) {
137
- var scriptCode = fs.read(file);
138
- if (/\.coffee$/i.test(file)) {
139
- /*global CoffeeScript*/
140
- scriptCode = CoffeeScript.compile(scriptCode);
141
- }
142
- return scriptCode;
143
- })(file);
144
- var fn = new Function('__file__', 'require', 'module', 'exports', scriptCode);
145
- try {
146
- fn(file, _require, module, module.exports);
147
- } catch (e) {
148
- var error = new window.CasperError('__mod_error(' + path + ':' + e.line + '):: ' + e);
149
- error.file = file;
150
- error.line = e.line;
151
- error.stack = e.stack;
152
- error.stackArray = JSON.parse(JSON.stringify(e.stackArray));
153
- if (error.stackArray.length > 0) {
154
- error.stackArray[0].sourceURL = file;
155
- }
156
- throw error;
157
- }
158
- requireCache[file] = module;
159
- return module.exports;
160
- };
161
- patchedRequire.patched = true;
162
- return patchedRequire;
163
- }
164
-
165
- function bootstrap(global) {
166
- "use strict";
167
- var phantomArgs = require('system').args;
168
-
169
- /**
170
- * Hooks in default phantomjs error handler to print a hint when a possible
171
- * casperjs command misuse is detected.
172
- *
173
- */
174
- phantom.onError = function onPhantomError(msg, trace) {
175
- phantom.defaultErrorHandler.apply(phantom, arguments);
176
- if (msg.indexOf("ReferenceError: Can't find variable: casper") === 0) {
177
- console.error('Hint: you may want to use the `casperjs test` command.');
178
- }
179
- };
180
-
181
- /**
182
- * Loads and initialize the CasperJS environment.
183
- */
184
- phantom.loadCasper = function loadCasper() {
185
- // Patching fs
186
- // TODO: watch for these methods being implemented in official fs module
187
- var fs = (function _fs(fs) {
188
- if (!fs.hasOwnProperty('basename')) {
189
- fs.basename = function basename(path) {
190
- return path.replace(/.*\//, '');
191
- };
192
- }
193
- if (!fs.hasOwnProperty('dirname')) {
194
- fs.dirname = function dirname(path) {
195
- return path.replace(/\\/g, '/').replace(/\/[^\/]*$/, '');
196
- };
197
- }
198
- if (!fs.hasOwnProperty('isWindows')) {
199
- fs.isWindows = function isWindows() {
200
- var testPath = arguments[0] || this.workingDirectory;
201
- return (/^[a-z]{1,2}:/i).test(testPath) || testPath.indexOf("\\\\") === 0;
202
- };
203
- }
204
- if (!fs.hasOwnProperty('pathJoin')) {
205
- fs.pathJoin = function pathJoin() {
206
- return Array.prototype.join.call(arguments, this.separator);
207
- };
208
- }
209
- return fs;
210
- })(require('fs'));
211
-
212
- // casper root path
213
- if (!phantom.casperPath) {
214
- try {
215
- phantom.casperPath = phantom.args.map(function _map(i) {
216
- var match = i.match(/^--casper-path=(.*)/);
217
- if (match) {
218
- return fs.absolute(match[1]);
219
- }
220
- }).filter(function _filter(path) {
221
- return fs.isDirectory(path);
222
- }).pop();
223
- } catch (e) {}
224
- }
225
-
226
- if (!phantom.casperPath) {
227
- console.error("Couldn't find nor compute phantom.casperPath, exiting.");
228
- phantom.exit(1);
229
- }
230
-
231
- // Embedded, up-to-date, validatable & controlable CoffeeScript
232
- phantom.injectJs(fs.pathJoin(phantom.casperPath, 'modules', 'vendors', 'coffee-script.js'));
233
-
234
- // custom global CasperError
235
- global.CasperError = function CasperError(msg) {
236
- Error.call(this);
237
- this.message = msg;
238
- this.name = 'CasperError';
239
- };
240
-
241
- // standard Error prototype inheritance
242
- global.CasperError.prototype = Object.getPrototypeOf(new Error());
243
-
244
- // CasperJS version, extracted from package.json - see http://semver.org/
245
- phantom.casperVersion = (function getVersion(path) {
246
- var parts, patchPart, pkg, pkgFile;
247
- var fs = require('fs');
248
- pkgFile = fs.absolute(fs.pathJoin(path, 'package.json'));
249
- if (!fs.exists(pkgFile)) {
250
- throw new global.CasperError('Cannot find package.json at ' + pkgFile);
251
- }
252
- try {
253
- pkg = JSON.parse(require('fs').read(pkgFile));
254
- } catch (e) {
255
- throw new global.CasperError('Cannot read package file contents: ' + e);
256
- }
257
- parts = pkg.version.trim().split(".");
258
- if (parts.length < 3) {
259
- throw new global.CasperError("Invalid version number");
260
- }
261
- patchPart = parts[2].split('-');
262
- return {
263
- major: ~~parts[0] || 0,
264
- minor: ~~parts[1] || 0,
265
- patch: ~~patchPart[0] || 0,
266
- ident: patchPart[1] || "",
267
- toString: function toString() {
268
- var version = [this.major, this.minor, this.patch].join('.');
269
- if (this.ident) {
270
- version = [version, this.ident].join('-');
271
- }
272
- return version;
273
- }
274
- };
275
- })(phantom.casperPath);
276
-
277
- // patch require
278
- global.require = patchRequire(global.require, [phantom.casperPath, fs.workingDirectory]);
279
-
280
- // casper cli args
281
- phantom.casperArgs = global.require('cli').parse(phantom.args);
282
-
283
- // loaded status
284
- phantom.casperLoaded = true;
285
- };
286
-
287
- /**
288
- * Initializes the CasperJS Command Line Interface.
289
- */
290
- phantom.initCasperCli = function initCasperCli() {
291
- var fs = require("fs");
292
- var baseTestsPath = fs.pathJoin(phantom.casperPath, 'tests');
293
-
294
- if (!!phantom.casperArgs.options.version) {
295
- console.log(phantom.casperVersion.toString());
296
- return phantom.exit();
297
- } else if (phantom.casperArgs.get(0) === "test") {
298
- phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js'));
299
- phantom.casperTest = true;
300
- phantom.casperArgs.drop("test");
301
- } else if (phantom.casperArgs.get(0) === "selftest") {
302
- phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js'));
303
- phantom.casperSelfTest = phantom.casperTest = true;
304
- phantom.casperArgs.options.includes = fs.pathJoin(baseTestsPath, 'selftest.js');
305
- if (phantom.casperArgs.args.length <= 1) {
306
- phantom.casperArgs.args.push(fs.pathJoin(baseTestsPath, 'suites'));
307
- }
308
- phantom.casperArgs.drop("selftest");
309
- } else if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) {
310
- var phantomVersion = [phantom.version.major, phantom.version.minor, phantom.version.patch].join('.');
311
- var f = require("utils").format;
312
- console.log(f('CasperJS version %s at %s, using PhantomJS version %s',
313
- phantom.casperVersion.toString(),
314
- phantom.casperPath, phantomVersion));
315
- console.log(fs.read(fs.pathJoin(phantom.casperPath, 'bin', 'usage.txt')));
316
- return phantom.exit(0);
317
- }
318
-
319
- if (!phantom.casperScript) {
320
- phantom.casperScript = phantom.casperArgs.get(0);
321
- }
322
-
323
- if (!fs.isFile(phantom.casperScript)) {
324
- console.error('Unable to open file: ' + phantom.casperScript);
325
- return phantom.exit(1);
326
- }
327
-
328
- // filter out the called script name from casper args
329
- phantom.casperArgs.drop(phantom.casperScript);
330
-
331
- // passed casperjs script execution
332
- phantom.injectJs(phantom.casperScript);
333
- };
334
-
335
- if (!phantom.casperLoaded) {
336
- phantom.loadCasper();
337
- }
338
-
339
- if (true === phantom.casperArgs.get('cli')) {
340
- phantom.initCasperCli();
341
- }
342
- }
data/bin/casperjs DELETED
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Ruby Wrapper for CasperJs
3
- # by hannyu
4
-
5
- def resolve(file_path)
6
- while File.symlink?(file_path) do
7
- file_path = File.readlink(file_path)
8
- end
9
- file_path
10
- end
11
-
12
- CASPER_PATH = File.dirname(File.dirname(File.expand_path(resolve(__FILE__))))
13
-
14
- PHANTOMJS_NATIVE_ARGS = [
15
- '--cookies-file',
16
- '--config',
17
- '--debug',
18
- '--disk-cache',
19
- '--ignore-ssl-errors',
20
- '--load-images',
21
- '--load-plugins',
22
- '--local-storage-path',
23
- '--local-storage-quota',
24
- '--local-to-remote-url-access',
25
- '--max-disk-cache-size',
26
- '--output-encoding',
27
- '--proxy',
28
- '--proxy-auth',
29
- '--proxy-type',
30
- '--remote-debugger-port',
31
- '--remote-debugger-autorun',
32
- '--script-encoding',
33
- '--web-security',
34
- ]
35
-
36
- CASPER_ARGS = []
37
- PHANTOMJS_ARGS = []
38
- ARGV.each do |arg|
39
- is_found = false
40
- PHANTOMJS_NATIVE_ARGS.each do |pna|
41
- if arg.start_with? pna
42
- PHANTOMJS_ARGS << arg
43
- is_found = true
44
- break
45
- end
46
- end
47
- CASPER_ARGS << arg if not is_found
48
- end
49
-
50
- CASPER_COMMAND = []
51
- CASPER_COMMAND << (ENV["PHANTOMJS_EXECUTABLE"] || "phantomjs")
52
- CASPER_COMMAND.concat PHANTOMJS_ARGS
53
- CASPER_COMMAND << File.join(CASPER_PATH, "bin", "bootstrap.js")
54
- CASPER_COMMAND << "--casper-path=#{CASPER_PATH}"
55
- CASPER_COMMAND << "--cli"
56
- CASPER_COMMAND.concat CASPER_ARGS
57
-
58
- exec CASPER_COMMAND.join(" ")