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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4dbe8f5a7a4fff1b83b982a23ccf67918e06723
4
- data.tar.gz: b7bf3908fd7ae4d1ede2362161589b9428632e73
3
+ metadata.gz: 2fab4f67e2f1341e0656b48eb217dfaa61a22ccb
4
+ data.tar.gz: f36945fd0211036d946318bb7bd36723ff176e49
5
5
  SHA512:
6
- metadata.gz: a44be80ecbcc4da84f1f86ad809f7ef8467c1e9d06ca6911d203b71b7abb758c68a43776f84af3743ebc70dd05c1e97540c155e1d9d902f23e5ee8e2f9079bcf
7
- data.tar.gz: 37b1fb6c80178ee3d9c98cb4abec0d7b2a9ab4a90e9f2960cd0c3a02e2a4840b97699c5881069300e40a1626e396f85edf7106ae420f4349fe0a922598166149
6
+ metadata.gz: ec86f6394169530bb09a5e7870191a3db67e8e7548cd60e0ccd141166fdf2bd4f2288f4b93d9d14bd96e35085044d2b6a7b3aebb922efc2a88072370981abd6d
7
+ data.tar.gz: 78aea8f25c20ecaba88a7025d3325a904cd404ec4096812107b6c82b221ff2bb59f49c16f4929c398049f08b63eb8bd4fe7b0a8da1076e848a800249ef90cd9a
data/.travis.yml CHANGED
@@ -1,4 +1,3 @@
1
1
  rvm:
2
- - 2.0.0
3
2
  - 1.9.3
4
- - 1.9.2
3
+ - 2.1.2
data/README.md CHANGED
@@ -52,7 +52,7 @@ More info about the `user-agent` option on the W3C Validator can be found [here]
52
52
 
53
53
  ##Notes:
54
54
 
55
- This gem requires Ruby 1.9, and has been tested on Ruby 1.9.2, 1.9.3 and 2.0.
55
+ This gem is tested on Ruby 1.9.3 and 2.1.2.
56
56
 
57
57
  ##License:
58
58
 
@@ -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
@@ -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' => ENV['W3C_MARKUP_VALIDATOR_USER_AGENT'] || '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')
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
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module SiteValidator
4
- VERSION = "1.5.0"
4
+ VERSION = "1.6.0"
5
5
  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.5.0
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-06-29 00:00:00.000000000 Z
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
@@ -1,4 +0,0 @@
1
- require_relative 'site_validator'
2
-
3
- page = SiteValidator::Page.new('http://proofs13.issl.co.uk/')
4
- puts page.errors.size