Skip to content
This repository
Browse code

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)
  • Loading branch information...
commit 9e08a3bb1d47f79b6953056e72eee58e86d83ead 1 parent 4d2ccbb
David Heinemeier Hansson authored
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *2.3.0 [Edge]*
2 2
 
  3
+* 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]
  4
+
3 5
 * 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]
4 6
 
5 7
 * Switch from Test::Unit::TestCase to ActiveSupport::TestCase.  [Jeremy Kemper]
12  railties/lib/tasks/framework.rake
@@ -78,7 +78,7 @@ namespace :rails do
78 78
   end
79 79
 
80 80
   desc "Update both configs, scripts and public/javascripts from Rails"
81  
-  task :update => [ "update:scripts", "update:javascripts", "update:configs" ]
  81
+  task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:application_controller" ]
82 82
 
83 83
   namespace :update do
84 84
     desc "Add new scripts to the application script/ directory"
@@ -114,5 +114,15 @@ namespace :rails do
114 114
       require 'railties_path'  
115 115
       FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb')
116 116
     end
  117
+    
  118
+    desc "Rename application.rb to application_controller.rb"
  119
+    task :application_controller do
  120
+      old_style = RAILS_ROOT + '/app/controllers/application.rb'
  121
+      new_style = RAILS_ROOT + '/app/controllers/application_controller.rb'
  122
+      if File.exists?(old_style) && !File.exists?(new_style)
  123
+        FileUtils.mv(old_style, new_style)
  124
+        puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary"
  125
+      end
  126
+    end
117 127
   end
118 128
 end

0 notes on commit 9e08a3b

Please sign in to comment.
Something went wrong with that request. Please try again.