aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-07-30 21:50:38 +0200
committerXavier Noria <fxn@hashref.com>2010-07-30 21:50:53 +0200
commit87a28e34aef3f68de8e344aadc47a516e28c0b09 (patch)
treeb7bd9708b929c6e822a14772b10ebd0ea7d3b440 /railties/guides/rails_guides.rb
parent05e0fa9cfb9afd5ce4e9299c81f824d16373fc03 (diff)
downloadrails-87a28e34aef3f68de8e344aadc47a516e28c0b09.tar.gz
rails-87a28e34aef3f68de8e344aadc47a516e28c0b09.tar.bz2
rails-87a28e34aef3f68de8e344aadc47a516e28c0b09.zip
if there's a Gemfile and doc:guides can't load RedCloth, print instructions for bundler
Diffstat (limited to 'railties/guides/rails_guides.rb')
-rw-r--r--railties/guides/rails_guides.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/railties/guides/rails_guides.rb b/railties/guides/rails_guides.rb
index e6f0b694a6..dfbb06cc76 100644
--- a/railties/guides/rails_guides.rb
+++ b/railties/guides/rails_guides.rb
@@ -1,6 +1,13 @@
pwd = File.dirname(__FILE__)
$:.unshift pwd
+# This is a predicate useful for the doc:guides task of applications.
+def bundler?
+ # Note that rake sets the cwd to the one that contains the Rakefile
+ # being executed.
+ File.exists?('Gemfile')
+end
+
# Loading Action Pack requires rack and erubis.
require 'rubygems'
@@ -20,7 +27,19 @@ begin
gem 'RedCloth', '>= 4.1.1'
require 'redcloth'
rescue Gem::LoadError
- $stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
+ $stderr.puts('Generating guides requires RedCloth 4.1.1+.')
+ $stderr.puts(<<ERROR) if bundler?
+Please add
+
+ gem 'RedCloth', '>= 4.1.1'
+
+to the Gemfile, run
+
+ bundle install
+
+and try again.
+ERROR
+
exit 1
end