blinkr 0.3.8 → 0.3.9

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: 66a212fd08a0e0112b033c4ba696dc8ff0c77be6
4
- data.tar.gz: 23301db2cd611dcd4c075972ac94dbfebb4228be
3
+ metadata.gz: c2657c0ca08b00bf7cf9382dbe26798919ec9c72
4
+ data.tar.gz: 849ccd9b225ee72eb254d33de181e368fefae007
5
5
  SHA512:
6
- metadata.gz: 881c1f04dfddd69802a19e91b15aa6e5048731123578f65716c4517bed2106e327f59078e6b0ed2336204928cc1f2334dac331e549e4bb15d4b14142a18fbfcb
7
- data.tar.gz: db66a8ec76a20da8df107c5602edc8b4e344f9a0754de35705236ce14be5d74135dde482c3054769e7cf02a2bf376f844299a2d9f27b956b0cd7da651a7ea37d
6
+ metadata.gz: 8773b0022dc4c69561a4c744d95fef17e76f548d77730f75dea2630d7832b4d7de22d30ac7cafd55bd562a246cfd224522b412206fbfea53b47a858cd649809d
7
+ data.tar.gz: 3a9909351f7f27451c7e29d6b5fc176bedf2b76b7ba7a121d754801a019b12720f9cfe27fc64dbe3555ce3d6ce25690d96c872744601ef81f80d11bb18b9ca31
@@ -38,13 +38,24 @@ module Blinkr
38
38
  r
39
39
  end
40
40
 
41
- def ignored? url, code, message
42
- return false if uril.nil? || code.nil? || message.nil?
41
+ def ignored? error
42
+ url = error.url
43
+ code = error.code
44
+ message = error.message
45
+ snippet = error.snippet
43
46
 
44
47
  ignores.any? do |ignore|
45
- return true if ignore.has_key?('url') && ignore['url'].match(url)
46
- return true if ignore.has_key?('code') && ignore['code'] == code
47
- return true if ignore.has_key?('message') && ignore['message'].match(message)
48
+ return true if ignore['url'].is_a?(Regexp) && url && ignore['url'] =~ url
49
+ return true if ignore['url'] == url
50
+
51
+ return true if ignore['code'].is_a?(Regexp) && code && ignore['code'] == code
52
+ return true if ignore['code'] == code
53
+
54
+ return true if ignore['message'].is_a?(Regexp) && message && ignore['message'] =~ message
55
+ return true if ignore['message'] == message
56
+
57
+ return true if ignore['snippet'].is_a?(Regexp) && snippet && ignore['snippet'] =~ snippet
58
+ return true if ignore['snippet'] == snippet
48
59
  false
49
60
  end
50
61
  end
@@ -109,7 +109,7 @@ module Blinkr
109
109
  end
110
110
 
111
111
  def <<(error)
112
- if @config.ignored?(error.url, error.code, error.message)
112
+ if @config.ignored?(error)
113
113
  self
114
114
  else
115
115
  super
@@ -63,13 +63,13 @@ module Blinkr
63
63
  end
64
64
  @links.each do |url, metadata|
65
65
  # if link start_with? @config.base_url check to see if it's in the sitemap.xml
66
- browser.process(url, @config.max_retrys, :method => :get, :followlocation => true, :timeout => 30,
66
+ browser.process(url, @config.max_retrys, :method => :get, :followlocation => true, :timeout => 60,
67
67
  :cookiefile => '_tmp/cookies', :cookiejar => '_tmp/cookies',
68
- :connecttimeout => 10, :maxredirs => 3) do |resp|
68
+ :connecttimeout => 30, :maxredirs => 3) do |resp|
69
69
  puts "Loaded #{url} via #{browser.name} #{'(cached)' if resp.cached?}" if @config.verbose
70
70
 
71
71
  resp_code = resp.code.to_i
72
- if resp_code < 200 || ((resp_code > 300 && resp_code < 400) && @config.warning_on_300s) || resp_code > 400
72
+ if ((resp_code > 300 && resp_code < 400) && @config.warning_on_300s) || resp_code > 400
73
73
  response = resp
74
74
 
75
75
  detail = nil
@@ -35,6 +35,10 @@ module Blinkr
35
35
  'phantomjs'
36
36
  end
37
37
 
38
+ def command
39
+ 'phantomjs'
40
+ end
41
+
38
42
  private
39
43
 
40
44
  def _process url, limit, max, opts = {}, &block
@@ -47,7 +51,7 @@ module Blinkr
47
51
  return block.call response, @cache.get("#{url}-resourceErrors"), @cache.get("#{url}-javascriptErrors")
48
52
  end
49
53
 
50
- output, status = Open3.capture2("#{name} #{SNAP_JS} #{url} #{@config.viewport}")
54
+ output, status = Open3.capture2("#{command} #{SNAP_JS} #{url} #{@config.viewport}")
51
55
  if status == 0
52
56
  json = JSON.load(output)
53
57
  response = Typhoeus::Response.new(:code => 200, :body => json['content'], :effective_url => json['url'],
@@ -3,5 +3,10 @@ module Blinkr
3
3
  def name
4
4
  'slimerjs'
5
5
  end
6
+
7
+ def command
8
+ return 'xvfb-run slimerjs' if @config.xvfb
9
+ 'slimerjs'
10
+ end
6
11
  end
7
12
  end
@@ -77,7 +77,9 @@ module Blinkr
77
77
  unless @config.skipped? url
78
78
  req = Typhoeus::Request.new(
79
79
  url,
80
- opts.merge(:followlocation => true)
80
+ opts.merge(:followlocation => true, :timeout => 60,
81
+ :cookiefile => '_tmp/cookies', :cookiejar => '_tmp/cookies',
82
+ :connecttimeout => 30, :maxredirs => 3)
81
83
  )
82
84
  req.on_complete do |resp|
83
85
  if retry? resp
@@ -1,4 +1,4 @@
1
1
  module Blinkr
2
- VERSION='0.3.8'
2
+ VERSION='0.3.9'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinkr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Muir
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-13 00:00:00.000000000 Z
12
+ date: 2015-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler