validate-website 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +8 -0
- data/README.md +14 -2
- data/Rakefile +3 -1
- data/bin/validate-website +0 -1
- data/bin/validate-website-static +0 -1
- data/lib/validate_website/option_parser.rb +54 -54
- data/lib/validate_website/static.rb +9 -9
- data/lib/validate_website/validator.rb +2 -2
- data/lib/validate_website/version.rb +1 -1
- data/test/core_test.rb +1 -1
- data/test/crawler_test.rb +1 -1
- data/test/static_test.rb +1 -1
- data/test/test_helper.rb +9 -1
- data/test/validator_test.rb +1 -1
- metadata +43 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd3346ce5ce02dd898df5bb28912dcf4c0d682278bdc4e6e2e7b05b4bdf8ef8
|
4
|
+
data.tar.gz: 7e10dd580a2da57dec3f648a57cd633fbbd6251493a064a2b4077b7fd910a9dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa59986d8a2e40840807c6e43c58cc89fdb359e81cef7c3eb8b307bd08aa4b51c8168f26ea72de9783d1963cb0861e910780eb7e7d138f3f409d2505ee29d010
|
7
|
+
data.tar.gz: 0f73aae18879b13d7bbadc24a97cca5ca7178498eb060930b81c0059605c129cb25b27c6277b1724f7f364a125cccb8fdcc4ef03a69ee86fa588fd1bdf6d6edb
|
data/History.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
|
2
|
+
1.9.0 / 2018-12-25
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Update deps paint; slop; webmock
|
6
|
+
* Remove Ruby 2.1 support
|
7
|
+
* Force nonet and disable substitute entities on xhtml parse
|
8
|
+
* Use coveralls for code coverage
|
9
|
+
|
2
10
|
v1.8.1 / 2018-03-25
|
3
11
|
===================
|
4
12
|
|
data/README.md
CHANGED
@@ -11,9 +11,12 @@ Web crawler for checking the validity of your documents
|
|
11
11
|
### Debian
|
12
12
|
|
13
13
|
~~~ console
|
14
|
-
apt install ruby-dev
|
14
|
+
apt install ruby-dev libxslt1-dev libxml2-dev
|
15
15
|
~~~
|
16
16
|
|
17
|
+
If you want complete local validation look [tidy
|
18
|
+
packages](https://binaries.html-tidy.org/)
|
19
|
+
|
17
20
|
### RubyGems
|
18
21
|
|
19
22
|
~~~ console
|
@@ -27,6 +30,15 @@ validate-website [OPTIONS]
|
|
27
30
|
validate-website-static [OPTIONS]
|
28
31
|
~~~
|
29
32
|
|
33
|
+
## Examples
|
34
|
+
|
35
|
+
~~~ console
|
36
|
+
validate-website -v -s https://www.ruby-lang.org/
|
37
|
+
validate-website -v -x tidy -s https://www.ruby-lang.org/
|
38
|
+
validate-website -v -x nu -s https://www.ruby-lang.org/
|
39
|
+
validate-website -h
|
40
|
+
~~~
|
41
|
+
|
30
42
|
## Description
|
31
43
|
|
32
44
|
validate-website is a web crawler for checking the markup validity with XML
|
@@ -139,5 +151,5 @@ Copyright (c) 2009-2018 Laurent Arnoud <laurent@spkdev.net>
|
|
139
151
|
[![Version](https://img.shields.io/gem/v/validate-website.svg)](https://rubygems.org/gems/validate-website)
|
140
152
|
[![Documentation](https://img.shields.io/badge/doc-rubydoc-blue.svg)](http://www.rubydoc.info/gems/validate-website)
|
141
153
|
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT "MIT")
|
142
|
-
[![
|
154
|
+
[![Coverage Status](https://img.shields.io/coveralls/github/spk/validate-website.svg)](https://coveralls.io/github/spk/validate-website?branch=master)
|
143
155
|
[![Inline docs](https://inch-ci.org/github/spk/validate-website.svg?branch=master)](http://inch-ci.org/github/spk/validate-website)
|
data/Rakefile
CHANGED
@@ -2,7 +2,9 @@ require 'rake/testtask'
|
|
2
2
|
require 'rubocop/rake_task'
|
3
3
|
require 'asciidoctor'
|
4
4
|
|
5
|
-
|
5
|
+
default = %i[test]
|
6
|
+
default << :rubocop unless RUBY_ENGINE == 'rbx'
|
7
|
+
task default: default
|
6
8
|
|
7
9
|
desc 'Update manpage from asciidoc file'
|
8
10
|
task :manpage do
|
data/bin/validate-website
CHANGED
data/bin/validate-website-static
CHANGED
@@ -38,57 +38,57 @@ module ValidateWebsite
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.default_args
|
41
|
-
Slop.parse do |
|
42
|
-
yield
|
43
|
-
markup_syntax(
|
44
|
-
boolean_options(
|
45
|
-
ignore_html5_options(
|
46
|
-
verbose_option(
|
47
|
-
version_help(
|
41
|
+
Slop.parse do |opt|
|
42
|
+
yield opt if block_given?
|
43
|
+
markup_syntax(opt)
|
44
|
+
boolean_options(opt)
|
45
|
+
ignore_html5_options(opt)
|
46
|
+
verbose_option(opt)
|
47
|
+
version_help(opt)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.ignore_html5_options(
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
def self.ignore_html5_options(opt)
|
52
|
+
opt.regexp('-i', '--ignore',
|
53
|
+
'Validation errors to ignore (ex: "valign|autocorrect")')
|
54
|
+
opt.string('-x', '--html5-validator',
|
55
|
+
'Change default html5 validator engine (ex: tidy or nu)',
|
56
|
+
default: DEFAULT_OPTIONS[:html5_validator])
|
57
|
+
opt.string('-5', '--html5-validator-service-url',
|
58
|
+
'Change default html5 validator service URL for "nu" engine')
|
59
59
|
end
|
60
60
|
|
61
|
-
def self.markup_syntax(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
def self.markup_syntax(opt)
|
62
|
+
opt.bool('-m', '--markup',
|
63
|
+
"Markup validation (default: #{DEFAULT_OPTIONS[:markup]})",
|
64
|
+
default: DEFAULT_OPTIONS[:markup])
|
65
|
+
opt.bool('--css-syntax',
|
66
|
+
"Css validation (default: #{DEFAULT_OPTIONS[:css_syntax]})",
|
67
|
+
default: DEFAULT_OPTIONS[:css_syntax])
|
68
68
|
end
|
69
69
|
|
70
|
-
def self.boolean_options(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
def self.boolean_options(opt)
|
71
|
+
opt.bool('-n', '--not-found',
|
72
|
+
"Log not found url (default: #{DEFAULT_OPTIONS[:not_found]})",
|
73
|
+
default: DEFAULT_OPTIONS[:not_found])
|
74
|
+
opt.bool('--color',
|
75
|
+
"Show colored output (default: #{DEFAULT_OPTIONS[:color]})",
|
76
|
+
default: DEFAULT_OPTIONS[:color])
|
77
77
|
end
|
78
78
|
|
79
|
-
def self.verbose_option(
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
def self.verbose_option(opt)
|
80
|
+
opt.bool('-v', '--verbose',
|
81
|
+
"Show validator errors (default: #{DEFAULT_OPTIONS[:verbose]})",
|
82
|
+
default: DEFAULT_OPTIONS[:verbose])
|
83
83
|
end
|
84
84
|
|
85
|
-
def self.version_help(
|
86
|
-
|
85
|
+
def self.version_help(opt)
|
86
|
+
opt.on('--version', 'Display version.') do
|
87
87
|
puts ValidateWebsite::VERSION
|
88
88
|
exit
|
89
89
|
end
|
90
|
-
|
91
|
-
puts
|
90
|
+
opt.on('-h', '--help', 'Display this help message.') do
|
91
|
+
puts opt
|
92
92
|
exit
|
93
93
|
end
|
94
94
|
end
|
@@ -97,15 +97,15 @@ module ValidateWebsite
|
|
97
97
|
# @params [ARGV]
|
98
98
|
# @return [Hash]
|
99
99
|
def self.command_line_parse_crawl(_args)
|
100
|
-
default_args do |
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
100
|
+
default_args do |opt|
|
101
|
+
opt.string('-s', '--site',
|
102
|
+
"Website to crawl (default: #{DEFAULT_OPTIONS[:site]})",
|
103
|
+
default: DEFAULT_OPTIONS[:site])
|
104
|
+
opt.string('-u', '--user-agent',
|
105
|
+
'Change user agent',
|
106
|
+
default: DEFAULT_OPTIONS[:user_agent])
|
107
|
+
opt.regexp('-e', '--exclude', 'Url to exclude (ex: "redirect|news")')
|
108
|
+
opt.string('-c', '--cookies', 'Set defaults cookies')
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -113,14 +113,14 @@ module ValidateWebsite
|
|
113
113
|
# @params [ARGV]
|
114
114
|
# @return [Hash]
|
115
115
|
def self.command_line_parse_static(_args)
|
116
|
-
default_args do |
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
116
|
+
default_args do |opt|
|
117
|
+
opt.string('-s', '--site',
|
118
|
+
"Website to crawl (default: #{DEFAULT_OPTIONS[:site]})",
|
119
|
+
default: DEFAULT_OPTIONS[:site])
|
120
|
+
opt.string('-p', '--pattern',
|
121
|
+
"Filename pattern (default: #{DEFAULT_OPTIONS[:pattern]})",
|
122
|
+
default: DEFAULT_OPTIONS[:pattern])
|
123
|
+
opt.regexp('-e', '--exclude', 'Url to exclude (ex: "redirect|news")')
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
@@ -20,11 +20,11 @@ module ValidateWebsite
|
|
20
20
|
@site = @options[:site]
|
21
21
|
|
22
22
|
files = Dir.glob(@options[:pattern])
|
23
|
-
files.each do |
|
24
|
-
next unless File.file?(
|
25
|
-
next if @options[:exclude]
|
23
|
+
files.each do |file|
|
24
|
+
next unless File.file?(file)
|
25
|
+
next if @options[:exclude] && @options[:exclude].match(file)
|
26
26
|
@history_count += 1
|
27
|
-
check_static_file(
|
27
|
+
check_static_file(file)
|
28
28
|
end
|
29
29
|
print_status_line(files.size, 0, @not_founds_count, @errors_count)
|
30
30
|
end
|
@@ -47,15 +47,15 @@ module ValidateWebsite
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
-
def check_static_file(
|
51
|
-
page = StaticLink.new(
|
52
|
-
check_page(
|
50
|
+
def check_static_file(file)
|
51
|
+
page = StaticLink.new(file, @site).page
|
52
|
+
check_page(file, page)
|
53
53
|
check_css_syntax(page) if page.css? && options[:css_syntax]
|
54
54
|
end
|
55
55
|
|
56
|
-
def check_page(
|
56
|
+
def check_page(file, page)
|
57
57
|
if page.html? && options[:markup]
|
58
|
-
validate(page.doc, page.body,
|
58
|
+
validate(page.doc, page.body, file, options[:ignore])
|
59
59
|
end
|
60
60
|
check_static_not_found(page.links) if options[:not_found]
|
61
61
|
end
|
@@ -15,7 +15,7 @@ module ValidateWebsite
|
|
15
15
|
attr_accessor :html5_validator_service_url
|
16
16
|
end
|
17
17
|
|
18
|
-
XHTML_PATH = File.expand_path('
|
18
|
+
XHTML_PATH = File.expand_path('../../data/schemas', __dir__)
|
19
19
|
|
20
20
|
@xsd_schemas ||= {}
|
21
21
|
|
@@ -139,7 +139,7 @@ module ValidateWebsite
|
|
139
139
|
|
140
140
|
def xhtml_doc
|
141
141
|
Dir.chdir(XHTML_PATH) do
|
142
|
-
Nokogiri::XML(document) { |cfg| cfg.
|
142
|
+
Nokogiri::XML(document) { |cfg| cfg.nonoent.dtdload.dtdvalid.nonet }
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
data/test/core_test.rb
CHANGED
data/test/crawler_test.rb
CHANGED
data/test/static_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
6
|
+
rescue LoadError
|
7
|
+
STDERR.puts 'coveralls not loaded'
|
8
|
+
end
|
9
|
+
|
3
10
|
require 'minitest/autorun'
|
11
|
+
require 'minitest/focus'
|
4
12
|
require 'spidr'
|
5
13
|
|
6
14
|
require 'validate_website/core'
|
7
15
|
|
8
|
-
require File.expand_path('
|
16
|
+
require File.expand_path('webmock_helper', __dir__)
|
9
17
|
|
10
18
|
TEST_DOMAIN = 'http://www.example.com/'.freeze
|
11
19
|
ENV['LC_ALL'] = 'C.UTF-8' if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
data/test/validator_test.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: crass
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: paint
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2'
|
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: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: slop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.6'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: spidr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0.6'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tidy_ffi
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,33 +81,33 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: w3c_validators
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.3'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: asciidoctor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.5'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1.5'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,47 +123,61 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '5'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: minitest-focus
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '1'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '12'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '12'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rubocop
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
159
|
+
version: 0.58.0
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
166
|
+
version: 0.58.0
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
168
|
+
name: webmock
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
173
|
+
version: '3.4'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
180
|
+
version: '3.4'
|
167
181
|
description: validate-website is a web crawler for checking the markup validity with
|
168
182
|
XML Schema / DTD and not found urls.
|
169
183
|
email: laurent@spkdev.net
|
@@ -259,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
273
|
requirements:
|
260
274
|
- - ">="
|
261
275
|
- !ruby/object:Gem::Version
|
262
|
-
version: 2.
|
276
|
+
version: 2.2.0
|
263
277
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
278
|
requirements:
|
265
279
|
- - ">="
|