diff options
Diffstat (limited to 'railties/guides/w3c_validator.rb')
-rw-r--r-- | railties/guides/w3c_validator.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/railties/guides/w3c_validator.rb b/railties/guides/w3c_validator.rb index 4da48bf3fb..f1fe1e0f33 100644 --- a/railties/guides/w3c_validator.rb +++ b/railties/guides/w3c_validator.rb @@ -21,7 +21,7 @@ # # Separate many using commas: # -# # validates only +# # validates only association_basics.html and migrations.html # ONLY=assoc,migrations rake validate_guides # # --------------------------------------------------------------------------- @@ -32,13 +32,13 @@ include W3CValidators module RailsGuides class Validator - + def validate validator = MarkupValidator.new STDOUT.sync = true errors_on_guides = {} - guides_to_validate.each do |f| + guides_to_validate.each do |f| results = validator.validate_file(f) if results.validity @@ -48,10 +48,10 @@ module RailsGuides errors_on_guides[f] = results.errors end end - + show_results(errors_on_guides) end - + private def guides_to_validate guides = Dir["./guides/output/*.html"] @@ -65,13 +65,13 @@ 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" @@ -79,13 +79,13 @@ module RailsGuides 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 -RailsGuides::Validator.new.validate
\ No newline at end of file +RailsGuides::Validator.new.validate |