Skip to content

Instantly share code, notes, and snippets.

@lifo
Created March 17, 2009 11:54
Show Gist options
  • Save lifo/80491 to your computer and use it in GitHub Desktop.
Save lifo/80491 to your computer and use it in GitHub Desktop.
diff --git a/railties/guides/rails_guides.rb b/railties/guides/rails_guides.rb
index 725f4cd..a1eda0e 100644
--- a/railties/guides/rails_guides.rb
+++ b/railties/guides/rails_guides.rb
@@ -1,17 +1,22 @@
-pwd = File.dirname(__FILE__)
-$: << pwd
-$: << File.join(pwd, "../../activesupport/lib")
-$: << File.join(pwd, "../../actionpack/lib")
+$: << File.dirname(__FILE__)
-require "action_controller"
-require "action_view"
+begin
+ 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 %(Missing the latest RedCloth gem.\nPlease `gem install RedCloth` to generate the guides.)
exit 1
end
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 8e69af5..51ba1b2 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -23,7 +23,7 @@ module RailsGuides
if ENV["ONLY"]
only = ENV["ONLY"].split(",").map{|x| x.strip }.map {|o| "#{o}.textile" }
guides = guides.find_all {|g| only.include?(g) }
- puts "GENERATING ONLY #{guides.inspect}"
+ # puts "GENERATING ONLY #{guides.inspect}"
end
guides.each do |guide|
@@ -146,7 +146,7 @@ module RailsGuides
anchors = Set.new
html.scan(/<h\d\s+id="([^"]+)/).flatten.each do |anchor|
if anchors.member?(anchor)
- puts "*** DUPLICATE HEADER ID: #{anchor}, please consider rewording"
+ # puts "*** DUPLICATE HEADER ID: #{anchor}, please consider rewording"
else
anchors << anchor
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}."
+ # puts "*** BROKEN LINK: ##{fragment_identifier}, perhaps you meant ##{guess}."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment