phantomjs 1.9.2.0 → 1.9.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phantomjs.rb +2 -1
- data/lib/phantomjs/platform.rb +29 -1
- data/lib/phantomjs/version.rb +1 -1
- data/spec/platform_spec.rb +50 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32626604c40b862e43453c82158a2c8913942377
|
4
|
+
data.tar.gz: d3546eb7f19f1b66ba0e87e89cbba6f975265714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7a0bec77b65db70933130fe245ae7de83d973c44b96056e79758b3c5d42133d2047abd0cfb3cd2490060c8ce64dd608b92b69555ef8ac8ca188edabddf8025
|
7
|
+
data.tar.gz: ff7b5bd58f92de836a199db35eba29167af3c3181f017ff066e098a705e67fa7539c0373a54376c594f8fcd2edd59d07895fdd98266129279de0c9afb73e2b3e
|
data/lib/phantomjs.rb
CHANGED
@@ -53,4 +53,5 @@ end
|
|
53
53
|
require 'phantomjs/platform'
|
54
54
|
Phantomjs.available_platforms << Phantomjs::Platform::Linux32
|
55
55
|
Phantomjs.available_platforms << Phantomjs::Platform::Linux64
|
56
|
-
Phantomjs.available_platforms << Phantomjs::Platform::OsX
|
56
|
+
Phantomjs.available_platforms << Phantomjs::Platform::OsX
|
57
|
+
Phantomjs.available_platforms << Phantomjs::Platform::Win32
|
data/lib/phantomjs/platform.rb
CHANGED
@@ -9,6 +9,10 @@ module Phantomjs
|
|
9
9
|
RbConfig::CONFIG['host_cpu']
|
10
10
|
end
|
11
11
|
|
12
|
+
def temp_path
|
13
|
+
ENV['TMPDIR'] || ENV['TEMP'] || '/tmp'
|
14
|
+
end
|
15
|
+
|
12
16
|
def phantomjs_path
|
13
17
|
if system_phantomjs_installed?
|
14
18
|
system_phantomjs_path
|
@@ -42,7 +46,7 @@ module Phantomjs
|
|
42
46
|
|
43
47
|
# Purge temporary directory if it is still hanging around from previous installs,
|
44
48
|
# then re-create it.
|
45
|
-
temp_dir = File.join(
|
49
|
+
temp_dir = File.join(temp_path, 'phantomjs_install')
|
46
50
|
FileUtils.rm_rf temp_dir
|
47
51
|
FileUtils.mkdir_p temp_dir
|
48
52
|
|
@@ -130,5 +134,29 @@ module Phantomjs
|
|
130
134
|
end
|
131
135
|
end
|
132
136
|
end
|
137
|
+
|
138
|
+
class Win32 < Platform
|
139
|
+
class << self
|
140
|
+
def useable?
|
141
|
+
host_os.include?('mingw32') and architecture.include?('i686')
|
142
|
+
end
|
143
|
+
|
144
|
+
def platform
|
145
|
+
'win32'
|
146
|
+
end
|
147
|
+
|
148
|
+
def phantomjs_path
|
149
|
+
if system_phantomjs_installed?
|
150
|
+
system_phantomjs_path
|
151
|
+
else
|
152
|
+
File.expand_path File.join(Phantomjs.base_dir, platform, 'phantomjs.exe')
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def package_url
|
157
|
+
'https://phantomjs.googlecode.com/files/phantomjs-1.9.2-windows.zip'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
133
161
|
end
|
134
162
|
end
|
data/lib/phantomjs/version.rb
CHANGED
data/spec/platform_spec.rb
CHANGED
@@ -57,6 +57,10 @@ describe Phantomjs::Platform do
|
|
57
57
|
it "reports the Darwin platform as unuseable" do
|
58
58
|
Phantomjs::Platform::OsX.should_not be_useable
|
59
59
|
end
|
60
|
+
|
61
|
+
it "reports the Win32 Platform as unuseable" do
|
62
|
+
Phantomjs::Platform::Win32.should_not be_useable
|
63
|
+
end
|
60
64
|
end
|
61
65
|
|
62
66
|
describe "on a 32 bit linux" do
|
@@ -101,6 +105,10 @@ describe Phantomjs::Platform do
|
|
101
105
|
it "reports the Darwin platform as unuseable" do
|
102
106
|
Phantomjs::Platform::OsX.should_not be_useable
|
103
107
|
end
|
108
|
+
|
109
|
+
it "reports the Win32 Platform as unuseable" do
|
110
|
+
Phantomjs::Platform::Win32.should_not be_useable
|
111
|
+
end
|
104
112
|
end
|
105
113
|
|
106
114
|
describe "on OS X" do
|
@@ -139,6 +147,48 @@ describe Phantomjs::Platform do
|
|
139
147
|
it "reports the Linux64 platform as unuseable" do
|
140
148
|
Phantomjs::Platform::Linux64.should_not be_useable
|
141
149
|
end
|
150
|
+
|
151
|
+
it "reports the Win32 Platform as unuseable" do
|
152
|
+
Phantomjs::Platform::Win32.should_not be_useable
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe "on Windows" do
|
157
|
+
before do
|
158
|
+
Phantomjs::Platform.stub(:host_os).and_return('mingw32')
|
159
|
+
Phantomjs::Platform.stub(:architecture).and_return('i686')
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "without system install" do
|
163
|
+
before(:each) { Phantomjs::Platform.stub(:system_phantomjs_version).and_return(nil) }
|
164
|
+
|
165
|
+
it "returns the correct phantom js executable path for the platform" do
|
166
|
+
Phantomjs.path.should =~ /win32\/phantomjs.exe$/
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "with system install" do
|
171
|
+
before(:each) do
|
172
|
+
Phantomjs::Platform.stub(:system_phantomjs_version).and_return(Phantomjs.version)
|
173
|
+
Phantomjs::Platform.stub(:system_phantomjs_path).and_return("#{ENV['TEMP']}/path")
|
174
|
+
end
|
175
|
+
|
176
|
+
it "returns the correct phantom js executable path for the platform" do
|
177
|
+
expect(Phantomjs.path).to be == "#{ENV['TEMP']}/path"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
it "reports the Darwin platform as unuseable" do
|
182
|
+
Phantomjs::Platform::OsX.should_not be_useable
|
183
|
+
end
|
184
|
+
|
185
|
+
it "reports the Linux32 Platform as unuseable" do
|
186
|
+
Phantomjs::Platform::Linux32.should_not be_useable
|
187
|
+
end
|
188
|
+
|
189
|
+
it "reports the Linux64 platform as unuseable" do
|
190
|
+
Phantomjs::Platform::Linux64.should_not be_useable
|
191
|
+
end
|
142
192
|
end
|
143
193
|
|
144
194
|
describe 'on an unknown platform' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantomjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.2.
|
4
|
+
version: 1.9.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: poltergeist
|