From be098f840614bbb71fe26f0e2b4c064b6866c076 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Thu, 5 Feb 2009 20:39:52 -0600 Subject: Cleanup application has been merged with reload --- railties/lib/console_app.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'railties/lib') 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 -- cgit v1.2.3 From 2316e7dfb16518d4d0d92165bcd53b262080fc37 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 7 Feb 2009 00:25:07 -0600 Subject: Fix FCGI handler with lighttpd [#1854 state:resolved] --- railties/lib/fcgi_handler.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb index 1256ef2286..9e508cbcc2 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 @@ -72,8 +74,8 @@ class RailsFCGIHandler cgi = nil catch :exit do - provider.each_cgi do |cgi| - process_request(cgi) + provider.each do |request| + process_request(request) case when_ready when :reload @@ -92,13 +94,13 @@ class RailsFCGIHandler close_connection(cgi) 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 -- cgit v1.2.3 From f98d8ee72b2fd92bf0e09f3cade60add9efd3a15 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 7 Feb 2009 00:35:15 -0600 Subject: Fix up failing tests broke by 2316e7d --- railties/lib/fcgi_handler.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb index 9e508cbcc2..0cd2dc51c6 100644 --- a/railties/lib/fcgi_handler.rb +++ b/railties/lib/fcgi_handler.rb @@ -71,7 +71,7 @@ class RailsFCGIHandler protected def process_each_request(provider) - cgi = nil + request = nil catch :exit do provider.each do |request| @@ -81,17 +81,17 @@ class RailsFCGIHandler 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(request) @@ -233,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 -- cgit v1.2.3 From 893e9eb99504705419ad6edac14d00e71cef5f12 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 9 Feb 2009 14:20:30 -0600 Subject: Improve view rendering performance in development mode and reinstate template recompiling in production [#1909 state:resolved] Signed-off-by: Joshua Peek --- railties/lib/initializer.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index e3811dd8be..2cc0943b78 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -181,9 +181,6 @@ module Rails # Observers are loaded after plugins in case Observers or observed models are modified by plugins. load_observers - # Load view path cache - load_view_paths - # Load application classes load_application_classes @@ -367,16 +364,6 @@ Run `rake gems:install` to install the missing gems. end end - 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 - end - end - # Eager load application classes def load_application_classes return if $rails_rake_task -- cgit v1.2.3 From 5c63be1f92edcd3ed60fae90b8eb129da19c5099 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Feb 2009 14:53:14 -0600 Subject: Still need to setup view paths --- railties/lib/initializer.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 2cc0943b78..11aa8a534e 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -181,6 +181,9 @@ module Rails # Observers are loaded after plugins in case Observers or observed models are modified by plugins. load_observers + # Load view path cache + load_view_paths + # Load application classes load_application_classes @@ -364,6 +367,15 @@ Run `rake gems:install` to install the missing gems. end end + def load_view_paths + if configuration.frameworks.include?(:action_view) + if configuration.cache_classes + ActionController::Base.view_paths = configuration.view_path if configuration.frameworks.include?(:action_controller) + ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) + end + end + end + # Eager load application classes def load_application_classes return if $rails_rake_task -- cgit v1.2.3 From 1dab1d380377f1a2a60da43bc22989d55632d246 Mon Sep 17 00:00:00 2001 From: Gaspard Bucher Date: Tue, 10 Feb 2009 12:58:32 +0100 Subject: Fixes a typo in initializer.rb producing error: undefined local variable or method `view_path'. --- railties/lib/initializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 11aa8a534e..39140065b0 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -371,7 +371,7 @@ Run `rake gems:install` to install the missing gems. if configuration.frameworks.include?(:action_view) if configuration.cache_classes ActionController::Base.view_paths = configuration.view_path if configuration.frameworks.include?(:action_controller) - ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) + ActionMailer::Base.template_root = configuration.view_path if configuration.frameworks.include?(:action_mailer) end end end -- cgit v1.2.3 From 199e750d46c04970b5e7684998d09405648ecbd4 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 10 Feb 2009 12:09:49 -0600 Subject: Fix some edge cases when the same template is called with different local assigns Signed-off-by: Joshua Peek --- railties/lib/initializer.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 39140065b0..c4c55a97eb 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -369,10 +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 - ActionController::Base.view_paths = configuration.view_path if configuration.frameworks.include?(:action_controller) - ActionMailer::Base.template_root = configuration.view_path if configuration.frameworks.include?(:action_mailer) - end + ActionController::Base.view_paths.each { |path| path.load! } if configuration.frameworks.include?(:action_controller) + ActionMailer::Base.template_root.load! if configuration.frameworks.include?(:action_mailer) end end -- cgit v1.2.3 From 3942cb406e1d5db0ac00e03153809cc8dc4cc4db Mon Sep 17 00:00:00 2001 From: thedarkone Date: Thu, 12 Feb 2009 19:35:14 +0100 Subject: Port fast reloadable templates from rails-dev-boost. --- railties/lib/initializer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index c4c55a97eb..281b074e0a 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -369,8 +369,8 @@ Run `rake gems:install` to install the missing gems. def load_view_paths if configuration.frameworks.include?(:action_view) - ActionController::Base.view_paths.each { |path| path.load! } if configuration.frameworks.include?(:action_controller) - ActionMailer::Base.template_root.load! if configuration.frameworks.include?(:action_mailer) + ActionController::Base.view_paths.load! if configuration.frameworks.include?(:action_controller) + ActionMailer::Base.view_paths.load! if configuration.frameworks.include?(:action_mailer) end end @@ -478,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 -- cgit v1.2.3 From 0c956443964a20cbcc122e2d8c429b0cbb121828 Mon Sep 17 00:00:00 2001 From: Pat Nakajima Date: Sun, 8 Feb 2009 11:36:01 -0500 Subject: Changed scaffold generated controller tests to use #to_param. Before, the generated controller tests were calling #id, which can change over time, making for brittle tests. Signed-off-by: Michael Koziarski [#1913 state:committed] --- .../generators/components/scaffold/templates/functional_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/lib') 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 -- cgit v1.2.3 From a6508527570cd3f7225a7030218447bcc5824224 Mon Sep 17 00:00:00 2001 From: Oshoma Momoh Date: Mon, 9 Feb 2009 10:29:15 -0500 Subject: Fix loader's LoadError exception message to mention missing plugins and omit loaded plugins. Prior to this change the LoadError message listed all plugins if any one of them was missing. Signed-off-by: Michael Koziarski [#1921 state:committed] --- railties/lib/rails/plugin/loader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib') 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 -- cgit v1.2.3 From 2414fdb244cc0ba97620dd3f50e269d2e26c7392 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Feb 2009 13:03:47 +0000 Subject: Ensure template_runner can run script/* ruby scripts under Windows. [#1859 state:resolved] Signed-off-by: Pratik Naik --- .../generators/applications/app/template_runner.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'railties/lib') 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 -- cgit v1.2.3