aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-03-29 16:25:52 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-03-29 16:25:52 -0700
commitaf8852d1ad904b6b8925dd2ac7d6cece11f7bbba (patch)
tree002b9027984affeeb5666066afaa7c9404fc769a
parente30363617cea5b51de2bb2e535c70092554514d0 (diff)
downloadrails-af8852d1ad904b6b8925dd2ac7d6cece11f7bbba.tar.gz
rails-af8852d1ad904b6b8925dd2ac7d6cece11f7bbba.tar.bz2
rails-af8852d1ad904b6b8925dd2ac7d6cece11f7bbba.zip
Work without bundler
-rw-r--r--railties/lib/rails/tasks/documentation.rake77
1 files changed, 46 insertions, 31 deletions
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index 1c5db25952..ff66b71dad 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -1,7 +1,11 @@
namespace :doc do
def gem_path(gem_name)
- @specs ||= Bundler.load.specs
- @specs.find{|s| s.name == gem_name}.full_gem_path
+ if defined? Bundler
+ @specs ||= Bundler.load.specs
+ @specs.find{|s| s.name == gem_name}.full_gem_path
+ else
+ "#{ENV['RAILS_PATH']}/#{gem_name}"
+ end
end
desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
@@ -16,42 +20,53 @@ namespace :doc do
rdoc.rdoc_files.include('lib/**/*.rb')
}
- 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}")
+ desc 'Generate documentation for the Rails framework. Uses gem paths or the RAILS_PATH environment variable.'
+ path = ENV['RAILS_PATH']
+ unless defined?(Bundler) || (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
+ else
+ 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
- %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 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 MIT-LICENSE lib/active_model/**/*.rb).each do |file|
- rdoc.rdoc_files.include("#{gem_path('activemodel')}/#{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("#{gem_path('activerecord')}/#{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("#{gem_path('activeresource')}/#{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("#{gem_path('activesupport')}/#{file}")
- end
+ %w(README CHANGELOG lib/active_support/**/*.rb).each do |file|
+ rdoc.rdoc_files.include("#{gem_path('activesupport')}/#{file}")
+ end
- %w(README CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
- rdoc.rdoc_files.include("#{gem_path('railties')}/#{file}")
- end
- }
+ %w(README CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
+ rdoc.rdoc_files.include("#{gem_path('railties')}/#{file}")
+ end
+ }
+ end
plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }