diff options
author | Xavier Noria <fxn@hashref.com> | 2010-03-31 07:47:58 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-03-31 07:47:58 -0700 |
commit | 824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8 (patch) | |
tree | 1967c2a945d6e131d467fb4f0178a0f60e01ae8a /railties/lib/rails | |
parent | 1ed1652bef981d9402797b6cb9f0920a40eea21a (diff) | |
parent | db28d407f76a790a31e27bf51560e23425dd6944 (diff) | |
download | rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.gz rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.bz2 rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.zip |
Merge commit 'rails/master'
Diffstat (limited to 'railties/lib/rails')
9 files changed, 67 insertions, 48 deletions
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index a5154f4bba..a2b3622df8 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -27,7 +27,7 @@ module Rails routes.clear! paths.each { |path| load(path) } - ActionController.base_hook { routes.finalize! } + ActiveSupport.on_load(:action_controller) { routes.finalize! } nil ensure diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index c57660c0d1..3f74cd49fc 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -54,6 +54,11 @@ module Rails trap(:INT) { exit } puts "=> Ctrl-C to shutdown server" unless options[:daemonize] + #Create required tmp directories if not found + %w(cache pids sessions sockets).each do |dir_to_make| + FileUtils.mkdir_p(Rails.root.join('tmp', dir_to_make)) + end + super ensure # The '-h' option calls exit before @options is set. diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 85cae75bce..e9013348b5 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -180,8 +180,13 @@ module Rails initializer :add_view_paths do views = paths.app.views.to_a - ActionController.base_hook { prepend_view_path(views) } if defined?(ActionController) - ActionMailer.base_hook { prepend_view_path(views) } if defined?(ActionMailer) + ActiveSupport.on_load(:action_controller) do + prepend_view_path(views) + end + + ActiveSupport.on_load(:action_mailer) do + prepend_view_path(views) + end end initializer :add_metals do |app| diff --git a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb index a3dc38d9e4..867fc8c985 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb +++ b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'rails/performance_test_help' # Profiling results for each test method are written to tmp/performance. -class BrowsingTest < ActionController::PerformanceTest +class BrowsingTest < ActionDispatch::PerformanceTest def test_homepage get '/' end diff --git a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb b/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb deleted file mode 100644 index 99fd2f45bc..0000000000 --- a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Rails - module Generators - # TODO Deprecate me in a release > Rails 3.0 - class ModelSubclassGenerator < Base - desc "model_subclass is deprecated. Invoke model with --parent option instead." - - def say_deprecation_warn - say self.class.desc - end - end - end -end diff --git a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt index e94c0bfc77..733e321c94 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt @@ -1,10 +1,23 @@ +require 'rake' require 'rake/testtask' +require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the <%= file_name %> plugin.' Rake::TestTask.new(:test) do |t| + t.libs << 'lib' t.libs << 'test' t.pattern = 'test/**/*_test.rb' + t.verbose = true end + +desc 'Generate documentation for the <%= file_name %> plugin.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = '<%= class_name %>' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('lib/**/*.rb') +end
\ No newline at end of file diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/rails/generators/rails/resource/resource_generator.rb index 1e78945a7e..8a46708009 100644 --- a/railties/lib/rails/generators/rails/resource/resource_generator.rb +++ b/railties/lib/rails/generators/rails/resource/resource_generator.rb @@ -1,5 +1,6 @@ require 'rails/generators/resource_helpers' require 'rails/generators/rails/model/model_generator' +require 'active_support/core_ext/object/blank' module Rails module Generators diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index f2fee45594..957c375f6a 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) + path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first + yield File.dirname(path) if 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,56 @@ 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" + 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') + + gem_path('actionmailer') do |actionmailer| + %w(README CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file| + rdoc.rdoc_files.include("#{actionmailer}/#{file}") 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}") + gem_path('actionpack') do |actionpack| + %w(README CHANGELOG MIT-LICENSE lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{actionpack}/#{file}") end + end - %w(README CHANGELOG lib/active_model/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activemodel#{version}/#{file}") + gem_path('activemodel') do |activemodel| + %w(README CHANGELOG MIT-LICENSE lib/active_model/**/*.rb).each do |file| + rdoc.rdoc_files.include("#{activemodel}/#{file}") end + end + gem_path('activerecord') do |activerecord| %w(README CHANGELOG lib/active_record/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activerecord#{version}/#{file}") + rdoc.rdoc_files.include("#{activerecord}/#{file}") end + end + gem_path('activeresource') do |activeresource| %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file| - rdoc.rdoc_files.include("#{path}/activeresource#{version}/#{file}") + rdoc.rdoc_files.include("#{activeresource}/#{file}") end + end + gem_path('activesupport') do |activesupport| %w(README CHANGELOG lib/active_support/**/*.rb).each do |file| - rdoc.rdoc_files.include("#{path}/activesupport#{version}/#{file}") + rdoc.rdoc_files.include("#{activesupport}/#{file}") end + end - %w(README CHANGELOG MIT-LICENSE lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file| - rdoc.rdoc_files.include("#{path}/railties#{version}/#{file}") + gem_path('railties') do |railties| + %w(README CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file| + rdoc.rdoc_files.include("#{railties}/#{file}") end - } - end + end + } plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 6522c94ad6..3ce4e2c780 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -30,7 +30,7 @@ end class ActionController::TestCase setup do - @router = Rails.application.routes + @routes = Rails.application.routes end end |