site_validator 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/README.md +1 -1
- data/lib/site_validator.rb +5 -0
- data/lib/site_validator/page.rb +1 -1
- data/lib/site_validator/sitemap.rb +2 -2
- data/lib/site_validator/version.rb +1 -1
- metadata +2 -3
- data/lib/test.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fab4f67e2f1341e0656b48eb217dfaa61a22ccb
|
4
|
+
data.tar.gz: f36945fd0211036d946318bb7bd36723ff176e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec86f6394169530bb09a5e7870191a3db67e8e7548cd60e0ccd141166fdf2bd4f2288f4b93d9d14bd96e35085044d2b6a7b3aebb922efc2a88072370981abd6d
|
7
|
+
data.tar.gz: 78aea8f25c20ecaba88a7025d3325a904cd404ec4096812107b6c82b221ff2bb59f49c16f4929c398049f08b63eb8bd4fe7b0a8da1076e848a800249ef90cd9a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/site_validator.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
require_relative 'site_validator/version'
|
3
4
|
require_relative 'site_validator/validator'
|
4
5
|
require_relative 'site_validator/sitemap'
|
5
6
|
require_relative 'site_validator/page'
|
6
7
|
require_relative 'site_validator/message'
|
7
8
|
require_relative 'site_validator/reporter'
|
9
|
+
|
10
|
+
module SiteValidator
|
11
|
+
USER_AGENT = ENV['W3C_MARKUP_VALIDATOR_USER_AGENT'] || "SiteValidator/#{SiteValidator::VERSION} Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"
|
12
|
+
end
|
data/lib/site_validator/page.rb
CHANGED
@@ -75,7 +75,7 @@ module SiteValidator
|
|
75
75
|
# Returns an instance of MarkupValidator, with the URL set to the one in ENV or its default
|
76
76
|
def markup_validator
|
77
77
|
@markup_validator ||= MarkupValidator.new(:validator_uri => ENV['W3C_MARKUP_VALIDATOR_URI'] || 'http://validator.w3.org/check',
|
78
|
-
'user-agent' =>
|
78
|
+
'user-agent' => SiteValidator::USER_AGENT)
|
79
79
|
end
|
80
80
|
|
81
81
|
##
|
@@ -54,7 +54,7 @@ module SiteValidator
|
|
54
54
|
pages = xml_locations.select {|loc| looks_like_html?(loc.text.strip)}.map {|loc| SiteValidator::Page.new(loc.text.strip)}
|
55
55
|
|
56
56
|
if pages.empty?
|
57
|
-
m = MetaInspector.new(url, :timeout => 20, :allow_redirections => :all)
|
57
|
+
m = MetaInspector.new(url, :timeout => 20, :allow_redirections => :all, :headers => {'User-Agent' => SiteValidator::USER_AGENT})
|
58
58
|
links = [m.url]
|
59
59
|
|
60
60
|
m.internal_links.select {|l| looks_like_html?(l)}.map {|l| l.split('#')[0]}.uniq.each do |link|
|
@@ -87,7 +87,7 @@ module SiteValidator
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def doc
|
90
|
-
@doc ||= open(url, :allow_redirections => :all)
|
90
|
+
@doc ||= open(url, "User-Agent" => SiteValidator::USER_AGENT, :allow_redirections => :all)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: w3c_validators
|
@@ -134,7 +134,6 @@ files:
|
|
134
134
|
- lib/site_validator/templates/site_validator.html.erb
|
135
135
|
- lib/site_validator/validator.rb
|
136
136
|
- lib/site_validator/version.rb
|
137
|
-
- lib/test.rb
|
138
137
|
- site_validator.gemspec
|
139
138
|
- spec/message_spec.rb
|
140
139
|
- spec/mocks/mocked_validator.rb
|
data/lib/test.rb
DELETED