From ee580d0cc3794ecb4c6e259d2573695c60a422b4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 7 Mar 2010 12:06:19 -0800 Subject: rake doc:rails complains loudly if there's no path to generate docs from --- railties/lib/rails/tasks/documentation.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails/tasks') diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index 1f4067d29e..b36adb2961 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -11,9 +11,11 @@ namespace :doc do rdoc.rdoc_files.include('lib/**/*.rb') } - desc 'Generate documentation for the Rails framework. Specify path with PATH="/path/to/rails"' + desc 'Generate documentation for the Rails framework. Specify path with RAILS_PATH="/path/to/rails"' Rake::RDocTask.new("rails") { |rdoc| path = ENV['RAILS_PATH'] || 'vendor/gems/gems' + raise "Missing Rails directory at #{path}" unless File.directory?(path) + version = "-#{Rails::VERSION::STRING}" unless ENV['RAILS_PATH'] rdoc.rdoc_dir = 'doc/api' rdoc.template = "#{ENV['template']}.rb" if ENV['template'] -- cgit v1.2.3 From 4a89467f7cf4bbdf38a0d703099ba7510586f4ac Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 7 Mar 2010 12:39:53 -0800 Subject: If RAILS_PATH isn't set, make a dummy doc task --- railties/lib/rails/tasks/documentation.rake | 72 ++++++++++++++++------------- 1 file changed, 40 insertions(+), 32 deletions(-) (limited to 'railties/lib/rails/tasks') diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index b36adb2961..abf9b33ae5 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -12,45 +12,53 @@ namespace :doc do } desc 'Generate documentation for the Rails framework. Specify path with RAILS_PATH="/path/to/rails"' - Rake::RDocTask.new("rails") { |rdoc| - path = ENV['RAILS_PATH'] || 'vendor/gems/gems' - raise "Missing Rails directory at #{path}" unless File.directory?(path) - - 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}") + 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 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 lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{path}/actionpack#{version}/#{file}") + end - %w(README CHANGELOG lib/active_model/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{file}") - end + %w(README CHANGELOG lib/active_model/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{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("#{path}/activerecord#{version}/#{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("#{path}/activeresource#{version}/#{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("#{path}/activesupport#{version}/#{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 - } + %w(README CHANGELOG MIT-LICENSE lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file| + rdoc.rdoc_files.include("#{path}/railties#{version}/#{file}") + end + } + end plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } -- cgit v1.2.3