diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-03-17 12:26:34 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-17 12:26:34 +0000 |
commit | dc88847e5ce392eed210b97525c14fca55852867 (patch) | |
tree | 65c88892aeae66a6c868692fb3db2a8165d349bc /railties/guides/rails_guides.rb | |
parent | 18eb80ccc7e932f9a6c00462ceaeea648631b120 (diff) | |
download | rails-dc88847e5ce392eed210b97525c14fca55852867.tar.gz rails-dc88847e5ce392eed210b97525c14fca55852867.tar.bz2 rails-dc88847e5ce392eed210b97525c14fca55852867.zip |
Try to use actionpack gem to generate guide when Rails is not vendored
Diffstat (limited to 'railties/guides/rails_guides.rb')
-rw-r--r-- | railties/guides/rails_guides.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/railties/guides/rails_guides.rb b/railties/guides/rails_guides.rb index 725f4cd886..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 @@ -22,7 +33,6 @@ module RailsGuides autoload :Indexer, "rails_guides/indexer" autoload :Helpers, "rails_guides/helpers" autoload :TextileExtensions, "rails_guides/textile_extensions" - autoload :Levenshtein, "rails_guides/levenshtein" end RedCloth.send(:include, RailsGuides::TextileExtensions) |