aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJaime Iniesta <jaimeiniesta@gmail.com>2010-06-18 15:26:07 +0200
committerJaime Iniesta <jaimeiniesta@gmail.com>2010-06-18 15:26:07 +0200
commit6d222cb94e5fdb403f9f1f75147ad42e19c5d75b (patch)
tree144931c76dfe6c439a669cceffd2e48b237bde4c /railties
parent5861fde01fbe9446666b319dfc8d24514aafda21 (diff)
downloadrails-6d222cb94e5fdb403f9f1f75147ad42e19c5d75b.tar.gz
rails-6d222cb94e5fdb403f9f1f75147ad42e19c5d75b.tar.bz2
rails-6d222cb94e5fdb403f9f1f75147ad42e19c5d75b.zip
cleaner output for rake validate_guides: dot-style, brief summary and detailed description below
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/w3c_validator.rb35
1 files changed, 29 insertions, 6 deletions
diff --git a/railties/guides/w3c_validator.rb b/railties/guides/w3c_validator.rb
index b55645a7a9..49cfb984cf 100644
--- a/railties/guides/w3c_validator.rb
+++ b/railties/guides/w3c_validator.rb
@@ -35,18 +35,21 @@ module RailsGuides
def validate
validator = MarkupValidator.new
+ STDOUT.sync = true
+ errors_on_guides = {}
guides_to_validate.each do |f|
- puts "Validating #{f}"
results = validator.validate_file(f)
- if !results.validity
- puts "#{f} FAILED W3C validation with #{results.errors.size} error(s):"
- results.errors.each do |error|
- puts error.to_s
- end
+ if results.validity
+ print "."
+ else
+ print "E"
+ errors_on_guides[f] = results.errors
end
end
+
+ show_results(errors_on_guides)
end
private
@@ -61,6 +64,26 @@ module RailsGuides
prefixes.any? {|p| guide.start_with?("./guides/output/#{p}")}
end
end
+
+ def show_results(error_list)
+ if error_list.size == 0
+ puts "\n\nAll checked guides validate OK!"
+ else
+ error_summary = error_detail = ""
+
+ error_list.each_pair do |name, errors|
+ error_summary += "\n #{name}"
+ error_detail += "\n\n #{name} has #{errors.size} validation error(s):\n"
+ errors.each do |error|
+ error_detail += "\n "+error.to_s.gsub("\n", "")
+ end
+ end
+
+ puts "\n\nThere are #{error_list.size} guides with validation errors:\n" + error_summary
+ puts "\nHere are the detailed errors for each guide:" + error_detail
+ end
+ end
+
end
end