snapcrawl 0.2.4rc3 → 0.2.4rc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7215567547e93a3e376017197b66f94aa5ec92d1aa775d209241951909666e9f
4
- data.tar.gz: c94013330e9e165c9a28665422b66d6bc83420316a1a1f2f001e6e6c0cd6dacd
3
+ metadata.gz: 2edb5c120d33af705d3f04220c534ce7a4d1da0d5de7e252f9df7ac55ae61888
4
+ data.tar.gz: '00508fad9d3fca8123320f4dd9fd8c3a23cbcd590f2f52e39d9a269b48257f15'
5
5
  SHA512:
6
- metadata.gz: 4ad81c6c12ae20234ac663066e5f06cbcb7ca2c79560965e3db77147bbf0736431873d9a74fc5ea39ac4206e8329e08e33d0c87535fc09f734dcee02db5ac6de
7
- data.tar.gz: 5877c5959414dd52b92736e400fa9f9b624e4fcd77ea863804ca110e7e5123fa266967cb6a47180bb2a7daf6c4661c3507c55ec6896fc9a59c4bd9a6480ba7d7
6
+ metadata.gz: 3b5571ffd1751269e3e842b485b04cf130ceb0b3a64c6016724b8b0e11c6a451c0df590388356ee329a5c5d44c1692b584c986e8d161dbb34932cf48811c867a
7
+ data.tar.gz: aa5309aa123a25addf9eb0039b18fb3907d6a9d3d1aef1513790d32e4859c4b9909366316d071d3bc353936ffad5292753df9138a32fb249ee7245a000da2a1b
@@ -99,20 +99,16 @@ module Snapcrawl
99
99
  fetch_opts[:full] = false
100
100
  end
101
101
 
102
- # The webshot gem messes with stdout/stderr streams so we keep it in
103
- # check
104
- $keep_stdout, $keep_stderr = $stdout, $stderr
105
-
106
- webshot.capture url, image_path, fetch_opts do |magick|
107
- magick.combine_options do |c|
108
- c.background "white"
109
- c.gravity 'north'
110
- c.quality 100
111
- c.extent @opts.height > 0 ? "#{@opts.width}x#{@opts.height}" : "#{@opts.width}x"
102
+ hide_output do
103
+ webshot.capture url, image_path, fetch_opts do |magick|
104
+ magick.combine_options do |c|
105
+ c.background "white"
106
+ c.gravity 'north'
107
+ c.quality 100
108
+ c.extent @opts.height > 0 ? "#{@opts.width}x#{@opts.height}" : "#{@opts.width}x"
109
+ end
112
110
  end
113
- end
114
-
115
- $stdout, $stderr = $keep_stdout, $keep_stderr
111
+ end
116
112
 
117
113
  say "done"
118
114
  end
@@ -230,5 +226,16 @@ module Snapcrawl
230
226
  def webshot
231
227
  Webshot::Screenshot.instance
232
228
  end
229
+
230
+ # The webshot gem messes with stdout/stderr streams so we keep it in
231
+ # check by using this method. Also, in some sites (e.g. uown.co) it
232
+ # prints some output to stdout, this is why we override $stdout for
233
+ # the duration of the run.
234
+ def hide_output
235
+ $keep_stdout, $keep_stderr = $stdout, $stderr
236
+ $stdout, $stderr = StringIO.new, StringIO.new
237
+ yield
238
+ $stdout, $stderr = $keep_stdout, $keep_stderr
239
+ end
233
240
  end
234
241
  end
@@ -1,3 +1,3 @@
1
1
  module Snapcrawl
2
- VERSION = "0.2.4rc3"
2
+ VERSION = "0.2.4rc4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapcrawl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4rc3
4
+ version: 0.2.4rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit