Skip to content

Commit 87a28e3

Browse files
committed
if there's a Gemfile and doc:guides can't load RedCloth, print instructions for bundler
1 parent 05e0fa9 commit 87a28e3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

railties/guides/rails_guides.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
pwd = File.dirname(__FILE__)
22
$:.unshift pwd
33

4+
# This is a predicate useful for the doc:guides task of applications.
5+
def bundler?
6+
# Note that rake sets the cwd to the one that contains the Rakefile
7+
# being executed.
8+
File.exists?('Gemfile')
9+
end
10+
411
# Loading Action Pack requires rack and erubis.
512
require 'rubygems'
613

@@ -20,7 +27,19 @@
2027
gem 'RedCloth', '>= 4.1.1'
2128
require 'redcloth'
2229
rescue Gem::LoadError
23-
$stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
30+
$stderr.puts('Generating guides requires RedCloth 4.1.1+.')
31+
$stderr.puts(<<ERROR) if bundler?
32+
Please add
33+
34+
gem 'RedCloth', '>= 4.1.1'
35+
36+
to the Gemfile, run
37+
38+
bundle install
39+
40+
and try again.
41+
ERROR
42+
2443
exit 1
2544
end
2645

0 commit comments

Comments
 (0)