From db045dbbf60b53dbe013ef25554fd013baf88134 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 24 Nov 2004 01:04:44 +0000 Subject: Initial git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 738 +++++++++++++++++++++ actionpack/MIT-LICENSE | 21 + actionpack/README | 418 ++++++++++++ actionpack/RUNNING_UNIT_TESTS | 25 + actionpack/Rakefile | 105 +++ actionpack/examples/.htaccess | 24 + actionpack/examples/address_book/index.rhtml | 33 + actionpack/examples/address_book/layout.rhtml | 8 + actionpack/examples/address_book_controller.cgi | 9 + actionpack/examples/address_book_controller.fcgi | 6 + actionpack/examples/address_book_controller.rb | 52 ++ actionpack/examples/address_book_controller.rbx | 4 + actionpack/examples/benchmark.rb | 52 ++ actionpack/examples/benchmark_with_ar.fcgi | 89 +++ actionpack/examples/blog_controller.cgi | 53 ++ actionpack/examples/debate/index.rhtml | 14 + actionpack/examples/debate/new_topic.rhtml | 22 + actionpack/examples/debate/topic.rhtml | 32 + actionpack/examples/debate_controller.cgi | 57 ++ actionpack/install.rb | 97 +++ actionpack/lib/action_controller.rb | 51 ++ .../assertions/action_pack_assertions.rb | 199 ++++++ .../assertions/active_record_assertions.rb | 65 ++ actionpack/lib/action_controller/base.rb | 689 +++++++++++++++++++ actionpack/lib/action_controller/benchmarking.rb | 49 ++ .../lib/action_controller/cgi_ext/cgi_ext.rb | 43 ++ .../lib/action_controller/cgi_ext/cgi_methods.rb | 91 +++ actionpack/lib/action_controller/cgi_process.rb | 124 ++++ actionpack/lib/action_controller/dependencies.rb | 49 ++ actionpack/lib/action_controller/filters.rb | 279 ++++++++ actionpack/lib/action_controller/flash.rb | 65 ++ actionpack/lib/action_controller/helpers.rb | 100 +++ actionpack/lib/action_controller/layout.rb | 149 +++++ actionpack/lib/action_controller/request.rb | 99 +++ actionpack/lib/action_controller/rescue.rb | 94 +++ actionpack/lib/action_controller/response.rb | 15 + actionpack/lib/action_controller/scaffolding.rb | 183 +++++ .../session/active_record_store.rb | 72 ++ .../lib/action_controller/session/drb_server.rb | 9 + .../lib/action_controller/session/drb_store.rb | 31 + .../support/class_attribute_accessors.rb | 57 ++ .../support/class_inheritable_attributes.rb | 37 ++ .../lib/action_controller/support/clean_logger.rb | 10 + .../support/cookie_performance_fix.rb | 121 ++++ .../lib/action_controller/support/inflector.rb | 78 +++ .../templates/rescues/_request_and_response.rhtml | 28 + .../templates/rescues/diagnostics.rhtml | 22 + .../templates/rescues/layout.rhtml | 29 + .../templates/rescues/missing_template.rhtml | 2 + .../templates/rescues/template_error.rhtml | 26 + .../templates/rescues/unknown_action.rhtml | 2 + .../templates/scaffolds/edit.rhtml | 6 + .../templates/scaffolds/layout.rhtml | 29 + .../templates/scaffolds/list.rhtml | 24 + .../templates/scaffolds/new.rhtml | 5 + .../templates/scaffolds/show.rhtml | 9 + actionpack/lib/action_controller/test_process.rb | 195 ++++++ actionpack/lib/action_controller/url_rewriter.rb | 170 +++++ actionpack/lib/action_view.rb | 49 ++ actionpack/lib/action_view/base.rb | 264 ++++++++ .../action_view/helpers/active_record_helper.rb | 171 +++++ actionpack/lib/action_view/helpers/date_helper.rb | 230 +++++++ actionpack/lib/action_view/helpers/debug_helper.rb | 17 + actionpack/lib/action_view/helpers/form_helper.rb | 182 +++++ .../lib/action_view/helpers/form_options_helper.rb | 212 ++++++ actionpack/lib/action_view/helpers/tag_helper.rb | 59 ++ actionpack/lib/action_view/helpers/text_helper.rb | 111 ++++ actionpack/lib/action_view/helpers/url_helper.rb | 78 +++ actionpack/lib/action_view/partials.rb | 64 ++ actionpack/lib/action_view/template_error.rb | 84 +++ actionpack/lib/action_view/vendor/builder.rb | 13 + .../lib/action_view/vendor/builder/blankslate.rb | 51 ++ .../lib/action_view/vendor/builder/xmlbase.rb | 143 ++++ .../lib/action_view/vendor/builder/xmlevents.rb | 63 ++ .../lib/action_view/vendor/builder/xmlmarkup.rb | 288 ++++++++ actionpack/test/abstract_unit.rb | 9 + .../test/controller/action_pack_assertions_test.rb | 323 +++++++++ .../controller/active_record_assertions_test.rb | 119 ++++ actionpack/test/controller/cgi_test.rb | 142 ++++ actionpack/test/controller/cookie_test.rb | 38 ++ actionpack/test/controller/filters_test.rb | 159 +++++ actionpack/test/controller/flash_test.rb | 69 ++ actionpack/test/controller/helper_test.rb | 110 +++ actionpack/test/controller/layout_test.rb | 49 ++ actionpack/test/controller/redirect_test.rb | 44 ++ actionpack/test/controller/render_test.rb | 178 +++++ actionpack/test/controller/send_file_test.rb | 68 ++ actionpack/test/controller/url_test.rb | 368 ++++++++++ actionpack/test/fixtures/helpers/abc_helper.rb | 5 + actionpack/test/fixtures/layouts/builder.rxml | 3 + actionpack/test/fixtures/layouts/standard.rhtml | 1 + actionpack/test/fixtures/scope/test/modgreet.rhtml | 1 + actionpack/test/fixtures/test/_customer.rhtml | 1 + actionpack/test/fixtures/test/greeting.rhtml | 1 + actionpack/test/fixtures/test/hello.rxml | 4 + actionpack/test/fixtures/test/hello_world.rhtml | 1 + actionpack/test/fixtures/test/hello_xml_world.rxml | 11 + actionpack/test/fixtures/test/list.rhtml | 1 + .../test/template/active_record_helper_test.rb | 76 +++ actionpack/test/template/date_helper_test.rb | 104 +++ actionpack/test/template/form_helper_test.rb | 124 ++++ .../test/template/form_options_helper_test.rb | 165 +++++ actionpack/test/template/tag_helper_test.rb | 18 + actionpack/test/template/text_helper_test.rb | 62 ++ actionpack/test/template/url_helper_test.rb | 49 ++ 105 files changed, 9547 insertions(+) create mode 100644 actionpack/CHANGELOG create mode 100644 actionpack/MIT-LICENSE create mode 100755 actionpack/README create mode 100644 actionpack/RUNNING_UNIT_TESTS create mode 100755 actionpack/Rakefile create mode 100644 actionpack/examples/.htaccess create mode 100644 actionpack/examples/address_book/index.rhtml create mode 100644 actionpack/examples/address_book/layout.rhtml create mode 100755 actionpack/examples/address_book_controller.cgi create mode 100755 actionpack/examples/address_book_controller.fcgi create mode 100644 actionpack/examples/address_book_controller.rb create mode 100644 actionpack/examples/address_book_controller.rbx create mode 100644 actionpack/examples/benchmark.rb create mode 100755 actionpack/examples/benchmark_with_ar.fcgi create mode 100755 actionpack/examples/blog_controller.cgi create mode 100644 actionpack/examples/debate/index.rhtml create mode 100644 actionpack/examples/debate/new_topic.rhtml create mode 100644 actionpack/examples/debate/topic.rhtml create mode 100755 actionpack/examples/debate_controller.cgi create mode 100644 actionpack/install.rb create mode 100755 actionpack/lib/action_controller.rb create mode 100644 actionpack/lib/action_controller/assertions/action_pack_assertions.rb create mode 100644 actionpack/lib/action_controller/assertions/active_record_assertions.rb create mode 100755 actionpack/lib/action_controller/base.rb create mode 100644 actionpack/lib/action_controller/benchmarking.rb create mode 100755 actionpack/lib/action_controller/cgi_ext/cgi_ext.rb create mode 100755 actionpack/lib/action_controller/cgi_ext/cgi_methods.rb create mode 100644 actionpack/lib/action_controller/cgi_process.rb create mode 100644 actionpack/lib/action_controller/dependencies.rb create mode 100644 actionpack/lib/action_controller/filters.rb create mode 100644 actionpack/lib/action_controller/flash.rb create mode 100644 actionpack/lib/action_controller/helpers.rb create mode 100644 actionpack/lib/action_controller/layout.rb create mode 100755 actionpack/lib/action_controller/request.rb create mode 100644 actionpack/lib/action_controller/rescue.rb create mode 100755 actionpack/lib/action_controller/response.rb create mode 100644 actionpack/lib/action_controller/scaffolding.rb create mode 100644 actionpack/lib/action_controller/session/active_record_store.rb create mode 100644 actionpack/lib/action_controller/session/drb_server.rb create mode 100644 actionpack/lib/action_controller/session/drb_store.rb create mode 100644 actionpack/lib/action_controller/support/class_attribute_accessors.rb create mode 100644 actionpack/lib/action_controller/support/class_inheritable_attributes.rb create mode 100644 actionpack/lib/action_controller/support/clean_logger.rb create mode 100644 actionpack/lib/action_controller/support/cookie_performance_fix.rb create mode 100644 actionpack/lib/action_controller/support/inflector.rb create mode 100644 actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/layout.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/missing_template.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/template_error.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/edit.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/layout.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/list.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/new.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/show.rhtml create mode 100644 actionpack/lib/action_controller/test_process.rb create mode 100644 actionpack/lib/action_controller/url_rewriter.rb create mode 100644 actionpack/lib/action_view.rb create mode 100644 actionpack/lib/action_view/base.rb create mode 100644 actionpack/lib/action_view/helpers/active_record_helper.rb create mode 100755 actionpack/lib/action_view/helpers/date_helper.rb create mode 100644 actionpack/lib/action_view/helpers/debug_helper.rb create mode 100644 actionpack/lib/action_view/helpers/form_helper.rb create mode 100644 actionpack/lib/action_view/helpers/form_options_helper.rb create mode 100644 actionpack/lib/action_view/helpers/tag_helper.rb create mode 100644 actionpack/lib/action_view/helpers/text_helper.rb create mode 100644 actionpack/lib/action_view/helpers/url_helper.rb create mode 100644 actionpack/lib/action_view/partials.rb create mode 100644 actionpack/lib/action_view/template_error.rb create mode 100644 actionpack/lib/action_view/vendor/builder.rb create mode 100644 actionpack/lib/action_view/vendor/builder/blankslate.rb create mode 100644 actionpack/lib/action_view/vendor/builder/xmlbase.rb create mode 100644 actionpack/lib/action_view/vendor/builder/xmlevents.rb create mode 100644 actionpack/lib/action_view/vendor/builder/xmlmarkup.rb create mode 100644 actionpack/test/abstract_unit.rb create mode 100644 actionpack/test/controller/action_pack_assertions_test.rb create mode 100644 actionpack/test/controller/active_record_assertions_test.rb create mode 100755 actionpack/test/controller/cgi_test.rb create mode 100644 actionpack/test/controller/cookie_test.rb create mode 100644 actionpack/test/controller/filters_test.rb create mode 100644 actionpack/test/controller/flash_test.rb create mode 100644 actionpack/test/controller/helper_test.rb create mode 100644 actionpack/test/controller/layout_test.rb create mode 100755 actionpack/test/controller/redirect_test.rb create mode 100644 actionpack/test/controller/render_test.rb create mode 100644 actionpack/test/controller/send_file_test.rb create mode 100644 actionpack/test/controller/url_test.rb create mode 100644 actionpack/test/fixtures/helpers/abc_helper.rb create mode 100644 actionpack/test/fixtures/layouts/builder.rxml create mode 100644 actionpack/test/fixtures/layouts/standard.rhtml create mode 100644 actionpack/test/fixtures/scope/test/modgreet.rhtml create mode 100644 actionpack/test/fixtures/test/_customer.rhtml create mode 100644 actionpack/test/fixtures/test/greeting.rhtml create mode 100644 actionpack/test/fixtures/test/hello.rxml create mode 100644 actionpack/test/fixtures/test/hello_world.rhtml create mode 100644 actionpack/test/fixtures/test/hello_xml_world.rxml create mode 100644 actionpack/test/fixtures/test/list.rhtml create mode 100644 actionpack/test/template/active_record_helper_test.rb create mode 100755 actionpack/test/template/date_helper_test.rb create mode 100644 actionpack/test/template/form_helper_test.rb create mode 100644 actionpack/test/template/form_options_helper_test.rb create mode 100644 actionpack/test/template/tag_helper_test.rb create mode 100644 actionpack/test/template/text_helper_test.rb create mode 100644 actionpack/test/template/url_helper_test.rb (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG new file mode 100644 index 0000000000..a422af3f0e --- /dev/null +++ b/actionpack/CHANGELOG @@ -0,0 +1,738 @@ +*CVS* + +* Upgraded to Builder 1.2.1 + +* Added :module as an alias for :controller_prefix to url_for and friends, so you can do redirect_to(:module => "shop", :controller => "purchases") + and go to /shop/purchases/ + +* Added support for controllers in modules through @params["module"]. + +* Added reloading for dependencies under cached environments like FastCGI and mod_ruby. This makes it possible to use those environments for development. + This is turned on by default, but can be turned off with ActionController::Base.reload_dependencies = false in production environments. + + NOTE: This will only have an effect if you use the new model, service, and observer class methods to mark dependencies. All libraries loaded through + require will be "forever" cached. You can, however, use ActionController::Base.load_or_require("library") to get this behavior outside of the new + dependency style. + +* Added that controllers will automatically require their own helper if possible. So instead of doing: + + class MsgController < AbstractApplicationController + helper :msg + end + + ...you can just do: + + class MsgController < AbstractApplicationController + end + +* Added dependencies_on(layer) to query the dependencies of a controller. Examples: + + MsgController.dependencies_on(:model) # => [ :post, :comment, :attachment ] + MsgController.dependencies_on(:service) # => [ :notification_service ] + MsgController.dependencies_on(:observer) # => [ :comment_observer ] + +* Added a new dependency model with the class methods model, service, and observer. Example: + + class MsgController < AbstractApplicationController + model :post, :comment, :attachment + service :notification_service + observer :comment_observer + end + + These new "keywords" remove the need for explicitly calling 'require' in most cases. The observer method even instantiates the + observer as well as requiring it. + +* Fixed that link_to would escape & in the url again after url_for already had done so + +*0.9.5* (28) + +* Added helper_method to designate that a given private or protected method you should available as a helper in the view. [bitsweat] + +* Fixed assert_rendered_file so it actually verifies if that was the rendered file [htonl] + +* Added the option for sharing partial spacer templates just like partials themselves [radsaq] + +* Fixed that Russia was named twice in country_select [alexey] + +* Fixed request_origin to use remote_ip instead of remote_addr [bitsweat] + +* Fixed link_to breakage when nil was passed for html_options [alexey] + +* Fixed redirect_to on a virtual server setup with apache with a port other than the default where it would forget the port number [seanohalpin] + +* Fixed that auto-loading webrick on Windows would cause file uploads to fail [bitsweat] + +* Fixed issues with sending files on WEBrick by setting the proper binmode [bitsweat] + +* Added send_data as an alternative to send_file when the stream is not read off the filesystem but from a database or generated live [bitsweat] + +* Added a new way to include helpers that doesn't require the include hack and can go without the explicit require. [bitsweat] + + Before: + + module WeblogHelper + def self.append_features(controller) #:nodoc: + controller.ancestors.include?(ActionController::Base) ? controller.add_template_helper(self) : super + end + end + + require 'weblog_helper' + class WeblogController < ActionController::Base + include WeblogHelper + end + + After: + + module WeblogHelper + end + + class WeblogController < ActionController::Base + helper :weblog + end + +* Added a default content-type of "text/xml" to .rxml renders [Ryan Platte] + +* Fixed that when /controller/index was requested by the browser, url_for would generates wrong URLs [Ryan Platte] + +* Fixed a bug that would share cookies between users when using FastCGI and mod_ruby [The Robot Co-op] + +* Added an optional third hash parameter to the process method in functional tests that takes the session data to be used [alexey] + +* Added UrlHelper#mail_to to make it easier to create mailto: style ahrefs + +* Added better error messages for layouts declared with the .rhtml extension (which they shouldn't) [geech] + +* Added another case to DateHelper#distance_in_minutes to return "less than a minute" instead of "0 minutes" and "1 minute" instead of "1 minutes" + +* Added a hidden field to checkboxes generated with FormHelper#check_box that will make sure that the unchecked value (usually 0) + is sent even if the checkbox is not checked. This relieves the controller from doing custom checking if the the checkbox wasn't + checked. BEWARE: This might conflict with your run-on-the-mill work-around code. [Tobias Luetke] + +* Fixed error_message_on to just use the first if more than one error had been added [marcel] + +* Fixed that URL rewriting with /controller/ was working but /controller was not and that you couldn't use :id on index [geech] + +* Fixed a bug with link_to where the :confirm option wouldn't be picked up if the link was a straight url instead of an option hash + +* Changed scaffolding of forms to use