validate-website 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/validate_website/core.rb +2 -0
- data/lib/validate_website/option_parser.rb +4 -0
- data/lib/validate_website/validator.rb +7 -3
- data/man/man1/validate-website-static.1 +7 -2
- data/man/man1/validate-website.1 +7 -2
- data/spec/core_spec.rb +7 -0
- data/spec/validator_spec.rb +3 -3
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f9ca28a5036d0be57d7b0bdea0a22977c3d6a0f
|
4
|
+
data.tar.gz: 9add05e1e19342356734344c065fa8f727de5a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21b55b544e3db2d75598e43e7c2d41980e045b17f1ea2d9a2961770a71ee32d66f80cd3ced92ce0a36baaae33a0eccf90519f5de3cbdd972af97b496362ae8b1
|
7
|
+
data.tar.gz: 84a3117d4d7d1a125df96b779de04454858024269493ae519c6a301e8069bf90b14b9489b92a69dead1a5d4aadc39d224fd55a9d583ecff198eb04d517c73f34
|
@@ -30,6 +30,8 @@ module ValidateWebsite
|
|
30
30
|
@errors_count = 0
|
31
31
|
@options = Parser.parse(options, validation_type)
|
32
32
|
@site = @options[:site]
|
33
|
+
@service_url = @options[:'html5-validator-service-url']
|
34
|
+
Validator.html5_validator_service_url = @service_url if @service_url
|
33
35
|
puts color(:note, "validating #{@site}\n", @options[:color])
|
34
36
|
end
|
35
37
|
|
@@ -61,6 +61,8 @@ module ValidateWebsite
|
|
61
61
|
default: DEFAULT_OPTIONS_CRAWL[:not_found])
|
62
62
|
on("color", "Show colored output",
|
63
63
|
default: DEFAULT_OPTIONS_CRAWL[:color])
|
64
|
+
on("5", "html5-validator-service-url=",
|
65
|
+
"Change default html5 validator service URL")
|
64
66
|
on("v", "verbose", "Show validator errors",
|
65
67
|
default: DEFAULT_OPTIONS_CRAWL[:verbose])
|
66
68
|
end
|
@@ -86,6 +88,8 @@ module ValidateWebsite
|
|
86
88
|
default: DEFAULT_OPTIONS_STATIC[:not_found])
|
87
89
|
on("color", "Show colored output",
|
88
90
|
default: DEFAULT_OPTIONS_STATIC[:color])
|
91
|
+
on("5", "html5-validator-service-url=",
|
92
|
+
"Change default html5 validator service URL")
|
89
93
|
on("v", "verbose", "Show validator errors",
|
90
94
|
default: DEFAULT_OPTIONS_STATIC[:verbose])
|
91
95
|
end
|
@@ -6,7 +6,11 @@ module ValidateWebsite
|
|
6
6
|
# Document validation from DTD or XSD (webservice for html5)
|
7
7
|
class Validator
|
8
8
|
XHTML_PATH = File.expand_path('../../../data/schemas', __FILE__)
|
9
|
-
|
9
|
+
|
10
|
+
@html5_validator_service_url = 'http://validator.w3.org/nu/'
|
11
|
+
class << self
|
12
|
+
attr_accessor :html5_validator_service_url
|
13
|
+
end
|
10
14
|
|
11
15
|
attr_reader :original_doc, :body, :dtd, :doc, :namespace, :xsd, :errors
|
12
16
|
|
@@ -89,9 +93,9 @@ module ValidateWebsite
|
|
89
93
|
def html5_validate(document)
|
90
94
|
require 'net/http'
|
91
95
|
require 'multipart_body'
|
92
|
-
url = URI.parse(
|
96
|
+
url = URI.parse(self.class.html5_validator_service_url)
|
93
97
|
multipart = MultipartBody.new(content: document)
|
94
|
-
http = Net::HTTP.new(url.host)
|
98
|
+
http = Net::HTTP.new(url.host, url.port)
|
95
99
|
headers = {
|
96
100
|
'Content-Type' => "multipart/form-data; boundary=#{multipart.boundary}",
|
97
101
|
'Content-Length' => multipart.to_s.bytesize.to_s,
|
@@ -2,12 +2,12 @@
|
|
2
2
|
.\" Title: validate-website-static
|
3
3
|
.\" Author: [see the "AUTHOR" section]
|
4
4
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
5
|
-
.\" Date:
|
5
|
+
.\" Date: 05/17/2015
|
6
6
|
.\" Manual: \ \&
|
7
7
|
.\" Source: \ \&
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "VALIDATE\-WEBSITE\-S" "1" "
|
10
|
+
.TH "VALIDATE\-WEBSITE\-S" "1" "05/17/2015" "\ \&" "\ \&"
|
11
11
|
.\" -----------------------------------------------------------------
|
12
12
|
.\" * Define some portability stuff
|
13
13
|
.\" -----------------------------------------------------------------
|
@@ -69,6 +69,11 @@ Log files not on filesystem, pwd considered as root \(Fo / \(Fc (Default: false)
|
|
69
69
|
Show colored output (Default: true)
|
70
70
|
.RE
|
71
71
|
.PP
|
72
|
+
\fB\-5\fR, \fB\-\-html5\-validator\-service\-url\fR \fIURL\fR
|
73
|
+
.RS 4
|
74
|
+
Change default html5 validator service URL
|
75
|
+
.RE
|
76
|
+
.PP
|
72
77
|
\fB\-v\fR, \fB\-\-verbose\fR
|
73
78
|
.RS 4
|
74
79
|
Show detail of validator errors (Default: false)\&.
|
data/man/man1/validate-website.1
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
.\" Title: validate-website
|
3
3
|
.\" Author: [see the "AUTHOR" section]
|
4
4
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
5
|
-
.\" Date:
|
5
|
+
.\" Date: 05/17/2015
|
6
6
|
.\" Manual: \ \&
|
7
7
|
.\" Source: \ \&
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "VALIDATE\-WEBSITE" "1" "
|
10
|
+
.TH "VALIDATE\-WEBSITE" "1" "05/17/2015" "\ \&" "\ \&"
|
11
11
|
.\" -----------------------------------------------------------------
|
12
12
|
.\" * Define some portability stuff
|
13
13
|
.\" -----------------------------------------------------------------
|
@@ -80,6 +80,11 @@ Log not found url (Default: false)
|
|
80
80
|
Show colored output (Default: true)
|
81
81
|
.RE
|
82
82
|
.PP
|
83
|
+
\fB\-5\fR, \fB\-\-html5\-validator\-service\-url\fR \fIURL\fR
|
84
|
+
.RS 4
|
85
|
+
Change default html5 validator service URL
|
86
|
+
.RE
|
87
|
+
.PP
|
83
88
|
\fB\-v\fR, \fB\-\-verbose\fR
|
84
89
|
.RS 4
|
85
90
|
Show detail of validator errors (Default: false)\&.
|
data/spec/core_spec.rb
CHANGED
@@ -26,6 +26,13 @@ describe ValidateWebsite::Core do
|
|
26
26
|
v.crawl
|
27
27
|
v.crawler.user_agent.must_equal ua
|
28
28
|
end
|
29
|
+
|
30
|
+
it 'can change html5 validator service url' do
|
31
|
+
s = 'http://localhost:8888/'
|
32
|
+
ValidateWebsite::Core.new({ site: SPEC_DOMAIN,
|
33
|
+
:'html5-validator-service-url' => s })
|
34
|
+
ValidateWebsite::Validator.html5_validator_service_url.must_equal s
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
38
|
describe('cookies') do
|
data/spec/validator_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe ValidateWebsite::Validator do
|
|
28
28
|
describe('when valid') do
|
29
29
|
before do
|
30
30
|
validator_res = File.join('spec', 'data', 'validator.nu-success.html')
|
31
|
-
stub_request(:any, ValidateWebsite::Validator
|
31
|
+
stub_request(:any, ValidateWebsite::Validator.html5_validator_service_url)
|
32
32
|
.to_return(body: open(validator_res).read)
|
33
33
|
end
|
34
34
|
it "html5 should be valid" do
|
@@ -57,7 +57,7 @@ describe ValidateWebsite::Validator do
|
|
57
57
|
describe('when not valid') do
|
58
58
|
before do
|
59
59
|
validator_res = File.join('spec', 'data', 'validator.nu-failure.html')
|
60
|
-
stub_request(:any, ValidateWebsite::Validator
|
60
|
+
stub_request(:any, ValidateWebsite::Validator.html5_validator_service_url)
|
61
61
|
.to_return(body: open(validator_res).read)
|
62
62
|
name = 'html5'
|
63
63
|
file = File.join('spec', 'data', "#{name}-linuxfr.html")
|
@@ -87,7 +87,7 @@ describe ValidateWebsite::Validator do
|
|
87
87
|
describe('excessive') do
|
88
88
|
before do
|
89
89
|
validator_res = File.join('spec', 'data', 'validator.nu-excessive.html')
|
90
|
-
stub_request(:any, ValidateWebsite::Validator
|
90
|
+
stub_request(:any, ValidateWebsite::Validator.html5_validator_service_url)
|
91
91
|
.to_return(body: open(validator_res).read)
|
92
92
|
end
|
93
93
|
it "html5 should have errors" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spidr
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: multipart_body
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,3 +277,4 @@ summary: Web crawler for checking the validity of your documents
|
|
277
277
|
test_files:
|
278
278
|
- spec/core_spec.rb
|
279
279
|
- spec/validator_spec.rb
|
280
|
+
has_rdoc:
|