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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5140b4376c8b38e9f41781040e442c0f35a0b07
4
- data.tar.gz: 9ca9caf484f0db27d020c1b61ffcdb0a5b472dbb
3
+ metadata.gz: a56dbd14a6df948f594dc79ca3aa56c5f939397b
4
+ data.tar.gz: 48d4838b8c38b5eb0932be0e3b14a3d1a5477b4f
5
5
  SHA512:
6
- metadata.gz: 49966a53d6333de66939476a2ce9d3586b6232285d8adb3a20b9a0242a6d40c4e0d59ee795e2063c609f8f2f57269e0d3f2c5fafaca2177b22d8ede66cd5706c
7
- data.tar.gz: 365212400948b15296b29a8c49be51f8fe45c5542cfb483fd774810b29dd606d52b85f9dfc45ea146c36ccceb59839c177f3084e80c016c1cbf885b4fb3ed669
6
+ metadata.gz: c58fbd5018388d2e84cd4dfd085b93683c9e7a5217691cca074053ee461a01f965ce306b2f2708fe8f7a1c63e56211b4e543d124ea16a1f7ce25e94264830e07
7
+ data.tar.gz: 4f5a8e6a0969a3f0b124ec6f2c10768f88cc0412b693075bc900037e7e9db1935578f1634f40b0870a383a973c72673eb45165e3d51c829fc76760ba25830cf1
@@ -3,8 +3,7 @@ cache: bundler
3
3
  before_install:
4
4
  - gem install bundler
5
5
  rvm:
6
+ - 2.3
6
7
  - 2.2
7
- - 2.1
8
- - 2.0
9
8
  matrix:
10
9
  fast_finish: true
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 1.9,
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, Sidkiq, etc).
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
@@ -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, :full => true)
70
+ page.driver.save_screenshot(tmp.path, screenshot_opts)
66
71
 
67
72
  # Resize screenshot
68
73
  thumb = MiniMagick::Image.open(tmp.path)
@@ -1,3 +1,3 @@
1
1
  module Webshot
2
- VERSION = '0.0.11'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class WebshotTest < MiniTest::Unit::TestCase
3
+ class WebshotTest < Minitest::Test
4
4
  DATA_DIR = File.expand_path(File.dirname(__FILE__) + "/data")
5
5
 
6
6
  def setup
@@ -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.8.0"
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.11
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: 2016-01-14 00:00:00.000000000 Z
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.8.0
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.8.0
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.2.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