webshot 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +29 -2
- data/lib/webshot/screenshot.rb +1 -1
- data/lib/webshot/version.rb +1 -1
- data/webshot.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62a9727397129f1b5a062f88bd46a48c1b4dd5db
|
4
|
+
data.tar.gz: b8d66c2cad1e39bb66c55b245549486d1e8e52bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6576d08d90ffe8fc2f129f143cf7f13327af5375e7ceef002646fa9df7f55baa459ebe7d8bfaed128e164359dadd15f3da8722d7f95f5d75903c155f857b807e
|
7
|
+
data.tar.gz: 4e76de6199a9a96ba5feb068645733dcc857bfefd667a30c7c43cce9d2e929f4c73580897b5c2f23c6f1263cb7be2e2ba82cc01257ed525a002650b8a2cf9868
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,10 @@ 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/)
|
10
|
-
|
9
|
+
Download and install [PhantomJS](http://phantomjs.org/),
|
10
|
+
add the directory containing the binary to your PATH.
|
11
|
+
|
12
|
+
Add the `webshot` gem to your Gemfile:
|
11
13
|
|
12
14
|
gem "webshot"
|
13
15
|
|
@@ -65,6 +67,31 @@ end.capture 'https://github.com/username/', 'github.png'
|
|
65
67
|
|
66
68
|
```
|
67
69
|
|
70
|
+
## Scaling
|
71
|
+
|
72
|
+
It's not recommended to start multiple PhantomJS concurrently.
|
73
|
+
You should serialize requests, treat the process as unreliable and
|
74
|
+
monitor it with daemontools, god, monit, etc.
|
75
|
+
|
76
|
+
Recommended setup:
|
77
|
+
|
78
|
+
[S3] <-- [CloudFront + 404 handler] <-- User Request
|
79
|
+
^
|
80
|
+
|
|
81
|
+
Worker <--> [Queue] <-- App
|
82
|
+
|
83
|
+
|
84
|
+
The application triggers screenshot requests which are queued and
|
85
|
+
then processed by a background worker (Resque, Sidkiq, etc).
|
86
|
+
The worker uploads the images to S3 which are served through
|
87
|
+
CloudFront. The CDN should be configured to serve a default
|
88
|
+
image (404 handler) with a low TTL to handle screenshot are not
|
89
|
+
yet ready or couldn't be generated.
|
90
|
+
|
91
|
+
Notes:
|
92
|
+
- sed 's/S3/Your file hosting service/g'
|
93
|
+
- sed 's/CloudFront/Your CDN service/g'
|
94
|
+
|
68
95
|
## Contributing
|
69
96
|
|
70
97
|
1. Fork it
|
data/lib/webshot/screenshot.rb
CHANGED
@@ -76,7 +76,7 @@ module Webshot
|
|
76
76
|
else
|
77
77
|
raise WebshotError.new("Could not fetch page: #{url.inspect}, error code: #{page.driver.status_code}")
|
78
78
|
end
|
79
|
-
rescue Capybara::Poltergeist::BrowserError, Capybara::Poltergeist::DeadClient, Capybara::Poltergeist::TimeoutError, Errno::EPIPE => e
|
79
|
+
rescue Capybara::Poltergeist::StatusFailError, Capybara::Poltergeist::BrowserError, Capybara::Poltergeist::DeadClient, Capybara::Poltergeist::TimeoutError, Errno::EPIPE => e
|
80
80
|
# TODO: Handle Errno::EPIPE and Errno::ECONNRESET
|
81
81
|
raise WebshotError.new("Capybara error: #{e.message.inspect}")
|
82
82
|
end
|
data/lib/webshot/version.rb
CHANGED
data/webshot.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "gem-release"
|
25
25
|
|
26
26
|
spec.add_dependency "activesupport"
|
27
|
-
spec.add_dependency "poltergeist", "~> 1.
|
27
|
+
spec.add_dependency "poltergeist", "~> 1.6.0"
|
28
28
|
spec.add_dependency "faye-websocket", "~> 0.7.3"
|
29
|
-
spec.add_dependency "mini_magick", "~> 3.
|
29
|
+
spec.add_dependency "mini_magick", "~> 4.3.3"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
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: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.6.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.6.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: faye-websocket
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.
|
117
|
+
version: 4.3.3
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 3.
|
124
|
+
version: 4.3.3
|
125
125
|
description: Captures a web page as a screenshot using Poltergeist, Capybara and PhantomJS
|
126
126
|
email:
|
127
127
|
- vitalie@penguin.ro
|