jakewendt-html_test 0.3.5 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/jakewendt-html_test.gemspec +3 -5
- data/lib/html_test.rb +42 -39
- metadata +2 -4
- data/script/rails +0 -6
- data/script/validate +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3f1703933eaf7e432097891ae583f89662309b
|
4
|
+
data.tar.gz: a0588858e498a7cc2a399794abd6d933a86c4513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6edbd4d38a82727b604bf2ad87bcff848597633295217dc341e8b0e6bde54f127176609315973128530d90b927e239e8288e867a398920695905d3f86ea1d733
|
7
|
+
data.tar.gz: d61d05b408e58982704e67ca7dda089407befc13caca2689983d3076d3996fe819cfa2212860ebe6511c10f1f1eab8161680485669d1bfe0ad5fc23719f4713c
|
data/Rakefile
CHANGED
@@ -50,7 +50,8 @@ begin
|
|
50
50
|
gem.files -= FileList['pkg/**/*']
|
51
51
|
gem.files -= FileList['**/versions/**/*']
|
52
52
|
gem.files -= FileList['*Gemfile*']
|
53
|
-
gem.files -= FileList['rails
|
53
|
+
gem.files -= FileList['rails/*']
|
54
|
+
gem.files -= FileList['script/*']
|
54
55
|
gem.files -= FileList['coverage/**/*']
|
55
56
|
end
|
56
57
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
4.0.0
|
data/jakewendt-html_test.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "jakewendt-html_test"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "4.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Marklund", "George 'Jake' Wendt"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2014-03-19"
|
13
13
|
s.description = "Ruby on Rails plugin for HTML validation and link checking"
|
14
14
|
s.email = "github@jakewendt.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,9 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/url_checker.rb",
|
36
36
|
"lib/url_selector.rb",
|
37
37
|
"lib/validate_filter.rb",
|
38
|
-
"lib/validator.rb"
|
39
|
-
"script/rails",
|
40
|
-
"script/validate"
|
38
|
+
"lib/validator.rb"
|
41
39
|
]
|
42
40
|
s.homepage = "http://github.com/jakewendt/html_test"
|
43
41
|
s.require_paths = ["lib"]
|
data/lib/html_test.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
#if !defined?(RAILS_ENV) || RAILS_ENV == 'test'
|
2
1
|
if !defined?(RAILS_ENV) || RAILS_ENV == 'test' || Rails.env == 'test'
|
3
2
|
|
4
3
|
%w(validator assertions url_selector url_checker link_validator validate_filter).each do |file|
|
5
4
|
require File.join(File.dirname(__FILE__), file)
|
6
5
|
end
|
7
6
|
|
8
|
-
class
|
7
|
+
class MiniTest::Unit::TestCase
|
8
|
+
include Html::Test::Assertions
|
9
|
+
end if defined?(MiniTest)
|
10
|
+
|
11
|
+
class Test::Unit::TestCase
|
9
12
|
include Html::Test::Assertions
|
10
13
|
end
|
11
14
|
|
12
|
-
module
|
15
|
+
module ActionDispatch
|
13
16
|
module Integration #:nodoc:
|
14
17
|
class Session
|
15
18
|
include Html::Test::Assertions
|
@@ -56,43 +59,43 @@ if !defined?(RAILS_ENV) || RAILS_ENV == 'test' || Rails.env == 'test'
|
|
56
59
|
|
57
60
|
|
58
61
|
|
59
|
-
validate = false
|
60
|
-
validators = ["http://localhost/w3c-validator/check",
|
61
|
-
|
62
|
-
|
63
|
-
validators.each do |validator|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
validate = false
|
63
|
+
validators = ["http://localhost/w3c-validator/check",
|
64
|
+
Html::Test::Validator.w3c_url]
|
65
|
+
|
66
|
+
validators.each do |validator|
|
67
|
+
vhost = validator.split('/')[2]
|
68
|
+
vpath = "/"<< validator.split('/')[3..-1].join('/')
|
69
|
+
begin
|
70
|
+
response = Net::HTTP.get_response(vhost, vpath)
|
71
|
+
if response.code == '200'
|
72
|
+
Html::Test::Validator.w3c_url = validator
|
73
|
+
validate = true
|
74
|
+
break
|
75
|
+
end
|
76
|
+
rescue
|
72
77
|
end
|
73
|
-
rescue
|
74
78
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
#
|
84
|
-
# ApplicationController
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
79
|
+
|
80
|
+
if validate
|
81
|
+
# In Rails 3, ApplicationController not defined yet
|
82
|
+
# ApplicationController.validate_all = true
|
83
|
+
ActionController::Base.validate_all = true
|
84
|
+
# default is :tidy, but it doesn't really validate.
|
85
|
+
# I've purposely not closed tags and it doesn't complain.
|
86
|
+
# :w3c is ridiculously slow! even when used locally
|
87
|
+
# ApplicationController.validators = [:w3c]
|
88
|
+
# In Rails 3, ApplicationController not defined yet
|
89
|
+
ActionController::Base.validators = [:w3c]
|
90
|
+
#ApplicationController.validators = [:tidy, :w3c]
|
91
|
+
Html::Test::Validator.verbose = false
|
92
|
+
Html::Test::Validator.revalidate_all = true
|
93
|
+
Html::Test::Validator.tidy_ignore_list =
|
94
|
+
[/<table> lacks "summary" attribute/]
|
95
|
+
puts "Validating all html with " <<
|
96
|
+
Html::Test::Validator.w3c_url
|
97
|
+
else
|
98
|
+
puts "NOT validating html at all"
|
99
|
+
end
|
97
100
|
|
98
101
|
end #if !defined?(RAILS_ENV) || RAILS_ENV == 'test'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jakewendt-html_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Marklund
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Ruby on Rails plugin for HTML validation and link checking
|
15
15
|
email: github@jakewendt.com
|
@@ -38,8 +38,6 @@ files:
|
|
38
38
|
- lib/url_selector.rb
|
39
39
|
- lib/validate_filter.rb
|
40
40
|
- lib/validator.rb
|
41
|
-
- script/rails
|
42
|
-
- script/validate
|
43
41
|
homepage: http://github.com/jakewendt/html_test
|
44
42
|
licenses: []
|
45
43
|
metadata: {}
|
data/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
data/script/validate
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# == Synopsis
|
3
|
-
# This script validates an HTML page via HTTP and checks for broken
|
4
|
-
# links and images. Links are followed one step away from the start page.
|
5
|
-
# HTML validation is also done for pages linked internally from the start page
|
6
|
-
# (i.e. relative URLs).
|
7
|
-
#
|
8
|
-
# == Usage
|
9
|
-
# vendor/plugins/html_test/script/validate http://my.url.com [options]
|
10
|
-
#
|
11
|
-
# Options:
|
12
|
-
#
|
13
|
-
# --no-follow:: Don't follow any anchor or images URLs on
|
14
|
-
# the start page (i.e. only one page is requested).
|
15
|
-
#
|
16
|
-
# --validators validator_list:: A comma separated list of validators to use
|
17
|
-
# for HTML validation. Supported validators:
|
18
|
-
# tidy, xmllint, w3c. Default validator is
|
19
|
-
# tidy if it is installed, otherwise w3c.
|
20
|
-
#
|
21
|
-
# --dtd dtd_path:: Path to the DTD file to use for xmllint
|
22
|
-
# validation. By default xmllint will use
|
23
|
-
# the XHTML 1.0 strict DTD. Set dtd_path
|
24
|
-
# to "doctype" to make xmllint use the
|
25
|
-
# DTD specified in the DOCTYPE tag
|
26
|
-
# (can be slow).
|
27
|
-
#
|
28
|
-
# --skip skip_patterns:: A comma separated list of regexp patterns for
|
29
|
-
# URLs to not visit. Using the pattern '.*'
|
30
|
-
# is equivalent to the --no-follow option.
|
31
|
-
#
|
32
|
-
# --only only_pattern:: Only visit URLs matching given regexp pattern
|
33
|
-
#
|
34
|
-
# --no-external:: Do not visit external URLs, i.e. URLs with
|
35
|
-
# different domain than the start page.
|
36
|
-
#
|
37
|
-
# --quiet:: Don't output anything unless there is a failure.
|
38
|
-
|
39
|
-
require 'optparse'
|
40
|
-
require 'rdoc/usage'
|
41
|
-
require 'uri'
|
42
|
-
|
43
|
-
require File.join(File.dirname(__FILE__), "..", "..", "..", "..", "test", "test_helper")
|
44
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "html_test")
|
45
|
-
|
46
|
-
options = Html::Test::LinkValidator.parse_command_line(ARGV) rescue RDoc::usage
|
47
|
-
Html::Test::LinkValidator.new(ARGV[0], options)
|