diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/console_app.rb | 1 | ||||
-rw-r--r-- | railties/lib/fcgi_handler.rb | 22 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 9 | ||||
-rw-r--r-- | railties/lib/rails/plugin/loader.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/template_runner.rb | 10 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb | 8 |
6 files changed, 28 insertions, 24 deletions
diff --git a/railties/lib/console_app.rb b/railties/lib/console_app.rb index 96bf3117c8..a35c96c957 100644 --- a/railties/lib/console_app.rb +++ b/railties/lib/console_app.rb @@ -25,7 +25,6 @@ end def reload! puts "Reloading..." dispatcher = ActionController::Dispatcher.new($stdout) - dispatcher.cleanup_application dispatcher.reload_application true end diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb index 1256ef2286..0cd2dc51c6 100644 --- a/railties/lib/fcgi_handler.rb +++ b/railties/lib/fcgi_handler.rb @@ -38,6 +38,8 @@ class RailsFCGIHandler # Safely install signal handlers. install_signal_handlers + @app = Dispatcher.new + # Start error timestamp at 11 seconds ago. @last_error_on = Time.now - 11 end @@ -69,36 +71,36 @@ class RailsFCGIHandler protected def process_each_request(provider) - cgi = nil + request = nil catch :exit do - provider.each_cgi do |cgi| - process_request(cgi) + provider.each do |request| + process_request(request) case when_ready when :reload reload! when :restart - close_connection(cgi) + close_connection(request) restart! when :exit - close_connection(cgi) + close_connection(request) throw :exit end end end rescue SignalException => signal raise unless signal.message == 'SIGUSR1' - close_connection(cgi) + close_connection(request) end - def process_request(cgi) + def process_request(request) @processing, @when_ready = true, nil gc_countdown with_signal_handler 'USR1' do begin - ::Rack::Handler::FastCGI.serve(cgi, Dispatcher.new) + ::Rack::Handler::FastCGI.serve(request, @app) rescue SignalException, SystemExit raise rescue Exception => error @@ -231,7 +233,7 @@ class RailsFCGIHandler end end - def close_connection(cgi) - cgi.instance_variable_get("@request").finish if cgi + def close_connection(request) + request.finish if request end end diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index cfd42544b6..a8b951ae58 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -369,11 +369,8 @@ Run `rake gems:install` to install the missing gems. def load_view_paths if configuration.frameworks.include?(:action_view) - if configuration.cache_classes - view_path = ActionView::Template::EagerPath.new(configuration.view_path) - ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) - ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) - end + ActionController::Base.view_paths.load! if configuration.frameworks.include?(:action_controller) + ActionMailer::Base.view_paths.load! if configuration.frameworks.include?(:action_mailer) end end @@ -481,7 +478,7 @@ Run `rake gems:install` to install the missing gems. # set to use Configuration#view_path. def initialize_framework_views if configuration.frameworks.include?(:action_view) - view_path = ActionView::Template::Path.new(configuration.view_path) + view_path = ActionView::PathSet.type_cast(configuration.view_path) ActionMailer::Base.template_root ||= view_path if configuration.frameworks.include?(:action_mailer) ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.empty? end diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index be81bdf4fa..bc0184c43d 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -175,7 +175,7 @@ module Rails def ensure_all_registered_plugins_are_loaded! if explicit_plugin_loading_order? if configuration.plugins.detect {|plugin| plugin != :all && !loaded?(plugin) } - missing_plugins = configuration.plugins - (plugins + [:all]) + missing_plugins = configuration.plugins - (plugins.map{|p| p.name.to_sym} + [:all]) raise LoadError, "Could not locate the following plugins: #{missing_plugins.to_sentence}" end end diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index 84e36ecc1b..eeb6b17661 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -75,7 +75,7 @@ module Rails end elsif options[:git] || options[:svn] in_root do - run("script/plugin install #{options[:svn] || options[:git]}", false) + run_ruby_script("script/plugin install #{options[:svn] || options[:git]}", false) end else log "! no git or svn provided for #{name}. skipping..." @@ -220,7 +220,7 @@ module Rails log 'generating', what argument = args.map(&:to_s).flatten.join(" ") - in_root { run("script/generate #{what} #{argument}", false) } + in_root { run_ruby_script("script/generate #{what} #{argument}", false) } end # Executes a command @@ -236,6 +236,12 @@ module Rails `#{command}` end + # Executes a ruby script (taking into account WIN32 platform quirks) + def run_ruby_script(command, log_action = true) + ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : '' + run("#{ruby_command}#{command}", log_action) + end + # Runs the supplied rake task # # ==== Example diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb index 2d9d635944..cd2fc578bf 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb @@ -21,23 +21,23 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase end test "should show <%= file_name %>" do - get :show, :id => <%= table_name %>(:one).id + get :show, :id => <%= table_name %>(:one).to_param assert_response :success end test "should get edit" do - get :edit, :id => <%= table_name %>(:one).id + get :edit, :id => <%= table_name %>(:one).to_param assert_response :success end test "should update <%= file_name %>" do - put :update, :id => <%= table_name %>(:one).id, :<%= file_name %> => { } + put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => { } assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>)) end test "should destroy <%= file_name %>" do assert_difference('<%= class_name %>.count', -1) do - delete :destroy, :id => <%= table_name %>(:one).id + delete :destroy, :id => <%= table_name %>(:one).to_param end assert_redirected_to <%= table_name %>_path |