validate-website 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/validate_website/colorful_messages.rb +7 -6
- data/lib/validate_website/core.rb +21 -31
- data/lib/validate_website/option_parser.rb +1 -0
- data/lib/validate_website/runner.rb +1 -0
- data/lib/validate_website/validator.rb +55 -49
- data/spec/core_spec.rb +13 -2
- data/spec/spec_helper.rb +2 -1
- data/spec/validator_spec.rb +9 -10
- data/spec/webmock_helper.rb +39 -0
- metadata +146 -133
- data/spec/fakeweb_helper.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bc9f712917bac09c34c75884e21dd9a42ab58ec
|
4
|
+
data.tar.gz: 68c9ef71f67dc387f390e0dc9fa15fac4d29d574
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17645be7cbabe26aec3fcf3e74dc968dd68d1240d6f11b18d1d4cfa772f4324b8221cdad6944318ba2fbc1a8437360ddd22b0aaf792a57db2251eb2f5dbd142b
|
7
|
+
data.tar.gz: 3d8f7f4f3fceb350b3a46c2ed523ff3278ea29be2999cacd21869919aec358a1f7320ada9953b06a2afd2e91dc1bb729f6c98a921f30229dfbd36de18c9c970d
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'paint'
|
3
3
|
|
4
4
|
module ValidateWebsite
|
5
|
+
# Internal helper for colorful messages
|
5
6
|
module ColorfulMessages
|
6
7
|
def color(type, message, colored=true)
|
7
8
|
return message unless colored
|
@@ -9,25 +10,25 @@ module ValidateWebsite
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def error(message)
|
12
|
-
message
|
13
|
+
Paint[message, :red]
|
13
14
|
end
|
14
15
|
|
15
16
|
def warning(message)
|
16
|
-
message
|
17
|
+
Paint[message, :yellow]
|
17
18
|
end
|
18
19
|
|
19
20
|
def success(message)
|
20
|
-
message
|
21
|
+
Paint[message, :green]
|
21
22
|
end
|
22
23
|
|
23
24
|
alias_method :message, :success
|
24
25
|
|
25
26
|
def note(message)
|
26
|
-
message
|
27
|
+
Paint[message, :magenta]
|
27
28
|
end
|
28
29
|
|
29
30
|
def info(message)
|
30
|
-
message
|
31
|
+
Paint[message, :blue]
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -10,6 +10,7 @@ require 'anemone'
|
|
10
10
|
|
11
11
|
module ValidateWebsite
|
12
12
|
|
13
|
+
# Core class for static or website validation
|
13
14
|
class Core
|
14
15
|
|
15
16
|
attr_accessor :site
|
@@ -51,7 +52,6 @@ module ValidateWebsite
|
|
51
52
|
def crawl(opts={})
|
52
53
|
opts = @options.merge(opts)
|
53
54
|
puts color(:note, "validating #{@site}", opts[:color]) unless opts[:quiet]
|
54
|
-
|
55
55
|
puts color(:warning, "No internet connection") unless internet_connection?
|
56
56
|
|
57
57
|
@anemone = Anemone.crawl(@site, opts) do |anemone|
|
@@ -59,25 +59,13 @@ module ValidateWebsite
|
|
59
59
|
|
60
60
|
# select the links on each page to follow (iframe, link, css url)
|
61
61
|
anemone.focus_crawl { |page|
|
62
|
-
links
|
63
|
-
if page.html?
|
64
|
-
links.concat extract_urls_from_img_script_iframe_link(page)
|
65
|
-
end
|
66
|
-
if page.content_type == 'text/css'
|
67
|
-
links.concat extract_urls_from_css(page)
|
68
|
-
end
|
69
|
-
links.uniq!
|
70
|
-
page.links.concat(links)
|
62
|
+
page.links.concat(extract_urls(page))
|
71
63
|
}
|
72
64
|
|
73
65
|
anemone.on_every_page { |page|
|
74
66
|
url = page.url.to_s
|
75
|
-
|
76
|
-
|
77
|
-
# validate html/html+xml
|
78
|
-
if page.html? && page.fetched?
|
79
|
-
validate(page.doc, page.body, url, opts)
|
80
|
-
end
|
67
|
+
if opts[:markup_validation] && page.html? && page.fetched?
|
68
|
+
validate(page.doc, page.body, url, opts)
|
81
69
|
end
|
82
70
|
|
83
71
|
if opts[:not_found] && page.not_found?
|
@@ -85,19 +73,14 @@ module ValidateWebsite
|
|
85
73
|
puts color(:error, "%s linked in %s but not exist" % [url, page.referer], opts[:color])
|
86
74
|
to_file(url)
|
87
75
|
end
|
88
|
-
|
89
|
-
# throw away the page (hope this saves memory)
|
90
|
-
page = nil
|
91
76
|
}
|
92
77
|
end
|
93
78
|
end
|
94
79
|
|
95
80
|
def internet_connection?
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
false
|
100
|
-
end
|
81
|
+
true if open(ValidateWebsite::Core::PING_URL)
|
82
|
+
rescue
|
83
|
+
false
|
101
84
|
end
|
102
85
|
|
103
86
|
|
@@ -178,13 +161,13 @@ module ValidateWebsite
|
|
178
161
|
# @return [Array] Lists of urls
|
179
162
|
#
|
180
163
|
def extract_urls_from_img_script_iframe_link(page)
|
181
|
-
links =
|
182
|
-
page.doc.css('img, script, iframe').each do |elem|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
164
|
+
links = Set.new
|
165
|
+
page.doc.css('img, script, iframe, link').each do |elem|
|
166
|
+
if elem.name == 'link'
|
167
|
+
url = get_url(page, elem, "href")
|
168
|
+
else
|
169
|
+
url = get_url(page, elem, "src")
|
170
|
+
end
|
188
171
|
links << url unless url.nil? || url.to_s.empty?
|
189
172
|
end
|
190
173
|
links
|
@@ -203,6 +186,13 @@ module ValidateWebsite
|
|
203
186
|
end
|
204
187
|
end
|
205
188
|
|
189
|
+
def extract_urls(page)
|
190
|
+
links = Set.new
|
191
|
+
links.merge extract_urls_from_img_script_iframe_link(page) if page.html?
|
192
|
+
links.merge extract_urls_from_css(page) if page.content_type == 'text/css'
|
193
|
+
links.to_a
|
194
|
+
end
|
195
|
+
|
206
196
|
##
|
207
197
|
# @param [Nokogiri::HTML::Document] original_doc
|
208
198
|
# @param [String] The raw HTTP response body of the page
|
@@ -3,8 +3,10 @@ require 'uri'
|
|
3
3
|
require 'nokogiri'
|
4
4
|
|
5
5
|
module ValidateWebsite
|
6
|
+
# Document validation from DTD or XSD (webservice for html5)
|
6
7
|
class Validator
|
7
8
|
XHTML_PATH = File.join(File.dirname(__FILE__), '..', '..', 'data', 'schemas')
|
9
|
+
HTML5_VALIDATOR_SERVICE = 'http://html5.validator.nu/'
|
8
10
|
|
9
11
|
attr_reader :original_doc, :body, :dtd, :doc, :namespace, :xsd, :errors
|
10
12
|
|
@@ -17,55 +19,7 @@ module ValidateWebsite
|
|
17
19
|
@options = opts
|
18
20
|
@dtd = @original_doc.internal_subset
|
19
21
|
init_namespace(@dtd)
|
20
|
-
|
21
|
-
|
22
|
-
if @errors.empty?
|
23
|
-
if @dtd_uri && @body.match(@dtd_uri.to_s)
|
24
|
-
document = @body.sub(@dtd_uri.to_s, @namespace + '.dtd')
|
25
|
-
else
|
26
|
-
document = @body
|
27
|
-
end
|
28
|
-
@doc = Dir.chdir(XHTML_PATH) do
|
29
|
-
Nokogiri::XML(document) { |cfg|
|
30
|
-
cfg.noent.dtdload.dtdvalid
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
# http://www.w3.org/TR/xhtml1-schema/
|
35
|
-
@xsd = Dir.chdir(XHTML_PATH) do
|
36
|
-
if @namespace && File.exists?(@namespace + '.xsd')
|
37
|
-
Nokogiri::XML::Schema(File.read(@namespace + '.xsd'))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
if @xsd
|
42
|
-
# have the xsd so use it
|
43
|
-
@errors = @xsd.validate(@doc)
|
44
|
-
elsif document =~ /^\<!DOCTYPE html\>/i
|
45
|
-
# TODO: use a local Java, Python parser... write a Ruby HTML5 parser ?
|
46
|
-
require 'net/http'
|
47
|
-
require 'multipart_body'
|
48
|
-
url = URI.parse('http://html5.validator.nu/')
|
49
|
-
multipart = MultipartBody.new(:content => document)
|
50
|
-
http = Net::HTTP.new(url.host)
|
51
|
-
headers = {
|
52
|
-
'Content-Type' => "multipart/form-data; boundary=#{multipart.boundary}",
|
53
|
-
'Content-Length' => multipart.to_s.bytesize.to_s,
|
54
|
-
}
|
55
|
-
res = http.start {|con| con.post(url.path, multipart.to_s, headers) }
|
56
|
-
@errors = Nokogiri::XML.parse(res.body).css('ol li.error').map(&:content)
|
57
|
-
else
|
58
|
-
# dont have xsd fall back to dtd
|
59
|
-
@doc = Dir.chdir(XHTML_PATH) do
|
60
|
-
Nokogiri::HTML.parse(document)
|
61
|
-
end
|
62
|
-
@errors = @doc.errors
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
rescue Nokogiri::XML::SyntaxError => e
|
67
|
-
# http://nokogiri.org/tutorials/ensuring_well_formed_markup.html
|
68
|
-
@errors << e
|
22
|
+
find_errors
|
69
23
|
end
|
70
24
|
|
71
25
|
##
|
@@ -94,5 +48,57 @@ module ValidateWebsite
|
|
94
48
|
end
|
95
49
|
end
|
96
50
|
end
|
51
|
+
|
52
|
+
def find_errors
|
53
|
+
@errors = []
|
54
|
+
if @dtd_uri && @body.match(@dtd_uri.to_s)
|
55
|
+
document = @body.sub(@dtd_uri.to_s, @namespace + '.dtd')
|
56
|
+
else
|
57
|
+
document = @body
|
58
|
+
end
|
59
|
+
|
60
|
+
@doc = Dir.chdir(XHTML_PATH) do
|
61
|
+
Nokogiri::XML(document) { |cfg|
|
62
|
+
cfg.noent.dtdload.dtdvalid
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# http://www.w3.org/TR/xhtml1-schema/
|
67
|
+
@xsd = Dir.chdir(XHTML_PATH) do
|
68
|
+
if @namespace && File.exists?(@namespace + '.xsd')
|
69
|
+
Nokogiri::XML::Schema(File.read(@namespace + '.xsd'))
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if @xsd
|
74
|
+
@errors = @xsd.validate(@doc)
|
75
|
+
elsif document =~ /^\<!DOCTYPE html\>/i
|
76
|
+
html5_validate(document)
|
77
|
+
else
|
78
|
+
# dont have xsd fall back to dtd
|
79
|
+
@doc = Dir.chdir(XHTML_PATH) do
|
80
|
+
Nokogiri::HTML.parse(document)
|
81
|
+
end
|
82
|
+
@errors = @doc.errors
|
83
|
+
end
|
84
|
+
|
85
|
+
rescue Nokogiri::XML::SyntaxError => e
|
86
|
+
# http://nokogiri.org/tutorials/ensuring_well_formed_markup.html
|
87
|
+
@errors << e
|
88
|
+
end
|
89
|
+
|
90
|
+
def html5_validate(document)
|
91
|
+
require 'net/http'
|
92
|
+
require 'multipart_body'
|
93
|
+
url = URI.parse(HTML5_VALIDATOR_SERVICE)
|
94
|
+
multipart = MultipartBody.new(:content => document)
|
95
|
+
http = Net::HTTP.new(url.host)
|
96
|
+
headers = {
|
97
|
+
'Content-Type' => "multipart/form-data; boundary=#{multipart.boundary}",
|
98
|
+
'Content-Length' => multipart.to_s.bytesize.to_s,
|
99
|
+
}
|
100
|
+
res = http.start {|con| con.post(url.path, multipart.to_s, headers) }
|
101
|
+
@errors = Nokogiri::HTML(res.body).css('ol li.error').map(&:content)
|
102
|
+
end
|
97
103
|
end
|
98
104
|
end
|
data/spec/core_spec.rb
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
4
4
|
describe ValidateWebsite::Core do
|
5
5
|
|
6
6
|
before do
|
7
|
-
|
8
|
-
|
7
|
+
WebMock.reset!
|
8
|
+
stub_request(:get, ValidateWebsite::Core::PING_URL).with(:status => 200)
|
9
9
|
@validate_website = ValidateWebsite::Core.new(:color => false)
|
10
10
|
end
|
11
11
|
|
@@ -20,6 +20,17 @@ describe ValidateWebsite::Core do
|
|
20
20
|
@validate_website.crawl(:quiet => true)
|
21
21
|
@validate_website.anemone.pages.size.must_equal 5
|
22
22
|
end
|
23
|
+
|
24
|
+
it 'extract link' do
|
25
|
+
name = 'html4-strict'
|
26
|
+
file = File.join('spec', 'data', "#{name}.html")
|
27
|
+
page = FakePage.new(name,
|
28
|
+
:body => open(file).read,
|
29
|
+
:content_type => 'text/html')
|
30
|
+
@validate_website.site = page.url
|
31
|
+
@validate_website.crawl(:quiet => true)
|
32
|
+
@validate_website.anemone.pages.size.must_equal 98
|
33
|
+
end
|
23
34
|
end
|
24
35
|
|
25
36
|
describe('css') do
|
data/spec/spec_helper.rb
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
3
3
|
|
4
4
|
describe ValidateWebsite::Validator do
|
5
5
|
before do
|
6
|
-
|
6
|
+
WebMock.reset!
|
7
7
|
@http = Anemone::HTTP.new
|
8
8
|
end
|
9
9
|
|
@@ -27,8 +27,8 @@ describe ValidateWebsite::Validator do
|
|
27
27
|
describe('when valid') do
|
28
28
|
before do
|
29
29
|
validator_res = File.join('spec', 'data', 'validator.nu-success.html')
|
30
|
-
|
31
|
-
|
30
|
+
stub_request(:any, ValidateWebsite::Validator::HTML5_VALIDATOR_SERVICE)
|
31
|
+
.to_return(:body => open(validator_res).read)
|
32
32
|
end
|
33
33
|
it "html5 should be valid" do
|
34
34
|
name = 'html5'
|
@@ -54,25 +54,24 @@ describe ValidateWebsite::Validator do
|
|
54
54
|
describe('when not valid') do
|
55
55
|
before do
|
56
56
|
validator_res = File.join('spec', 'data', 'validator.nu-failure.html')
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
def html5_validator(options={})
|
57
|
+
stub_request(:any, ValidateWebsite::Validator::HTML5_VALIDATOR_SERVICE)
|
58
|
+
.to_return(:body => open(validator_res).read)
|
61
59
|
name = 'html5'
|
62
60
|
file = File.join('spec', 'data', "#{name}-linuxfr.html")
|
63
61
|
page = FakePage.new(name,
|
64
62
|
:body => open(file).read,
|
65
63
|
:content_type => 'text/html')
|
66
64
|
@html5_page = @http.fetch_page(page.url)
|
67
|
-
ValidateWebsite::Validator.new(@html5_page.doc, @html5_page.body, options)
|
68
65
|
end
|
66
|
+
|
69
67
|
it 'should have an array of errors' do
|
70
|
-
validator =
|
68
|
+
validator = ValidateWebsite::Validator.new(@html5_page.doc, @html5_page.body)
|
71
69
|
validator.valid?.must_equal false
|
72
70
|
validator.errors.size.must_equal 38
|
73
71
|
end
|
72
|
+
|
74
73
|
it 'should exclude errors ignored by :ignore_errors option' do
|
75
|
-
validator =
|
74
|
+
validator = ValidateWebsite::Validator.new(@html5_page.doc, @html5_page.body, :ignore_errors => "The nowrap attribute on the td element is obsolete")
|
76
75
|
validator.valid?.must_equal false
|
77
76
|
validator.errors.size.must_equal 36
|
78
77
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'webmock/minitest'
|
3
|
+
|
4
|
+
class FakePage
|
5
|
+
include WebMock::API
|
6
|
+
|
7
|
+
attr_accessor :links
|
8
|
+
attr_accessor :hrefs
|
9
|
+
attr_accessor :body
|
10
|
+
|
11
|
+
def initialize(name = '', options = {})
|
12
|
+
@name = name
|
13
|
+
@links = [options[:links]].flatten if options.has_key?(:links)
|
14
|
+
@hrefs = [options[:hrefs]].flatten if options.has_key?(:hrefs)
|
15
|
+
@content_type = options[:content_type] || "text/html"
|
16
|
+
@body = options[:body]
|
17
|
+
|
18
|
+
create_body unless @body
|
19
|
+
add_to_webmock
|
20
|
+
end
|
21
|
+
|
22
|
+
def url
|
23
|
+
SPEC_DOMAIN + @name
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def create_body
|
29
|
+
@body = "<html><body>"
|
30
|
+
@links.each{|l| @body += "<a href=\"#{SPEC_DOMAIN}#{l}\"></a>"} if @links
|
31
|
+
@hrefs.each{|h| @body += "<a href=\"#{h}\"></a>"} if @hrefs
|
32
|
+
@body += "</body></html>"
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_to_webmock
|
36
|
+
options = {body: @body, headers: { 'Content-Type' => @content_type }}
|
37
|
+
stub_request(:get, url).to_return(options)
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,99 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.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:
|
11
|
+
date: 2014-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anemone
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.7'
|
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: 0.
|
26
|
+
version: '0.7'
|
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: '0.8'
|
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: '0.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: multipart_body
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.2
|
47
|
+
version: '0.2'
|
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: 0.2
|
54
|
+
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '10.3'
|
62
62
|
type: :development
|
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: '10.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '5.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '5.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: '1.18'
|
90
90
|
type: :development
|
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: 1.
|
96
|
+
version: '1.18'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.9'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.9'
|
97
111
|
description: validate-website is a web crawler for checking the markup validity with
|
98
112
|
XML Schema / DTD and not found urls.
|
99
113
|
email: laurent@spkdev.net
|
@@ -103,120 +117,120 @@ executables:
|
|
103
117
|
extensions: []
|
104
118
|
extra_rdoc_files: []
|
105
119
|
files:
|
106
|
-
- Rakefile
|
107
120
|
- LICENSE
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
- spec/data/html4-strict.html
|
121
|
-
- spec/data/validator.nu-success.html
|
122
|
-
- spec/data/html5-linuxfr.html
|
123
|
-
- spec/data/validator.nu-failure.html
|
124
|
-
- spec/fakeweb_helper.rb
|
125
|
-
- spec/validator_spec.rb
|
126
|
-
- spec/example/ruby smalltalk/blockcamp-paris-le-28-novembre.html
|
127
|
-
- spec/core_spec.rb
|
128
|
-
- data/schemas/xhtml-print-1.xsd
|
129
|
-
- data/schemas/xhtml-inlstyle-1.xsd
|
130
|
-
- data/schemas/xhtml-pres-1.xsd
|
131
|
-
- data/schemas/xhtml-events-1.xsd
|
132
|
-
- data/schemas/xhtml-rdfa-1.dtd
|
133
|
-
- data/schemas/xhtml-object-1.xsd
|
134
|
-
- data/schemas/xhtml-inlpres-1.xsd
|
135
|
-
- data/schemas/xhtml-table-1.xsd
|
136
|
-
- data/schemas/xhtml-ruby-1.xsd
|
137
|
-
- data/schemas/xhtml1-transitional.xsd
|
121
|
+
- Rakefile
|
122
|
+
- bin/validate-website
|
123
|
+
- bin/validate-website-static
|
124
|
+
- data/schemas/frameset.dtd
|
125
|
+
- data/schemas/loose.dtd
|
126
|
+
- data/schemas/strict.dtd
|
127
|
+
- data/schemas/xframes-1.xsd
|
128
|
+
- data/schemas/xhtml-access-1.xsd
|
129
|
+
- data/schemas/xhtml-applet-1.xsd
|
130
|
+
- data/schemas/xhtml-attribs-1.xsd
|
131
|
+
- data/schemas/xhtml-base-1.xsd
|
132
|
+
- data/schemas/xhtml-basic-form-1.xsd
|
138
133
|
- data/schemas/xhtml-basic-table-1.xsd
|
134
|
+
- data/schemas/xhtml-basic10-model-1.xsd
|
139
135
|
- data/schemas/xhtml-basic10-module-redefines-1.xsd
|
136
|
+
- data/schemas/xhtml-basic10-modules-1.xsd
|
137
|
+
- data/schemas/xhtml-basic10.xsd
|
138
|
+
- data/schemas/xhtml-basic11-model-1.xsd
|
140
139
|
- data/schemas/xhtml-basic11-modules-1.xsd
|
141
|
-
- data/schemas/xhtml-
|
142
|
-
- data/schemas/
|
143
|
-
- data/schemas/xhtml-
|
144
|
-
- data/schemas/xhtml-
|
145
|
-
- data/schemas/
|
146
|
-
- data/schemas/xhtml-frames-1.xsd
|
147
|
-
- data/schemas/xml-script-1.xsd
|
148
|
-
- data/schemas/xhtml-base-1.xsd
|
149
|
-
- data/schemas/xhtml1-transitional.dtd
|
150
|
-
- data/schemas/xhtml1-strict.xsd
|
151
|
-
- data/schemas/xhtml2.xsd
|
152
|
-
- data/schemas/strict.dtd
|
153
|
-
- data/schemas/xhtml11-modules-1.xsd
|
154
|
-
- data/schemas/xhtml-rdfa-modules-1.xsd
|
155
|
-
- data/schemas/xhtml-param-1.xsd
|
156
|
-
- data/schemas/loose.dtd
|
157
|
-
- data/schemas/xhtml-metaAttributes-1.xsd
|
158
|
-
- data/schemas/xhtml-print-model-1.xsd
|
159
|
-
- data/schemas/xml-events-1.xsd
|
160
|
-
- data/schemas/xml-events-attribs-2.xsd
|
161
|
-
- data/schemas/xml-events-copyright-1.xsd
|
162
|
-
- data/schemas/xhtml-legacy-1.xsd
|
140
|
+
- data/schemas/xhtml-basic11.dtd
|
141
|
+
- data/schemas/xhtml-basic11.xsd
|
142
|
+
- data/schemas/xhtml-bdo-1.xsd
|
143
|
+
- data/schemas/xhtml-blkphras-1.xsd
|
144
|
+
- data/schemas/xhtml-blkpres-1.xsd
|
163
145
|
- data/schemas/xhtml-blkstruct-1.xsd
|
164
|
-
- data/schemas/
|
165
|
-
- data/schemas/xhtml-
|
166
|
-
- data/schemas/xhtml-form-1.xsd
|
146
|
+
- data/schemas/xhtml-charent-1.xsd
|
147
|
+
- data/schemas/xhtml-copyright-1.xsd
|
167
148
|
- data/schemas/xhtml-csismap-1.xsd
|
168
|
-
- data/schemas/
|
169
|
-
- data/schemas/xhtml-
|
170
|
-
- data/schemas/xhtml-
|
171
|
-
- data/schemas/xhtml-
|
172
|
-
- data/schemas/xhtml-
|
173
|
-
- data/schemas/xhtml-
|
174
|
-
- data/schemas/xml.xsd
|
175
|
-
- data/schemas/xhtml-access-1.xsd
|
176
|
-
- data/schemas/xml-events-2.xsd
|
177
|
-
- data/schemas/xml-events-attribs-1.xsd
|
149
|
+
- data/schemas/xhtml-datatypes-1.xsd
|
150
|
+
- data/schemas/xhtml-edit-1.xsd
|
151
|
+
- data/schemas/xhtml-events-1.xsd
|
152
|
+
- data/schemas/xhtml-form-1.xsd
|
153
|
+
- data/schemas/xhtml-frames-1.xsd
|
154
|
+
- data/schemas/xhtml-framework-1.xsd
|
178
155
|
- data/schemas/xhtml-hypertext-1.xsd
|
179
|
-
- data/schemas/xhtml-
|
180
|
-
- data/schemas/
|
181
|
-
- data/schemas/xhtml-
|
182
|
-
- data/schemas/
|
156
|
+
- data/schemas/xhtml-iframe-1.xsd
|
157
|
+
- data/schemas/xhtml-image-1.xsd
|
158
|
+
- data/schemas/xhtml-inlphras-1.xsd
|
159
|
+
- data/schemas/xhtml-inlpres-1.xsd
|
160
|
+
- data/schemas/xhtml-inlstruct-1.xsd
|
161
|
+
- data/schemas/xhtml-inlstyle-1.xsd
|
162
|
+
- data/schemas/xhtml-inputmode-1.xsd
|
163
|
+
- data/schemas/xhtml-lat1.ent
|
164
|
+
- data/schemas/xhtml-legacy-1.xsd
|
165
|
+
- data/schemas/xhtml-link-1.xsd
|
166
|
+
- data/schemas/xhtml-list-1.xsd
|
167
|
+
- data/schemas/xhtml-meta-1.xsd
|
168
|
+
- data/schemas/xhtml-metaAttributes-1.xsd
|
183
169
|
- data/schemas/xhtml-misc-1.xsd
|
184
|
-
- data/schemas/xhtml-
|
185
|
-
- data/schemas/xhtml-
|
186
|
-
- data/schemas/
|
187
|
-
- data/schemas/xhtml-
|
170
|
+
- data/schemas/xhtml-nameident-1.xsd
|
171
|
+
- data/schemas/xhtml-notations-1.xsd
|
172
|
+
- data/schemas/xhtml-object-1.xsd
|
173
|
+
- data/schemas/xhtml-param-1.xsd
|
174
|
+
- data/schemas/xhtml-pres-1.xsd
|
175
|
+
- data/schemas/xhtml-print-1.xsd
|
176
|
+
- data/schemas/xhtml-print-model-1.xsd
|
177
|
+
- data/schemas/xhtml-print-modules-1.xsd
|
178
|
+
- data/schemas/xhtml-rdfa-1.dtd
|
188
179
|
- data/schemas/xhtml-rdfa-1.xsd
|
189
|
-
- data/schemas/xhtml-datatypes-1.xsd
|
190
|
-
- data/schemas/frameset.dtd
|
191
|
-
- data/schemas/xhtml-lat1.ent
|
192
|
-
- data/schemas/xhtml-blkphras-1.xsd
|
193
|
-
- data/schemas/xhtml-symbol.ent
|
194
180
|
- data/schemas/xhtml-rdfa-model-1.xsd
|
181
|
+
- data/schemas/xhtml-rdfa-modules-1.xsd
|
182
|
+
- data/schemas/xhtml-ruby-1.xsd
|
195
183
|
- data/schemas/xhtml-ruby-basic-1.xsd
|
196
|
-
- data/schemas/xhtml-copyright-1.xsd
|
197
|
-
- data/schemas/xml-handlers-2.xsd
|
198
|
-
- data/schemas/xhtml-inlphras-1.xsd
|
199
|
-
- data/schemas/xhtml-basic10-modules-1.xsd
|
200
|
-
- data/schemas/xhtml-meta-1.xsd
|
201
|
-
- data/schemas/xhtml-attribs-1.xsd
|
202
|
-
- data/schemas/xhtml-list-1.xsd
|
203
|
-
- data/schemas/xhtml-inlstruct-1.xsd
|
204
184
|
- data/schemas/xhtml-script-1.xsd
|
205
|
-
- data/schemas/xhtml-
|
206
|
-
- data/schemas/xhtml-
|
185
|
+
- data/schemas/xhtml-special.ent
|
186
|
+
- data/schemas/xhtml-ssismap-1.xsd
|
187
|
+
- data/schemas/xhtml-struct-1.xsd
|
188
|
+
- data/schemas/xhtml-style-1.xsd
|
189
|
+
- data/schemas/xhtml-symbol.ent
|
190
|
+
- data/schemas/xhtml-table-1.xsd
|
191
|
+
- data/schemas/xhtml-target-1.xsd
|
192
|
+
- data/schemas/xhtml-text-1.xsd
|
193
|
+
- data/schemas/xhtml1-frameset.dtd
|
207
194
|
- data/schemas/xhtml1-frameset.xsd
|
208
|
-
- data/schemas/
|
209
|
-
- data/schemas/
|
195
|
+
- data/schemas/xhtml1-strict.dtd
|
196
|
+
- data/schemas/xhtml1-strict.xsd
|
197
|
+
- data/schemas/xhtml1-transitional.dtd
|
198
|
+
- data/schemas/xhtml1-transitional.xsd
|
210
199
|
- data/schemas/xhtml11-model-1.xsd
|
211
|
-
- data/schemas/
|
212
|
-
- data/schemas/
|
213
|
-
- data/schemas/
|
214
|
-
- data/schemas/
|
215
|
-
- data/schemas/
|
216
|
-
- data/schemas/
|
217
|
-
- data/schemas/
|
218
|
-
-
|
219
|
-
-
|
200
|
+
- data/schemas/xhtml11-module-redefines-1.xsd
|
201
|
+
- data/schemas/xhtml11-modules-1.xsd
|
202
|
+
- data/schemas/xhtml11.xsd
|
203
|
+
- data/schemas/xhtml2.xsd
|
204
|
+
- data/schemas/xml-events-1.xsd
|
205
|
+
- data/schemas/xml-events-2.xsd
|
206
|
+
- data/schemas/xml-events-attribs-1.xsd
|
207
|
+
- data/schemas/xml-events-attribs-2.xsd
|
208
|
+
- data/schemas/xml-events-copyright-1.xsd
|
209
|
+
- data/schemas/xml-events-copyright-2.xsd
|
210
|
+
- data/schemas/xml-handlers-1.xsd
|
211
|
+
- data/schemas/xml-handlers-2.xsd
|
212
|
+
- data/schemas/xml-script-1.xsd
|
213
|
+
- data/schemas/xml.xsd
|
214
|
+
- lib/validate_website.rb
|
215
|
+
- lib/validate_website/colorful_messages.rb
|
216
|
+
- lib/validate_website/core.rb
|
217
|
+
- lib/validate_website/option_parser.rb
|
218
|
+
- lib/validate_website/rspec.rb
|
219
|
+
- lib/validate_website/runner.rb
|
220
|
+
- lib/validate_website/validator.rb
|
221
|
+
- man/man1/validate-website-static.1
|
222
|
+
- man/man1/validate-website.1
|
223
|
+
- spec/core_spec.rb
|
224
|
+
- spec/data/html4-strict.html
|
225
|
+
- spec/data/html5-linuxfr.html
|
226
|
+
- spec/data/html5.html
|
227
|
+
- spec/data/validator.nu-failure.html
|
228
|
+
- spec/data/validator.nu-success.html
|
229
|
+
- spec/data/xhtml1-strict.html
|
230
|
+
- spec/example/ruby smalltalk/blockcamp-paris-le-28-novembre.html
|
231
|
+
- spec/spec_helper.rb
|
232
|
+
- spec/validator_spec.rb
|
233
|
+
- spec/webmock_helper.rb
|
220
234
|
homepage: http://github.com/spk/validate-website
|
221
235
|
licenses:
|
222
236
|
- MIT
|
@@ -227,12 +241,12 @@ require_paths:
|
|
227
241
|
- lib
|
228
242
|
required_ruby_version: !ruby/object:Gem::Requirement
|
229
243
|
requirements:
|
230
|
-
- -
|
244
|
+
- - ">="
|
231
245
|
- !ruby/object:Gem::Version
|
232
246
|
version: '0'
|
233
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
248
|
requirements:
|
235
|
-
- -
|
249
|
+
- - ">="
|
236
250
|
- !ruby/object:Gem::Version
|
237
251
|
version: '0'
|
238
252
|
requirements:
|
@@ -240,11 +254,10 @@ requirements:
|
|
240
254
|
- rainbow
|
241
255
|
- multipart_body
|
242
256
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
257
|
+
rubygems_version: 2.2.2
|
244
258
|
signing_key:
|
245
259
|
specification_version: 4
|
246
260
|
summary: Web crawler for checking the validity of your documents
|
247
261
|
test_files:
|
248
|
-
- spec/validator_spec.rb
|
249
262
|
- spec/core_spec.rb
|
250
|
-
|
263
|
+
- spec/validator_spec.rb
|
data/spec/fakeweb_helper.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'fakeweb'
|
3
|
-
|
4
|
-
FakeWeb.allow_net_connect = false
|
5
|
-
|
6
|
-
class FakePage
|
7
|
-
attr_accessor :links
|
8
|
-
attr_accessor :hrefs
|
9
|
-
attr_accessor :body
|
10
|
-
|
11
|
-
def initialize(name = '', options = {})
|
12
|
-
@name = name
|
13
|
-
@links = [options[:links]].flatten if options.has_key?(:links)
|
14
|
-
@hrefs = [options[:hrefs]].flatten if options.has_key?(:hrefs)
|
15
|
-
@redirect = options[:redirect] if options.has_key?(:redirect)
|
16
|
-
@content_type = options[:content_type] || "text/html"
|
17
|
-
@body = options[:body]
|
18
|
-
|
19
|
-
create_body unless @body
|
20
|
-
add_to_fakeweb
|
21
|
-
end
|
22
|
-
|
23
|
-
def url
|
24
|
-
SPEC_DOMAIN + @name
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def create_body
|
30
|
-
@body = "<html><body>"
|
31
|
-
@links.each{|l| @body += "<a href=\"#{SPEC_DOMAIN}#{l}\"></a>"} if @links
|
32
|
-
@hrefs.each{|h| @body += "<a href=\"#{h}\"></a>"} if @hrefs
|
33
|
-
@body += "</body></html>"
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_to_fakeweb
|
37
|
-
options = {:body => @body, :content_type => @content_type, :status => [200, "OK"]}
|
38
|
-
|
39
|
-
if @redirect
|
40
|
-
options[:status] = [301, "Permanently Moved"]
|
41
|
-
|
42
|
-
# only prepend SPEC_DOMAIN if a relative url (without an http scheme) was specified
|
43
|
-
redirect_url = (@redirect =~ /http/) ? @redirect : SPEC_DOMAIN + @redirect
|
44
|
-
options[:location] = redirect_url
|
45
|
-
|
46
|
-
# register the page this one redirects to
|
47
|
-
FakeWeb.register_uri(:get, redirect_url, {:body => '',
|
48
|
-
:content_type => @content_type,
|
49
|
-
:status => [200, "OK"]})
|
50
|
-
end
|
51
|
-
|
52
|
-
FakeWeb.register_uri(:get, SPEC_DOMAIN + @name, options)
|
53
|
-
end
|
54
|
-
end
|