diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-03-10 21:14:27 +0330 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-28 17:42:53 -0700 |
commit | de2b0147d04d5460e576cc21afbb062eb012ea7e (patch) | |
tree | 02121b0b6a03ab84a70d5cf0f258aaea7f92d240 | |
parent | 878a9e02f662516d0d70c44beb1a3f4297342896 (diff) | |
download | rails-de2b0147d04d5460e576cc21afbb062eb012ea7e.tar.gz rails-de2b0147d04d5460e576cc21afbb062eb012ea7e.tar.bz2 rails-de2b0147d04d5460e576cc21afbb062eb012ea7e.zip |
Reapply Rizwan's patch, but memoize Bundler.load.specs in an ivar. [#3697 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
-rw-r--r-- | railties/lib/rails/tasks/documentation.rake | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index f2fee45594..1c5db25952 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -1,4 +1,9 @@ namespace :doc do + def gem_path(gem_name) + @specs ||= Bundler.load.specs + @specs.find{|s| s.name == gem_name}.full_gem_path + end + desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\"" Rake::RDocTask.new("app") { |rdoc| rdoc.rdoc_dir = 'doc/app' @@ -11,54 +16,42 @@ namespace :doc do rdoc.rdoc_files.include('lib/**/*.rb') } - desc 'Generate documentation for the Rails framework. Specify path with RAILS_PATH="/path/to/rails"' - path = ENV['RAILS_PATH'] - unless path && File.directory?(path) - task :rails do - if path - $stderr.puts "Skipping doc:rails, missing Rails directory at #{path}" - else - $stderr.puts "Skipping doc:rails, RAILS_PATH environment variable is not set" - end + desc 'Generate documentation for the Rails framework.' + Rake::RDocTask.new("rails") { |rdoc| + rdoc.rdoc_dir = 'doc/api' + rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.title = "Rails Framework Documentation" + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + + %w(README CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file| + rdoc.rdoc_files.include("#{gem_path('actionmailer')}/#{file}") end - else - Rake::RDocTask.new("rails") { |rdoc| - version = "-#{Rails::VERSION::STRING}" unless ENV['RAILS_PATH'] - rdoc.rdoc_dir = 'doc/api' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] - rdoc.title = "Rails Framework Documentation" - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - - %w(README CHANGELOG lib/action_mailer/base.rb).each do |file| - rdoc.rdoc_files.include("#{path}/actionmailer#{version}/#{file}") - end - %w(README CHANGELOG lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/actionpack#{version}/#{file}") - end + %w(README CHANGELOG MIT-LICENSE lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{gem_path('actionpack')}/#{file}") + end - %w(README CHANGELOG lib/active_model/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{file}") - end + %w(README CHANGELOG MIT-LICENSE lib/active_model/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{gem_path('activemodel')}/#{file}") + end - %w(README CHANGELOG lib/active_record/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activerecord#{version}/#{file}") - end + %w(README CHANGELOG lib/active_record/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{gem_path('activerecord')}/#{file}") + end - %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file| - rdoc.rdoc_files.include("#{path}/activeresource#{version}/#{file}") - end + %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file| + rdoc.rdoc_files.include("#{gem_path('activeresource')}/#{file}") + end - %w(README CHANGELOG lib/active_support/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activesupport#{version}/#{file}") - end + %w(README CHANGELOG lib/active_support/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{gem_path('activesupport')}/#{file}") + end - %w(README CHANGELOG MIT-LICENSE lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file| - rdoc.rdoc_files.include("#{path}/railties#{version}/#{file}") - end - } - end + %w(README CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file| + rdoc.rdoc_files.include("#{gem_path('railties')}/#{file}") + end + } plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } |