diff options
author | Almudena Garcia <murtra@murtra.net> | 2012-08-23 23:46:45 +0200 |
---|---|---|
committer | Almudena Garcia <murtra@murtra.net> | 2012-08-23 23:46:45 +0200 |
commit | dfd145630d77e9722787143ac5dad32a2b3ed481 (patch) | |
tree | c3b8ea00312113dd40cabeeebf4fcdcc5d93afe0 | |
parent | aa41bcd4d818eeb945ee7654593dc647fc9c33ed (diff) | |
parent | ecae2f0ef0452f8d333525a6aed58e5ab8d3ccb1 (diff) | |
download | rails-dfd145630d77e9722787143ac5dad32a2b3ed481.tar.gz rails-dfd145630d77e9722787143ac5dad32a2b3ed481.tar.bz2 rails-dfd145630d77e9722787143ac5dad32a2b3ed481.zip |
Merge branch 'master' of github.com:lifo/docrails
-rw-r--r-- | guides/w3c_validator.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/guides/w3c_validator.rb b/guides/w3c_validator.rb index 5e340499c4..eac668c9cd 100644 --- a/guides/w3c_validator.rb +++ b/guides/w3c_validator.rb @@ -5,9 +5,9 @@ # Guides are taken from the output directory, from where all .html files are # submitted to the validator. # -# This script is prepared to be launched from the railties directory as a rake task: +# This script is prepared to be launched from the guides directory as a rake task: # -# rake validate_guides +# rake guides:validate # # If nothing is specified, all files will be validated, but you can check just # some of them using this environment variable: @@ -17,12 +17,12 @@ # enough: # # # validates only association_basics.html -# ONLY=assoc rake validate_guides +# rake guides:validate ONLY=assoc # # Separate many using commas: # # # validates only association_basics.html and migrations.html -# ONLY=assoc,migrations rake validate_guides +# rake guides:validate ONLY=assoc,migrations # # --------------------------------------------------------------------------- @@ -38,7 +38,12 @@ module RailsGuides errors_on_guides = {} guides_to_validate.each do |f| - results = validator.validate_file(f) + begin + results = validator.validate_file(f) + rescue Exception => e + puts "Could not validate #{f} because of #{e}" + next + end if results.validity print "." @@ -53,15 +58,15 @@ module RailsGuides private def guides_to_validate - guides = Dir["./guides/output/*.html"] - guides.delete("./guides/output/layout.html") + guides = Dir["./output/*.html"] + guides.delete("./output/layout.html") ENV.key?('ONLY') ? select_only(guides) : guides end def select_only(guides) prefixes = ENV['ONLY'].split(",").map(&:strip) guides.select do |guide| - prefixes.any? {|p| guide.start_with?("./guides/output/#{p}")} + prefixes.any? {|p| guide.start_with?("./output/#{p}")} end end |