webshot 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/README.md +2 -2
- data/lib/webshot/screenshot.rb +6 -1
- data/lib/webshot/version.rb +1 -1
- data/test/webshot_test.rb +1 -1
- data/webshot.gemspec +1 -2
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a56dbd14a6df948f594dc79ca3aa56c5f939397b
|
4
|
+
data.tar.gz: 48d4838b8c38b5eb0932be0e3b14a3d1a5477b4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58fbd5018388d2e84cd4dfd085b93683c9e7a5217691cca074053ee461a01f965ce306b2f2708fe8f7a1c63e56211b4e543d124ea16a1f7ce25e94264830e07
|
7
|
+
data.tar.gz: 4f5a8e6a0969a3f0b124ec6f2c10768f88cc0412b693075bc900037e7e9db1935578f1634f40b0870a383a973c72673eb45165e3d51c829fc76760ba25830cf1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Captures a web page as a screenshot using Poltergeist, Capybara and PhantomJS.
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
Download and install [PhantomJS](http://phantomjs.org/releases.html) version
|
9
|
+
Download and install [PhantomJS](http://phantomjs.org/releases.html) version 2.X,
|
10
10
|
add the directory containing the binary to your PATH.
|
11
11
|
|
12
12
|
Add the `webshot` gem to your Gemfile:
|
@@ -89,7 +89,7 @@ Recommended setup:
|
|
89
89
|
|
90
90
|
|
91
91
|
The application triggers screenshot requests which are queued and
|
92
|
-
then processed by a background worker (Resque,
|
92
|
+
then processed by a background worker ([Resque](https://github.com/resque/resque), [Sidekiq](https://github.com/mperham/sidekiq), etc).
|
93
93
|
The worker uploads the images to S3 which are served through
|
94
94
|
CloudFront. The CDN should be configured to serve a default
|
95
95
|
image (404 handler) with a low TTL to handle screenshot are not
|
data/lib/webshot/screenshot.rb
CHANGED
@@ -40,6 +40,8 @@ module Webshot
|
|
40
40
|
height = opts.fetch(:height, 90)
|
41
41
|
gravity = opts.fetch(:gravity, "north")
|
42
42
|
quality = opts.fetch(:quality, 85)
|
43
|
+
full = opts.fetch(:full, true)
|
44
|
+
selector = opts.fetch(:selector, nil)
|
43
45
|
allowed_status_codes = opts.fetch(:allowed_status_codes, [])
|
44
46
|
|
45
47
|
# Reset session before visiting url
|
@@ -61,8 +63,11 @@ module Webshot
|
|
61
63
|
tmp = Tempfile.new(["webshot", ".png"])
|
62
64
|
tmp.close
|
63
65
|
begin
|
66
|
+
screenshot_opts = { full: full }
|
67
|
+
screenshot_opts = screenshot_opts.merge({ selector: selector }) if selector
|
68
|
+
|
64
69
|
# Save screenshot to file
|
65
|
-
page.driver.save_screenshot(tmp.path,
|
70
|
+
page.driver.save_screenshot(tmp.path, screenshot_opts)
|
66
71
|
|
67
72
|
# Resize screenshot
|
68
73
|
thumb = MiniMagick::Image.open(tmp.path)
|
data/lib/webshot/version.rb
CHANGED
data/test/webshot_test.rb
CHANGED
data/webshot.gemspec
CHANGED
@@ -18,13 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
22
21
|
spec.add_development_dependency "rake"
|
23
22
|
spec.add_development_dependency "minitest"
|
24
23
|
spec.add_development_dependency "gem-release"
|
25
24
|
|
26
25
|
spec.add_dependency "activesupport"
|
27
|
-
spec.add_dependency "poltergeist", "~> 1.
|
26
|
+
spec.add_dependency "poltergeist", "~> 1.12.0"
|
28
27
|
spec.add_dependency "faye-websocket", "~> 0.7.3"
|
29
28
|
spec.add_dependency "mini_magick", "~> 4.3.3"
|
30
29
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitalie Cherpec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,14 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
75
|
+
version: 1.12.0
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
82
|
+
version: 1.12.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: faye-websocket
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
149
|
version: '0'
|
164
150
|
requirements: []
|
165
151
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.4.5.1
|
167
153
|
signing_key:
|
168
154
|
specification_version: 4
|
169
155
|
summary: Captures a web page as a screenshot
|