validate-website 0.9.5 → 1.0.0
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 +93 -80
- data/lib/validate_website/option_parser.rb +58 -136
- data/lib/validate_website/validator.rb +13 -13
- data/man/man1/validate-website-static.1 +6 -16
- data/man/man1/validate-website.1 +6 -21
- data/spec/core_spec.rb +37 -8
- data/spec/data/html5-linuxfr.html +1049 -291
- data/spec/data/news/ryzom-naissance-du-projet-libre-ryzom-forge.md +0 -0
- data/spec/validator_spec.rb +3 -3
- metadata +18 -3
- data/lib/validate_website/rspec.rb +0 -10
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: 09/
|
5
|
+
.\" Date: 09/26/2014
|
6
6
|
.\" Manual: \ \&
|
7
7
|
.\" Source: \ \&
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "VALIDATE\-WEBSITE" "1" "09/
|
10
|
+
.TH "VALIDATE\-WEBSITE" "1" "09/26/2014" "\ \&" "\ \&"
|
11
11
|
.\" -----------------------------------------------------------------
|
12
12
|
.\" * Define some portability stuff
|
13
13
|
.\" -----------------------------------------------------------------
|
@@ -43,39 +43,29 @@ Website to crawl (Default:
|
|
43
43
|
http://localhost:3000/)
|
44
44
|
.RE
|
45
45
|
.PP
|
46
|
-
\fB\-u\fR, \fB\-\-user\-agent\fR \fIUSERAGENT\fR
|
47
|
-
.RS 4
|
48
|
-
Change user agent (Default: Spidr\&.user_agent)
|
49
|
-
.RE
|
50
|
-
.PP
|
51
46
|
\fB\-e\fR, \fB\-\-exclude\fR \fIEXCLUDE\fR
|
52
47
|
.RS 4
|
53
48
|
Url to exclude (ex:
|
54
49
|
\fIredirect|news\fR)
|
55
50
|
.RE
|
56
51
|
.PP
|
57
|
-
\fB\-i\fR, \fB\-\-ignore
|
52
|
+
\fB\-i\fR, \fB\-\-ignore\fR \fIIGNORE\fR
|
58
53
|
.RS 4
|
59
54
|
Ignore certain validation errors (ex:
|
60
55
|
\fIautocorrect\fR)
|
61
56
|
.RE
|
62
57
|
.PP
|
63
|
-
\fB\-f\fR, \fB\-\-file\fR \fIFILE\fR
|
64
|
-
.RS 4
|
65
|
-
Save not well formed or not found (with \-n used) urls
|
66
|
-
.RE
|
67
|
-
.PP
|
68
58
|
\fB\-c\fR, \fB\-\-cookies\fR \fICOOKIES\fR
|
69
59
|
.RS 4
|
70
60
|
Set defaults cookies
|
71
61
|
.RE
|
72
62
|
.PP
|
73
|
-
\fB\-m\fR, \fB\-\-[no\-]markup
|
63
|
+
\fB\-m\fR, \fB\-\-[no\-]markup\fR
|
74
64
|
.RS 4
|
75
65
|
Markup validation (Default: true)
|
76
66
|
.RE
|
77
67
|
.PP
|
78
|
-
\fB\-n\fR, \fB\-\-
|
68
|
+
\fB\-n\fR, \fB\-\-notfound\fR
|
79
69
|
.RS 4
|
80
70
|
Log not found url (Default: false)
|
81
71
|
.RE
|
@@ -90,11 +80,6 @@ Show colored output (Default: true)
|
|
90
80
|
Show detail of validator errors (Default: false)\&.
|
91
81
|
.RE
|
92
82
|
.PP
|
93
|
-
\fB\-q\fR, \fB\-\-quiet\fR
|
94
|
-
.RS 4
|
95
|
-
Only report errors (Default: false)\&.
|
96
|
-
.RE
|
97
|
-
.PP
|
98
83
|
\fB\-h\fR, \fB\-\-help\fR
|
99
84
|
.RS 4
|
100
85
|
Show help message and exit\&.
|
@@ -127,4 +112,4 @@ Laurent Arnoud <laurent@spkdev\&.net>
|
|
127
112
|
.sp
|
128
113
|
The MIT License
|
129
114
|
.sp
|
130
|
-
Copyright (c) 2009\-
|
115
|
+
Copyright (c) 2009\-2014 Laurent Arnoud <laurent@spkdev\&.net>
|
data/spec/core_spec.rb
CHANGED
@@ -18,6 +18,24 @@ describe ValidateWebsite::Core do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
describe 'options' do
|
22
|
+
it 'can change user-agent' do
|
23
|
+
ua = 'Linux / Firefox 29: Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0'
|
24
|
+
v = ValidateWebsite::Core.new({site: SPEC_DOMAIN, user_agent: ua}, :crawl)
|
25
|
+
v.crawl
|
26
|
+
v.crawler.user_agent.must_equal ua
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe('cookies') do
|
31
|
+
it 'can set cookies' do
|
32
|
+
cookies = 'tz=Europe%2FBerlin; guid=ZcpBshbtStgl9VjwTofq'
|
33
|
+
v = ValidateWebsite::Core.new({site: SPEC_DOMAIN, cookies: cookies}, :crawl)
|
34
|
+
v.crawl
|
35
|
+
v.crawler.cookies.cookies_for_host(v.host).must_equal v.default_cookies
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
21
39
|
describe('html') do
|
22
40
|
it "extract url" do
|
23
41
|
name = 'xhtml1-strict'
|
@@ -26,7 +44,7 @@ describe ValidateWebsite::Core do
|
|
26
44
|
body: open(file).read,
|
27
45
|
content_type: 'text/html')
|
28
46
|
@validate_website.site = page.url
|
29
|
-
@validate_website.crawl
|
47
|
+
@validate_website.crawl
|
30
48
|
@validate_website.crawler.history.size.must_equal 5
|
31
49
|
end
|
32
50
|
|
@@ -37,7 +55,7 @@ describe ValidateWebsite::Core do
|
|
37
55
|
body: open(file).read,
|
38
56
|
content_type: 'text/html')
|
39
57
|
@validate_website.site = page.url
|
40
|
-
@validate_website.crawl
|
58
|
+
@validate_website.crawl
|
41
59
|
@validate_website.crawler.history.size.must_equal 98
|
42
60
|
end
|
43
61
|
end
|
@@ -51,7 +69,7 @@ describe ValidateWebsite::Core do
|
|
51
69
|
.t {background-image: url(/image/pouet)}',
|
52
70
|
content_type: 'text/css')
|
53
71
|
@validate_website.site = page.url
|
54
|
-
@validate_website.crawl
|
72
|
+
@validate_website.crawl
|
55
73
|
@validate_website.crawler.history.size.must_equal 5
|
56
74
|
end
|
57
75
|
|
@@ -60,7 +78,7 @@ describe ValidateWebsite::Core do
|
|
60
78
|
body: ".test {background-image: url('pouet');}",
|
61
79
|
content_type: 'text/css')
|
62
80
|
@validate_website.site = page.url
|
63
|
-
@validate_website.crawl
|
81
|
+
@validate_website.crawl
|
64
82
|
@validate_website.crawler.history.size.must_equal 2
|
65
83
|
end
|
66
84
|
|
@@ -69,7 +87,7 @@ describe ValidateWebsite::Core do
|
|
69
87
|
body: ".test {background-image: url(\"pouet\");}",
|
70
88
|
content_type: 'text/css')
|
71
89
|
@validate_website.site = page.url
|
72
|
-
@validate_website.crawl
|
90
|
+
@validate_website.crawl
|
73
91
|
@validate_website.crawler.history.size.must_equal 2
|
74
92
|
end
|
75
93
|
end
|
@@ -79,9 +97,20 @@ describe ValidateWebsite::Core do
|
|
79
97
|
pattern = File.join(File.dirname(__FILE__), 'example/**/*.html')
|
80
98
|
@validate_website.crawl_static(pattern: pattern,
|
81
99
|
site: 'http://dev.af83.com/',
|
82
|
-
|
83
|
-
not_found: false
|
84
|
-
|
100
|
+
markup: false,
|
101
|
+
not_found: false)
|
102
|
+
@validate_website.not_founds_count.must_equal 0
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'not found' do
|
106
|
+
pattern = File.join(File.dirname(__FILE__), '**/*.html')
|
107
|
+
Dir.chdir('spec/data') do
|
108
|
+
@validate_website.crawl_static(pattern: pattern,
|
109
|
+
site: 'https://linuxfr.org/',
|
110
|
+
markup: false,
|
111
|
+
not_found: true)
|
112
|
+
@validate_website.not_founds_count.must_equal 464
|
113
|
+
end
|
85
114
|
end
|
86
115
|
end
|
87
116
|
end
|