silkscreen 0.0.4 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/silkscreen +6 -1
- data/lib/silkscreen/version.rb +1 -1
- metadata +2 -2
data/bin/silkscreen
CHANGED
@@ -18,14 +18,19 @@ module Silkscreen
|
|
18
18
|
method_option :full, aliases: '-f', type: :boolean, default: false, desc: 'Capture full page or just the visible area'
|
19
19
|
method_option :output, aliases: '-o', type: :string, desc: 'Save the captured screenshot as a file at this path'
|
20
20
|
def capture(url)
|
21
|
+
headless = Headless.new
|
22
|
+
headless.start
|
23
|
+
|
21
24
|
driver = Selenium::WebDriver.for :chrome
|
22
25
|
window_width, window_height = options[:viewport].split('x').map { |x| x.to_i }
|
23
26
|
driver.manage.window.resize_to window_width, window_height
|
24
27
|
driver.navigate.to url
|
25
28
|
sleep options[:sleep]
|
26
29
|
img = driver.screenshot_as :png
|
27
|
-
driver.quit
|
28
30
|
|
31
|
+
driver.quit
|
32
|
+
headless.destroy
|
33
|
+
|
29
34
|
if options[:full]
|
30
35
|
if options[:max_width] || options[:max_height]
|
31
36
|
canvas = ChunkyPNG::Image.from_blob img
|
data/lib/silkscreen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silkscreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '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-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|