diff options
Diffstat (limited to 'railties/guides/rails_guides.rb')
-rw-r--r-- | railties/guides/rails_guides.rb | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/railties/guides/rails_guides.rb b/railties/guides/rails_guides.rb index 6da7de890e..b73e10e43f 100644 --- a/railties/guides/rails_guides.rb +++ b/railties/guides/rails_guides.rb @@ -1,17 +1,28 @@ pwd = File.dirname(__FILE__) $: << pwd -$: << File.join(pwd, "../../activesupport/lib") -$: << File.join(pwd, "../../actionpack/lib") -require "action_controller" -require "action_view" +begin + as_lib = File.join(pwd, "../../activesupport/lib") + ap_lib = File.join(pwd, "../../actionpack/lib") + + $: << as_lib if File.directory?(as_lib) + $: << ap_lib if File.directory?(ap_lib) + + require "action_controller" + require "action_view" +rescue LoadError + require 'rubygems' + gem "actionpack", '>= 2.3' + + require "action_controller" + require "action_view" +end -# Require rubygems after loading Action View -require 'rubygems' begin - gem 'RedCloth', '>= 4.1.1'# Need exactly 4.1.1 + require 'rubygems' + gem 'RedCloth', '>= 4.1.1' rescue Gem::LoadError - $stderr.puts %(Missing the RedCloth 4.1.1 gem.\nPlease `gem install -v=4.1.1 RedCloth` to generate the guides.) + $stderr.puts %(Generating Guides requires RedCloth 4.1.1+) exit 1 end |