Permalink
Browse files

Just inspect load paths to generate the documentation.

  • Loading branch information...
1 parent 56bed51 commit 331327d3919a633679dd3f434d13173fa8df010f @josevalim josevalim committed Mar 29, 2010
Showing with 1 addition and 6 deletions.
  1. +1 −6 railties/lib/rails/tasks/documentation.rake
@@ -1,11 +1,6 @@
namespace :doc do
def gem_path(gem_name)
- if defined? Bundler
- @specs ||= Bundler.load.specs
- @specs.find{|s| s.name == gem_name}.full_gem_path
- else
- "#{ENV['RAILS_PATH']}/#{gem_name}"
- end
+ File.dirname($LOAD_PATH.grep(/#{gem_name}[\w\-\.]*\/lib$/).first)
end
desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""

1 comment on commit 331327d

Contributor

postmodern commented on 331327d Mar 30, 2010

The gem_path method needs to fail gracefully when the given gem_name cannot be found in $LOAD_PATH. Otherwise, the use will get a can't convert nil into String exception when running any rake task.

Please sign in to comment.