aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-03-22 11:11:10 +0100
committerXavier Noria <fxn@hashref.com>2009-03-22 11:11:10 +0100
commit1ff3ae3ed7eb04268ffc880d1c39ad7957a9a7f7 (patch)
treebae41c2bb1b2d3f202aa60945816da6764b86e6f
parentdab7813ebc6c9624d20a95ab7e78066d5f5238fd (diff)
downloadrails-1ff3ae3ed7eb04268ffc880d1c39ad7957a9a7f7.tar.gz
rails-1ff3ae3ed7eb04268ffc880d1c39ad7957a9a7f7.tar.bz2
rails-1ff3ae3ed7eb04268ffc880d1c39ad7957a9a7f7.zip
ensure authors get warnings about broken links, and ensure end users don't
-rw-r--r--railties/Rakefile1
-rw-r--r--railties/guides/rails_guides/generator.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index 6c0fc22629..a9adbda0b5 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -247,6 +247,7 @@ end
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.textile"'
task :guides do
+ ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this
ruby "guides/rails_guides.rb"
end
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 9046b9203e..7807c2c565 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -164,7 +164,7 @@ module RailsGuides
guess = anchors.min { |a, b|
Levenshtein.distance(fragment_identifier, a) <=> Levenshtein.distance(fragment_identifier, b)
}
- puts "*** BROKEN LINK: ##{fragment_identifier}, perhaps you meant ##{guess}."
+ puts "*** BROKEN LINK: ##{fragment_identifier}, perhaps you meant ##{guess}." if ENV.key?("WARN_BROKEN_LINKS")
end
end
end