Permalink
Browse files

Make `rake doc:guides` works again. Fix #10384.

  • Loading branch information...
1 parent a0939b0 commit 6e3cab93d7eb2a17792ad1551e38712393d1e3d9 @siong1987 siong1987 committed with steveklabnik Apr 30, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 guides/rails_guides.rb
  2. +2 −2 railties/lib/rails/tasks/documentation.rake
@@ -22,7 +22,7 @@ def bundler?
begin
require 'redcarpet'
-rescue Gem::LoadError
+rescue LoadError
# This can happen if doc:guides is executed in an application.
$stderr.puts('Generating guides requires Redcarpet 2.1.1+.')
$stderr.puts(<<ERROR) if bundler?
@@ -68,8 +68,8 @@ end
namespace :doc do
task :guides do
- # FIXME: Reaching outside lib directory is a bad idea
- require File.expand_path('../../../../../guides/rails_guides', __FILE__)
+ rails_gem_dir = Gem::Specification.find_by_name("rails").gem_dir
+ require File.expand_path(File.join(rails_gem_dir, "/guides/rails_guides"))
RailsGuides::Generator.new(Rails.root.join("doc/guides")).generate
end
end

0 comments on commit 6e3cab9

Please sign in to comment.