2007-01-22 14:43:50 +01:00
|
|
|
namespace :doc do
|
2008-09-07 07:54:05 +02:00
|
|
|
desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
|
2011-06-15 07:43:38 +02:00
|
|
|
RDoc::Task.new("app") { |rdoc|
|
2007-01-22 14:43:50 +01:00
|
|
|
rdoc.rdoc_dir = 'doc/app'
|
2007-12-21 08:48:59 +01:00
|
|
|
rdoc.template = ENV['template'] if ENV['template']
|
2008-09-07 07:54:05 +02:00
|
|
|
rdoc.title = ENV['title'] || "Rails Application Documentation"
|
2007-01-22 14:43:50 +01:00
|
|
|
rdoc.options << '--line-numbers' << '--inline-source'
|
2007-12-21 08:48:59 +01:00
|
|
|
rdoc.options << '--charset' << 'utf-8'
|
2007-01-22 14:43:50 +01:00
|
|
|
rdoc.rdoc_files.include('doc/README_FOR_APP')
|
|
|
|
rdoc.rdoc_files.include('app/**/*.rb')
|
2007-02-09 09:04:31 +01:00
|
|
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
2007-01-22 14:43:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
desc "Generate documentation for the Rails framework"
|
2011-06-15 07:43:38 +02:00
|
|
|
RDoc::Task.new("rails") { |rdoc|
|
2007-01-22 14:43:50 +01:00
|
|
|
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')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')
|
2007-12-21 08:48:59 +01:00
|
|
|
rdoc.rdoc_files.include('vendor/rails/railties/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/railties/lib/{*.rb,commands/*.rb,rails_generator/*.rb}')
|
2007-01-22 14:43:50 +01:00
|
|
|
rdoc.rdoc_files.include('vendor/rails/activerecord/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb')
|
|
|
|
rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*')
|
2007-12-21 08:48:59 +01:00
|
|
|
rdoc.rdoc_files.include('vendor/rails/activeresource/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activeresource/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource.rb')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource/*')
|
2007-01-22 14:43:50 +01:00
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionpack/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionmailer/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activesupport/README')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG')
|
|
|
|
rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
|
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
desc "Generate documentation for all installed plugins"
|
2007-01-22 14:43:50 +01:00
|
|
|
task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" }
|
|
|
|
|
|
|
|
desc "Remove plugin documentation"
|
|
|
|
task :clobber_plugins do
|
|
|
|
rm_rf 'doc/plugins' rescue nil
|
|
|
|
end
|
|
|
|
|
2008-10-27 07:47:01 +01:00
|
|
|
desc "Generate Rails guides"
|
|
|
|
task :guides do
|
2009-02-28 02:23:00 +01:00
|
|
|
require File.join(RAILTIES_PATH, "guides/rails_guides")
|
|
|
|
RailsGuides::Generator.new(File.join(RAILS_ROOT, "doc/guides")).generate
|
2008-10-27 07:47:01 +01:00
|
|
|
end
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
namespace :plugins do
|
|
|
|
# Define doc tasks for each plugin
|
|
|
|
plugins.each do |plugin|
|
2008-10-27 07:47:01 +01:00
|
|
|
desc "Generate documentation for the #{plugin} plugin"
|
2007-01-22 14:43:50 +01:00
|
|
|
task(plugin => :environment) do
|
|
|
|
plugin_base = "vendor/plugins/#{plugin}"
|
|
|
|
options = []
|
|
|
|
files = Rake::FileList.new
|
|
|
|
options << "-o doc/plugins/#{plugin}"
|
|
|
|
options << "--title '#{plugin.titlecase} Plugin Documentation'"
|
|
|
|
options << '--line-numbers' << '--inline-source'
|
2008-10-27 07:47:01 +01:00
|
|
|
options << '--charset' << 'utf-8'
|
2007-01-22 14:43:50 +01:00
|
|
|
options << '-T html'
|
|
|
|
|
|
|
|
files.include("#{plugin_base}/lib/**/*.rb")
|
2008-05-18 06:22:34 +02:00
|
|
|
if File.exist?("#{plugin_base}/README")
|
2007-01-22 14:43:50 +01:00
|
|
|
files.include("#{plugin_base}/README")
|
|
|
|
options << "--main '#{plugin_base}/README'"
|
|
|
|
end
|
2008-05-18 06:22:34 +02:00
|
|
|
files.include("#{plugin_base}/CHANGELOG") if File.exist?("#{plugin_base}/CHANGELOG")
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
options << files.to_s
|
|
|
|
|
|
|
|
sh %(rdoc #{options * ' '})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2007-12-21 08:48:59 +01:00
|
|
|
end
|