aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-03-24 12:10:38 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-24 12:10:38 +0000
commit4687306c2c1d94b0db6d66625867d881838b76d6 (patch)
treeec54e4d91113e8d3b6a481912a687aa97e3c63e2 /railties/guides
parent2f340d050b0327d809b10bb661ee0dd127777256 (diff)
parent6ed42ebdff05f9d28a60e91093d8f9afad03a958 (diff)
downloadrails-4687306c2c1d94b0db6d66625867d881838b76d6.tar.gz
rails-4687306c2c1d94b0db6d66625867d881838b76d6.tar.bz2
rails-4687306c2c1d94b0db6d66625867d881838b76d6.zip
Merge commit 'mainstream/master'
Conflicts: railties/guides/images/fxn.jpg railties/guides/rails_guides/generator.rb
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/images/fxn.jpgbin20510 -> 17773 bytes
-rw-r--r--railties/guides/rails_guides.rb27
-rw-r--r--railties/guides/rails_guides/generator.rb4
3 files changed, 21 insertions, 10 deletions
diff --git a/railties/guides/images/fxn.jpg b/railties/guides/images/fxn.jpg
index ad2de757db..81999341f1 100644
--- a/railties/guides/images/fxn.jpg
+++ b/railties/guides/images/fxn.jpg
Binary files differ
diff --git a/railties/guides/rails_guides.rb b/railties/guides/rails_guides.rb
index 725f4cd886..e0532812e4 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
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 7807c2c565..f93282db2e 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -57,7 +57,7 @@ module RailsGuides
result = view.render(:layout => 'layout', :text => textile(body))
f.write result
- warn_about_broken_links(result)
+ warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
end
end
end
@@ -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}." if ENV.key?("WARN_BROKEN_LINKS")
+ puts "*** BROKEN LINK: ##{fragment_identifier}, perhaps you meant ##{guess}."
end
end
end