From 9e08a3bb1d47f79b6953056e72eee58e86d83ead Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 23 Nov 2008 13:39:30 +0100 Subject: [PATCH] Added rake rails:update:application_controller to renamed application.rb to application_controller.rb -- included in rake rails:update so upgrading to 2.3 will automatically trigger it [#1439 state:committed] (kastner) --- railties/CHANGELOG | 2 ++ railties/lib/tasks/framework.rake | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 6a644ca63a7e9..fcbf0c5ce6ebe 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *2.3.0 [Edge]* +* Added rake rails:update:application_controller to renamed application.rb to application_controller.rb -- included in rake rails:update so upgrading to 2.3 will automatically trigger it #1439 [kastner] + * Added Rails.backtrace_cleaner as an accessor for the Rails::BacktraceCleaner instance used by the framework to cut down on backtrace noise and config/initializers/backtrace_silencers.rb to add your own (or turn them all off) [DHH] * Switch from Test::Unit::TestCase to ActiveSupport::TestCase. [Jeremy Kemper] diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 5d1f8cf945bf0..4cf174b15b7f5 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -78,7 +78,7 @@ namespace :rails do end desc "Update both configs, scripts and public/javascripts from Rails" - task :update => [ "update:scripts", "update:javascripts", "update:configs" ] + task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:application_controller" ] namespace :update do desc "Add new scripts to the application script/ directory" @@ -114,5 +114,15 @@ namespace :rails do require 'railties_path' FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb') end + + desc "Rename application.rb to application_controller.rb" + task :application_controller do + old_style = RAILS_ROOT + '/app/controllers/application.rb' + new_style = RAILS_ROOT + '/app/controllers/application_controller.rb' + if File.exists?(old_style) && !File.exists?(new_style) + FileUtils.mv(old_style, new_style) + puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary" + end + end end end