diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-09-08 15:38:51 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-09-08 15:38:51 -0300 |
commit | 670281c6b2e9b9e8c51a140f2a5f66b251f1b84b (patch) | |
tree | ab141872d72e010c8a0fe371d22a00914c97e1eb | |
parent | 39e4e76d15233bb1cb0b778d920f54efe86bb4f0 (diff) | |
parent | 1a0f822037c408a392ffa7b6e1ecbe5951ab48db (diff) | |
download | rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.gz rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.bz2 rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record/associations.rb
101 files changed, 2115 insertions, 1239 deletions
diff --git a/.gitignore b/.gitignore index 43c4d7b124..7a61c37718 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,20 @@ +.DS_Store debug.log doc/rdoc +activemodel/doc activeresource/doc activerecord/doc actionpack/doc actionmailer/doc activesupport/doc +activemodel/pkg activeresource/pkg activerecord/pkg actionpack/pkg activemodel/test/fixtures/fixture_database.sqlite3 actionmailer/pkg activesupport/pkg +actionpack/test/tmp activesupport/test/fixtures/isolation_test railties/pkg railties/test/500.html diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 834e61e86e..4ced9cf308 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.autorequire = %q{action_mailer} - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Makes it trivial to test and deliver emails sent from a single service layer.} s.email = %q{david@loudthinking.com} s.files = ["Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE", "lib/action_mailer", "lib/action_mailer/adv_attr_accessor.rb", "lib/action_mailer/base.rb", "lib/action_mailer/helpers.rb", "lib/action_mailer/mail_helper.rb", "lib/action_mailer/part.rb", "lib/action_mailer/part_container.rb", "lib/action_mailer/quoting.rb", "lib/action_mailer/test_case.rb", "lib/action_mailer/test_helper.rb", "lib/action_mailer/utils.rb", "lib/action_mailer/vendor", "lib/action_mailer/vendor/text-format-0.6.3", "lib/action_mailer/vendor/text-format-0.6.3/text", "lib/action_mailer/vendor/text-format-0.6.3/text/format.rb", "lib/action_mailer/vendor/text_format.rb", "lib/action_mailer/vendor/tmail-1.2.3", "lib/action_mailer/vendor/tmail-1.2.3/tmail", "lib/action_mailer/vendor/tmail-1.2.3/tmail/address.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/base64.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/compat.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/config.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/core_extensions.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/encode.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/header.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/index.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/interface.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/loader.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/mail.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/mailbox.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/main.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/mbox.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/obsolete.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/port.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/require_arch.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner_r.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/stringio.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/utils.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail/version.rb", "lib/action_mailer/vendor/tmail-1.2.3/tmail.rb", "lib/action_mailer/vendor/tmail.rb", "lib/action_mailer/version.rb", "lib/action_mailer.rb", "lib/actionmailer.rb", "test/abstract_unit.rb", "test/adv_attr_test.rb", "test/asset_host_test.rb", "test/delivery_method_test.rb", "test/fixtures", "test/fixtures/asset_host_mailer", "test/fixtures/asset_host_mailer/email_with_asset.html.erb", "test/fixtures/auto_layout_mailer", "test/fixtures/auto_layout_mailer/hello.html.erb", "test/fixtures/auto_layout_mailer/multipart.html.erb", "test/fixtures/auto_layout_mailer/multipart.text.erb", "test/fixtures/explicit_layout_mailer", "test/fixtures/explicit_layout_mailer/logout.html.erb", "test/fixtures/explicit_layout_mailer/signup.html.erb", "test/fixtures/first_mailer", "test/fixtures/first_mailer/share.erb", "test/fixtures/helper_mailer", "test/fixtures/helper_mailer/use_example_helper.erb", "test/fixtures/helper_mailer/use_helper.erb", "test/fixtures/helper_mailer/use_helper_method.erb", "test/fixtures/helper_mailer/use_mail_helper.erb", "test/fixtures/helpers", "test/fixtures/helpers/example_helper.rb", "test/fixtures/layouts", "test/fixtures/layouts/auto_layout_mailer.html.erb", "test/fixtures/layouts/auto_layout_mailer.text.erb", "test/fixtures/layouts/spam.html.erb", "test/fixtures/path.with.dots", "test/fixtures/path.with.dots/funky_path_mailer", "test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb", "test/fixtures/raw_email", "test/fixtures/raw_email10", "test/fixtures/raw_email12", "test/fixtures/raw_email13", "test/fixtures/raw_email2", "test/fixtures/raw_email3", "test/fixtures/raw_email4", "test/fixtures/raw_email5", "test/fixtures/raw_email6", "test/fixtures/raw_email7", "test/fixtures/raw_email8", "test/fixtures/raw_email9", "test/fixtures/raw_email_quoted_with_0d0a", "test/fixtures/raw_email_with_invalid_characters_in_content_type", "test/fixtures/raw_email_with_nested_attachment", "test/fixtures/raw_email_with_partially_quoted_subject", "test/fixtures/second_mailer", "test/fixtures/second_mailer/share.erb", "test/fixtures/templates", "test/fixtures/templates/signed_up.erb", "test/fixtures/test_mailer", "test/fixtures/test_mailer/_subtemplate.text.erb", "test/fixtures/test_mailer/body_ivar.erb", "test/fixtures/test_mailer/custom_templating_extension.html.haml", "test/fixtures/test_mailer/custom_templating_extension.text.haml", "test/fixtures/test_mailer/implicitly_multipart_example.html.erb", "test/fixtures/test_mailer/implicitly_multipart_example.html.erb~", "test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb", "test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak", "test/fixtures/test_mailer/implicitly_multipart_example.text.erb", "test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb", "test/fixtures/test_mailer/included_subtemplate.text.erb", "test/fixtures/test_mailer/rxml_template.rxml", "test/fixtures/test_mailer/signed_up.html.erb", "test/fixtures/test_mailer/signed_up_with_url.erb", "test/mail_helper_test.rb", "test/mail_layout_test.rb", "test/mail_render_test.rb", "test/mail_service_test.rb", "test/quoting_test.rb", "test/test_helper_test.rb", "test/tmail_test.rb", "test/url_test.rb"] diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 5ecefe7c09..065c6c8ba1 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -489,7 +489,7 @@ module ActionMailer #:nodoc: # "the_template_file.text.html.erb", etc.). Only do this if parts # have not already been specified manually. # if @parts.empty? - template_root.find_all_by_parts(@template, {}, template_path).each do |template| + template_root.find_all(@template, {}, template_path).each do |template| @parts << Part.new( :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", :disposition => "inline", diff --git a/actionpack/Rakefile b/actionpack/Rakefile index 7b7a83d2fc..06f6905af0 100644 --- a/actionpack/Rakefile +++ b/actionpack/Rakefile @@ -116,6 +116,7 @@ spec = Gem::Specification.new do |s| s.requirements << 'none' s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD) + s.add_dependency('activemodel', '= 3.0.pre' + PKG_BUILD) s.add_dependency('rack', '~> 1.0.0') s.add_dependency('rack-test', '~> 0.4.2') diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index c38f8f67a2..b91993a12e 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -7,10 +7,10 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.autorequire = %q{action_controller} - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Eases web-request routing, handling, and response as a half-way front, half-way page controller. Implemented with specific emphasis on enabling easy unit/integration testing that doesn't require a browser.} s.email = %q{david@loudthinking.com} - s.files = ["Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "lib/abstract_controller", "lib/abstract_controller/base.rb", "lib/abstract_controller/benchmarker.rb", "lib/abstract_controller/callbacks.rb", "lib/abstract_controller/exceptions.rb", "lib/abstract_controller/helpers.rb", "lib/abstract_controller/layouts.rb", "lib/abstract_controller/logger.rb", "lib/abstract_controller/rendering_controller.rb", "lib/abstract_controller.rb", "lib/action_controller", "lib/action_controller/base.rb", "lib/action_controller/caching", "lib/action_controller/caching/actions.rb", "lib/action_controller/caching/fragments.rb", "lib/action_controller/caching/pages.rb", "lib/action_controller/caching/sweeping.rb", "lib/action_controller/caching.rb", "lib/action_controller/deprecated.rb", "lib/action_controller/dispatch", "lib/action_controller/dispatch/dispatcher.rb", "lib/action_controller/dispatch/middlewares.rb", "lib/action_controller/legacy", "lib/action_controller/legacy/layout.rb", "lib/action_controller/metal", "lib/action_controller/metal/compatibility.rb", "lib/action_controller/metal/conditional_get.rb", "lib/action_controller/metal/cookies.rb", "lib/action_controller/metal/exceptions.rb", "lib/action_controller/metal/filter_parameter_logging.rb", "lib/action_controller/metal/flash.rb", "lib/action_controller/metal/helpers.rb", "lib/action_controller/metal/hide_actions.rb", "lib/action_controller/metal/http_authentication.rb", "lib/action_controller/metal/layouts.rb", "lib/action_controller/metal/mime_responds.rb", "lib/action_controller/metal/rack_convenience.rb", "lib/action_controller/metal/redirector.rb", "lib/action_controller/metal/render_options.rb", "lib/action_controller/metal/rendering_controller.rb", "lib/action_controller/metal/request_forgery_protection.rb", "lib/action_controller/metal/rescuable.rb", "lib/action_controller/metal/responder.rb", "lib/action_controller/metal/session.rb", "lib/action_controller/metal/session_management.rb", "lib/action_controller/metal/streaming.rb", "lib/action_controller/metal/testing.rb", "lib/action_controller/metal/url_for.rb", "lib/action_controller/metal/verification.rb", "lib/action_controller/metal.rb", "lib/action_controller/middleware.rb", "lib/action_controller/record_identifier.rb", "lib/action_controller/routing", "lib/action_controller/routing/builder.rb", "lib/action_controller/routing/generation", "lib/action_controller/routing/generation/polymorphic_routes.rb", "lib/action_controller/routing/generation/url_rewriter.rb", "lib/action_controller/routing/optimisations.rb", "lib/action_controller/routing/recognition_optimisation.rb", "lib/action_controller/routing/resources.rb", "lib/action_controller/routing/route.rb", "lib/action_controller/routing/route_set.rb", "lib/action_controller/routing/routing_ext.rb", "lib/action_controller/routing/segments.rb", "lib/action_controller/routing.rb", "lib/action_controller/testing", "lib/action_controller/testing/integration.rb", "lib/action_controller/testing/performance_test.rb", "lib/action_controller/testing/process.rb", "lib/action_controller/testing/test_case.rb", "lib/action_controller/translation.rb", "lib/action_controller/vendor", "lib/action_controller/vendor/html-scanner", "lib/action_controller/vendor/html-scanner/html", "lib/action_controller/vendor/html-scanner/html/document.rb", "lib/action_controller/vendor/html-scanner/html/node.rb", "lib/action_controller/vendor/html-scanner/html/sanitizer.rb", "lib/action_controller/vendor/html-scanner/html/selector.rb", "lib/action_controller/vendor/html-scanner/html/tokenizer.rb", "lib/action_controller/vendor/html-scanner/html/version.rb", "lib/action_controller/vendor/html-scanner.rb", "lib/action_controller.rb", "lib/action_dispatch", "lib/action_dispatch/http", "lib/action_dispatch/http/headers.rb", "lib/action_dispatch/http/mime_type.rb", "lib/action_dispatch/http/mime_types.rb", "lib/action_dispatch/http/request.rb", "lib/action_dispatch/http/response.rb", "lib/action_dispatch/http/status_codes.rb", "lib/action_dispatch/middleware", "lib/action_dispatch/middleware/callbacks.rb", "lib/action_dispatch/middleware/params_parser.rb", "lib/action_dispatch/middleware/rescue.rb", "lib/action_dispatch/middleware/session", "lib/action_dispatch/middleware/session/abstract_store.rb", "lib/action_dispatch/middleware/session/cookie_store.rb", "lib/action_dispatch/middleware/session/mem_cache_store.rb", "lib/action_dispatch/middleware/show_exceptions.rb", "lib/action_dispatch/middleware/stack.rb", "lib/action_dispatch/middleware/templates", "lib/action_dispatch/middleware/templates/rescues", "lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb", "lib/action_dispatch/middleware/templates/rescues/_trace.erb", "lib/action_dispatch/middleware/templates/rescues/diagnostics.erb", "lib/action_dispatch/middleware/templates/rescues/layout.erb", "lib/action_dispatch/middleware/templates/rescues/missing_template.erb", "lib/action_dispatch/middleware/templates/rescues/routing_error.erb", "lib/action_dispatch/middleware/templates/rescues/template_error.erb", "lib/action_dispatch/middleware/templates/rescues/unknown_action.erb", "lib/action_dispatch/testing", "lib/action_dispatch/testing/assertions", "lib/action_dispatch/testing/assertions/dom.rb", "lib/action_dispatch/testing/assertions/model.rb", "lib/action_dispatch/testing/assertions/response.rb", "lib/action_dispatch/testing/assertions/routing.rb", "lib/action_dispatch/testing/assertions/selector.rb", "lib/action_dispatch/testing/assertions/tag.rb", "lib/action_dispatch/testing/assertions.rb", "lib/action_dispatch/testing/test_request.rb", "lib/action_dispatch/testing/test_response.rb", "lib/action_dispatch.rb", "lib/action_pack", "lib/action_pack/version.rb", "lib/action_pack.rb", "lib/action_view", "lib/action_view/base.rb", "lib/action_view/context.rb", "lib/action_view/erb", "lib/action_view/erb/util.rb", "lib/action_view/helpers", "lib/action_view/helpers/active_model_helper.rb", "lib/action_view/helpers/ajax_helper.rb", "lib/action_view/helpers/asset_tag_helper.rb", "lib/action_view/helpers/atom_feed_helper.rb", "lib/action_view/helpers/benchmark_helper.rb", "lib/action_view/helpers/cache_helper.rb", "lib/action_view/helpers/capture_helper.rb", "lib/action_view/helpers/date_helper.rb", "lib/action_view/helpers/debug_helper.rb", "lib/action_view/helpers/form_helper.rb", "lib/action_view/helpers/form_options_helper.rb", "lib/action_view/helpers/form_tag_helper.rb", "lib/action_view/helpers/javascript_helper.rb", "lib/action_view/helpers/number_helper.rb", "lib/action_view/helpers/prototype_helper.rb", "lib/action_view/helpers/record_identification_helper.rb", "lib/action_view/helpers/record_tag_helper.rb", "lib/action_view/helpers/sanitize_helper.rb", "lib/action_view/helpers/scriptaculous_helper.rb", "lib/action_view/helpers/tag_helper.rb", "lib/action_view/helpers/text_helper.rb", "lib/action_view/helpers/translation_helper.rb", "lib/action_view/helpers/url_helper.rb", "lib/action_view/helpers.rb", "lib/action_view/locale", "lib/action_view/locale/en.yml", "lib/action_view/paths.rb", "lib/action_view/render", "lib/action_view/render/partials.rb", "lib/action_view/render/rendering.rb", "lib/action_view/template", "lib/action_view/template/error.rb", "lib/action_view/template/handler.rb", "lib/action_view/template/handlers", "lib/action_view/template/handlers/builder.rb", "lib/action_view/template/handlers/erb.rb", "lib/action_view/template/handlers/rjs.rb", "lib/action_view/template/handlers.rb", "lib/action_view/template/inline.rb", "lib/action_view/template/partial.rb", "lib/action_view/template/renderable.rb", "lib/action_view/template/resolver.rb", "lib/action_view/template/template.rb", "lib/action_view/template/text.rb", "lib/action_view/test_case.rb", "lib/action_view.rb", "lib/actionpack.rb", "test/abstract_controller", "test/abstract_controller/abstract_controller_test.rb", "test/abstract_controller/callbacks_test.rb", "test/abstract_controller/helper_test.rb", "test/abstract_controller/layouts_test.rb", "test/abstract_controller/test_helper.rb", "test/abstract_controller/views", "test/abstract_controller/views/abstract_controller", "test/abstract_controller/views/abstract_controller/testing", "test/abstract_controller/views/abstract_controller/testing/me3", "test/abstract_controller/views/abstract_controller/testing/me3/formatted.html.erb", "test/abstract_controller/views/abstract_controller/testing/me3/index.erb", "test/abstract_controller/views/abstract_controller/testing/me4", "test/abstract_controller/views/abstract_controller/testing/me4/index.erb", "test/abstract_controller/views/abstract_controller/testing/me5", "test/abstract_controller/views/abstract_controller/testing/me5/index.erb", "test/abstract_controller/views/action_with_ivars.erb", "test/abstract_controller/views/helper_test.erb", "test/abstract_controller/views/index.erb", "test/abstract_controller/views/layouts", "test/abstract_controller/views/layouts/abstract_controller", "test/abstract_controller/views/layouts/abstract_controller/testing", "test/abstract_controller/views/layouts/abstract_controller/testing/me4.erb", "test/abstract_controller/views/layouts/application.erb", "test/abstract_controller/views/naked_render.erb", "test/abstract_unit.rb", "test/activerecord", "test/activerecord/active_record_store_test.rb", "test/activerecord/polymorphic_routes_test.rb", "test/activerecord/render_partial_with_record_identification_test.rb", "test/controller", "test/controller/action_pack_assertions_test.rb", "test/controller/addresses_render_test.rb", "test/controller/assert_select_test.rb", "test/controller/base_test.rb", "test/controller/benchmark_test.rb", "test/controller/caching_test.rb", "test/controller/capture_test.rb", "test/controller/content_type_test.rb", "test/controller/controller_fixtures", "test/controller/controller_fixtures/app", "test/controller/controller_fixtures/app/controllers", "test/controller/controller_fixtures/app/controllers/admin", "test/controller/controller_fixtures/app/controllers/admin/user_controller.rb", "test/controller/controller_fixtures/app/controllers/user_controller.rb", "test/controller/controller_fixtures/vendor", "test/controller/controller_fixtures/vendor/plugins", "test/controller/controller_fixtures/vendor/plugins/bad_plugin", "test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib", "test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb", "test/controller/cookie_test.rb", "test/controller/deprecation", "test/controller/deprecation/deprecated_base_methods_test.rb", "test/controller/dispatcher_test.rb", "test/controller/filter_params_test.rb", "test/controller/filters_test.rb", "test/controller/flash_test.rb", "test/controller/helper_test.rb", "test/controller/http_basic_authentication_test.rb", "test/controller/http_digest_authentication_test.rb", "test/controller/integration_test.rb", "test/controller/layout_test.rb", "test/controller/logging_test.rb", "test/controller/mime_responds_test.rb", "test/controller/record_identifier_test.rb", "test/controller/redirect_test.rb", "test/controller/render_js_test.rb", "test/controller/render_json_test.rb", "test/controller/render_other_test.rb", "test/controller/render_test.rb", "test/controller/render_xml_test.rb", "test/controller/request", "test/controller/request/test_request_test.rb", "test/controller/request_forgery_protection_test.rb", "test/controller/rescue_test.rb", "test/controller/resources_test.rb", "test/controller/routing_test.rb", "test/controller/selector_test.rb", "test/controller/send_file_test.rb", "test/controller/test_test.rb", "test/controller/translation_test.rb", "test/controller/url_rewriter_test.rb", "test/controller/verification_test.rb", "test/controller/view_paths_test.rb", "test/controller/webservice_test.rb", "test/dispatch", "test/dispatch/header_test.rb", "test/dispatch/middleware_stack_test.rb", "test/dispatch/mime_type_test.rb", "test/dispatch/rack_test.rb", "test/dispatch/request", "test/dispatch/request/json_params_parsing_test.rb", "test/dispatch/request/multipart_params_parsing_test.rb", "test/dispatch/request/query_string_parsing_test.rb", "test/dispatch/request/url_encoded_params_parsing_test.rb", "test/dispatch/request/xml_params_parsing_test.rb", "test/dispatch/request_test.rb", "test/dispatch/response_test.rb", "test/dispatch/session", "test/dispatch/session/cookie_store_test.rb", "test/dispatch/session/mem_cache_store_test.rb", "test/dispatch/session/test_session_test.rb", "test/dispatch/show_exceptions_test.rb", "test/dispatch/test_request_test.rb", "test/fixtures", "test/fixtures/_top_level_partial.html.erb", "test/fixtures/_top_level_partial_only.erb", "test/fixtures/addresses", "test/fixtures/addresses/list.erb", "test/fixtures/alternate_helpers", "test/fixtures/alternate_helpers/foo_helper.rb", "test/fixtures/bad_customers", "test/fixtures/bad_customers/_bad_customer.html.erb", "test/fixtures/companies.yml", "test/fixtures/company.rb", "test/fixtures/content_type", "test/fixtures/content_type/render_default_content_types_for_respond_to.xml.erb", "test/fixtures/content_type/render_default_for_rhtml.rhtml", "test/fixtures/content_type/render_default_for_rjs.rjs", "test/fixtures/content_type/render_default_for_rxml.rxml", "test/fixtures/customers", "test/fixtures/customers/_customer.html.erb", "test/fixtures/db_definitions", "test/fixtures/db_definitions/sqlite.sql", "test/fixtures/developer.rb", "test/fixtures/developers", "test/fixtures/developers/_developer.erb", "test/fixtures/developers.yml", "test/fixtures/developers_projects.yml", "test/fixtures/fun", "test/fixtures/fun/games", "test/fixtures/fun/games/_game.erb", "test/fixtures/fun/games/hello_world.erb", "test/fixtures/fun/serious", "test/fixtures/fun/serious/games", "test/fixtures/fun/serious/games/_game.erb", "test/fixtures/functional_caching", "test/fixtures/functional_caching/_partial.erb", "test/fixtures/functional_caching/formatted_fragment_cached.html.erb", "test/fixtures/functional_caching/formatted_fragment_cached.js.rjs", "test/fixtures/functional_caching/formatted_fragment_cached.xml.builder", "test/fixtures/functional_caching/fragment_cached.html.erb", "test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb", "test/fixtures/functional_caching/inline_fragment_cached.html.erb", "test/fixtures/functional_caching/js_fragment_cached_with_partial.js.rjs", "test/fixtures/good_customers", "test/fixtures/good_customers/_good_customer.html.erb", "test/fixtures/happy_path", "test/fixtures/happy_path/render_action", "test/fixtures/happy_path/render_action/hello_world.erb", "test/fixtures/helpers", "test/fixtures/helpers/abc_helper.rb", "test/fixtures/helpers/fun", "test/fixtures/helpers/fun/games_helper.rb", "test/fixtures/helpers/fun/pdf_helper.rb", "test/fixtures/layout_tests", "test/fixtures/layout_tests/alt", "test/fixtures/layout_tests/alt/hello.rhtml", "test/fixtures/layout_tests/alt/layouts", "test/fixtures/layout_tests/alt/layouts/alt.rhtml", "test/fixtures/layout_tests/layouts", "test/fixtures/layout_tests/layouts/controller_name_space", "test/fixtures/layout_tests/layouts/controller_name_space/nested.rhtml", "test/fixtures/layout_tests/layouts/item.rhtml", "test/fixtures/layout_tests/layouts/layout_test.rhtml", "test/fixtures/layout_tests/layouts/multiple_extensions.html.erb", "test/fixtures/layout_tests/layouts/symlinked", "test/fixtures/layout_tests/layouts/third_party_template_library.mab", "test/fixtures/layout_tests/views", "test/fixtures/layout_tests/views/goodbye.rhtml", "test/fixtures/layout_tests/views/hello.rhtml", "test/fixtures/layouts", "test/fixtures/layouts/_column.html.erb", "test/fixtures/layouts/block_with_layout.erb", "test/fixtures/layouts/builder.builder", "test/fixtures/layouts/partial_with_layout.erb", "test/fixtures/layouts/standard.html.erb", "test/fixtures/layouts/talk_from_action.erb", "test/fixtures/layouts/xhr.html.erb", "test/fixtures/layouts/yield.erb", "test/fixtures/mascot.rb", "test/fixtures/mascots", "test/fixtures/mascots/_mascot.html.erb", "test/fixtures/mascots.yml", "test/fixtures/multipart", "test/fixtures/multipart/binary_file", "test/fixtures/multipart/boundary_problem_file", "test/fixtures/multipart/bracketed_param", "test/fixtures/multipart/empty", "test/fixtures/multipart/hello.txt", "test/fixtures/multipart/large_text_file", "test/fixtures/multipart/mixed_files", "test/fixtures/multipart/mona_lisa.jpg", "test/fixtures/multipart/none", "test/fixtures/multipart/single_parameter", "test/fixtures/multipart/text_file", "test/fixtures/override", "test/fixtures/override/test", "test/fixtures/override/test/hello_world.erb", "test/fixtures/override2", "test/fixtures/override2/layouts", "test/fixtures/override2/layouts/test", "test/fixtures/override2/layouts/test/sub.erb", "test/fixtures/post_test", "test/fixtures/post_test/layouts", "test/fixtures/post_test/layouts/post.html.erb", "test/fixtures/post_test/layouts/super_post.iphone.erb", "test/fixtures/post_test/post", "test/fixtures/post_test/post/index.html.erb", "test/fixtures/post_test/post/index.iphone.erb", "test/fixtures/post_test/super_post", "test/fixtures/post_test/super_post/index.html.erb", "test/fixtures/post_test/super_post/index.iphone.erb", "test/fixtures/project.rb", "test/fixtures/projects", "test/fixtures/projects/_project.erb", "test/fixtures/projects.yml", "test/fixtures/public", "test/fixtures/public/404.html", "test/fixtures/public/500.da.html", "test/fixtures/public/500.html", "test/fixtures/public/absolute", "test/fixtures/public/absolute/test.css", "test/fixtures/public/absolute/test.js", "test/fixtures/public/elsewhere", "test/fixtures/public/elsewhere/cools.js", "test/fixtures/public/elsewhere/file.css", "test/fixtures/public/images", "test/fixtures/public/images/rails.png", "test/fixtures/public/javascripts", "test/fixtures/public/javascripts/application.js", "test/fixtures/public/javascripts/bank.js", "test/fixtures/public/javascripts/cache", "test/fixtures/public/javascripts/common.javascript", "test/fixtures/public/javascripts/controls.js", "test/fixtures/public/javascripts/dragdrop.js", "test/fixtures/public/javascripts/effects.js", "test/fixtures/public/javascripts/prototype.js", "test/fixtures/public/javascripts/robber.js", "test/fixtures/public/javascripts/subdir", "test/fixtures/public/javascripts/subdir/subdir.js", "test/fixtures/public/javascripts/version.1.0.js", "test/fixtures/public/stylesheets", "test/fixtures/public/stylesheets/bank.css", "test/fixtures/public/stylesheets/random.styles", "test/fixtures/public/stylesheets/robber.css", "test/fixtures/public/stylesheets/subdir", "test/fixtures/public/stylesheets/subdir/subdir.css", "test/fixtures/public/stylesheets/version.1.0.css", "test/fixtures/quiz", "test/fixtures/quiz/questions", "test/fixtures/quiz/questions/_question.html.erb", "test/fixtures/replies", "test/fixtures/replies/_reply.erb", "test/fixtures/replies.yml", "test/fixtures/reply.rb", "test/fixtures/respond_to", "test/fixtures/respond_to/all_types_with_layout.html.erb", "test/fixtures/respond_to/all_types_with_layout.js.rjs", "test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb", "test/fixtures/respond_to/iphone_with_html_response_type.html.erb", "test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb", "test/fixtures/respond_to/layouts", "test/fixtures/respond_to/layouts/missing.html.erb", "test/fixtures/respond_to/layouts/standard.html.erb", "test/fixtures/respond_to/layouts/standard.iphone.erb", "test/fixtures/respond_to/using_defaults.html.erb", "test/fixtures/respond_to/using_defaults.js.rjs", "test/fixtures/respond_to/using_defaults.xml.builder", "test/fixtures/respond_to/using_defaults_with_type_list.html.erb", "test/fixtures/respond_to/using_defaults_with_type_list.js.rjs", "test/fixtures/respond_to/using_defaults_with_type_list.xml.builder", "test/fixtures/respond_with", "test/fixtures/respond_with/edit.html.erb", "test/fixtures/respond_with/new.html.erb", "test/fixtures/respond_with/using_defaults.html.erb", "test/fixtures/respond_with/using_defaults.js.rjs", "test/fixtures/respond_with/using_defaults_with_type_list.js.rjs", "test/fixtures/respond_with/using_defaults_with_type_list.xml.builder", "test/fixtures/respond_with/using_resource.js.rjs", "test/fixtures/scope", "test/fixtures/scope/test", "test/fixtures/scope/test/modgreet.erb", "test/fixtures/shared.html.erb", "test/fixtures/symlink_parent", "test/fixtures/symlink_parent/symlinked_layout.erb", "test/fixtures/test", "test/fixtures/test/_counter.html.erb", "test/fixtures/test/_customer.erb", "test/fixtures/test/_customer_counter.erb", "test/fixtures/test/_customer_greeting.erb", "test/fixtures/test/_customer_with_var.erb", "test/fixtures/test/_form.erb", "test/fixtures/test/_hash_greeting.erb", "test/fixtures/test/_hash_object.erb", "test/fixtures/test/_hello.builder", "test/fixtures/test/_labelling_form.erb", "test/fixtures/test/_layout_for_block_with_args.html.erb", "test/fixtures/test/_layout_for_partial.html.erb", "test/fixtures/test/_local_inspector.html.erb", "test/fixtures/test/_one.html.erb", "test/fixtures/test/_partial.erb", "test/fixtures/test/_partial.html.erb", "test/fixtures/test/_partial.js.erb", "test/fixtures/test/_partial_for_use_in_layout.html.erb", "test/fixtures/test/_partial_only.erb", "test/fixtures/test/_partial_with_only_html_version.html.erb", "test/fixtures/test/_person.erb", "test/fixtures/test/_raise.html.erb", "test/fixtures/test/_two.html.erb", "test/fixtures/test/action_talk_to_layout.erb", "test/fixtures/test/basic.html.erb", "test/fixtures/test/calling_partial_with_layout.html.erb", "test/fixtures/test/capturing.erb", "test/fixtures/test/content_for.erb", "test/fixtures/test/content_for_concatenated.erb", "test/fixtures/test/content_for_with_parameter.erb", "test/fixtures/test/delete_with_js.rjs", "test/fixtures/test/dont_pick_me", "test/fixtures/test/dot.directory", "test/fixtures/test/dot.directory/render_file_with_ivar.erb", "test/fixtures/test/enum_rjs_test.rjs", "test/fixtures/test/formatted_html_erb.html.erb", "test/fixtures/test/formatted_xml_erb.builder", "test/fixtures/test/formatted_xml_erb.html.erb", "test/fixtures/test/formatted_xml_erb.xml.erb", "test/fixtures/test/greeting.html.erb", "test/fixtures/test/greeting.js.rjs", "test/fixtures/test/greeting.xml.erb", "test/fixtures/test/hello.builder", "test/fixtures/test/hello_world.da.html.erb", "test/fixtures/test/hello_world.erb", "test/fixtures/test/hello_world.erb~", "test/fixtures/test/hello_world.pt-BR.html.erb", "test/fixtures/test/hello_world_container.builder", "test/fixtures/test/hello_world_from_rxml.builder", "test/fixtures/test/hello_world_with_layout_false.erb", "test/fixtures/test/hello_xml_world.builder", "test/fixtures/test/hyphen-ated.erb", "test/fixtures/test/implicit_content_type.atom.builder", "test/fixtures/test/list.erb", "test/fixtures/test/malformed", "test/fixtures/test/malformed/malformed.en.html.erb~", "test/fixtures/test/malformed/malformed.erb~", "test/fixtures/test/malformed/malformed.html.erb~", "test/fixtures/test/nested_layout.erb", "test/fixtures/test/non_erb_block_content_for.builder", "test/fixtures/test/potential_conflicts.erb", "test/fixtures/test/render_explicit_html_template.js.rjs", "test/fixtures/test/render_file_from_template.html.erb", "test/fixtures/test/render_file_with_ivar.erb", "test/fixtures/test/render_file_with_locals.erb", "test/fixtures/test/render_file_with_locals_and_default.erb", "test/fixtures/test/render_implicit_html_template.js.rjs", "test/fixtures/test/render_implicit_html_template_from_xhr_request.da.html.erb", "test/fixtures/test/render_implicit_html_template_from_xhr_request.html.erb", "test/fixtures/test/render_implicit_js_template_without_layout.js.erb", "test/fixtures/test/render_to_string_test.erb", "test/fixtures/test/sub_template_raise.html.erb", "test/fixtures/test/template.erb", "test/fixtures/test/update_element_with_capture.erb", "test/fixtures/test/using_layout_around_block.html.erb", "test/fixtures/test/utf8.html.erb", "test/fixtures/test/utf8_magic.html.erb", "test/fixtures/topic.rb", "test/fixtures/topics", "test/fixtures/topics/_topic.html.erb", "test/fixtures/topics.yml", "test/html-scanner", "test/html-scanner/cdata_node_test.rb", "test/html-scanner/document_test.rb", "test/html-scanner/node_test.rb", "test/html-scanner/sanitizer_test.rb", "test/html-scanner/tag_node_test.rb", "test/html-scanner/text_node_test.rb", "test/html-scanner/tokenizer_test.rb", "test/javascript", "test/javascript/ajax_test.rb", "test/lib", "test/lib/active_record_unit.rb", "test/lib/controller", "test/lib/controller/fake_controllers.rb", "test/lib/controller/fake_models.rb", "test/lib/fixture_template.rb", "test/lib/testing_sandbox.rb", "test/new_base", "test/new_base/base_test.rb", "test/new_base/content_type_test.rb", "test/new_base/etag_test.rb", "test/new_base/metal_test.rb", "test/new_base/redirect_test.rb", "test/new_base/render_action_test.rb", "test/new_base/render_file_test.rb", "test/new_base/render_implicit_action_test.rb", "test/new_base/render_layout_test.rb", "test/new_base/render_partial_test.rb", "test/new_base/render_rjs_test.rb", "test/new_base/render_template_test.rb", "test/new_base/render_test.rb", "test/new_base/render_text_test.rb", "test/new_base/render_xml_test.rb", "test/new_base/test_helper.rb", "test/old_base", "test/old_base/abstract_unit.rb", "test/runner", "test/template", "test/template/active_record_helper_i18n_test.rb", "test/template/active_record_helper_test.rb", "test/template/asset_tag_helper_test.rb", "test/template/atom_feed_helper_test.rb", "test/template/benchmark_helper_test.rb", "test/template/body_parts_test.rb", "test/template/capture_helper_test.rb", "test/template/compiled_templates_test.rb", "test/template/date_helper_i18n_test.rb", "test/template/date_helper_test.rb", "test/template/erb_util_test.rb", "test/template/form_helper_test.rb", "test/template/form_options_helper_i18n_test.rb", "test/template/form_options_helper_test.rb", "test/template/form_tag_helper_test.rb", "test/template/javascript_helper_test.rb", "test/template/number_helper_i18n_test.rb", "test/template/number_helper_test.rb", "test/template/output_buffer_test.rb", "test/template/prototype_helper_test.rb", "test/template/record_tag_helper_test.rb", "test/template/render_test.rb", "test/template/sanitize_helper_test.rb", "test/template/scriptaculous_helper_test.rb", "test/template/tag_helper_test.rb", "test/template/test_test.rb", "test/template/text_helper_test.rb", "test/template/translation_helper_test.rb", "test/template/url_helper_test.rb", "test/tmp", "test/view", "test/view/test_case_test.rb"] + s.files = ["Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "lib/abstract_controller", "lib/abstract_controller/base.rb", "lib/abstract_controller/benchmarker.rb", "lib/abstract_controller/callbacks.rb", "lib/abstract_controller/exceptions.rb", "lib/abstract_controller/helpers.rb", "lib/abstract_controller/layouts.rb", "lib/abstract_controller/logger.rb", "lib/abstract_controller/rendering_controller.rb", "lib/abstract_controller.rb", "lib/action_controller", "lib/action_controller/base.rb", "lib/action_controller/caching", "lib/action_controller/caching/actions.rb", "lib/action_controller/caching/fragments.rb", "lib/action_controller/caching/pages.rb", "lib/action_controller/caching/sweeping.rb", "lib/action_controller/caching.rb", "lib/action_controller/deprecated.rb", "lib/action_controller/dispatch", "lib/action_controller/dispatch/dispatcher.rb", "lib/action_controller/dispatch/middlewares.rb", "lib/action_controller/legacy", "lib/action_controller/legacy/layout.rb", "lib/action_controller/metal", "lib/action_controller/metal/compatibility.rb", "lib/action_controller/metal/conditional_get.rb", "lib/action_controller/metal/cookies.rb", "lib/action_controller/metal/exceptions.rb", "lib/action_controller/metal/filter_parameter_logging.rb", "lib/action_controller/metal/flash.rb", "lib/action_controller/metal/helpers.rb", "lib/action_controller/metal/hide_actions.rb", "lib/action_controller/metal/http_authentication.rb", "lib/action_controller/metal/layouts.rb", "lib/action_controller/metal/mime_responds.rb", "lib/action_controller/metal/rack_convenience.rb", "lib/action_controller/metal/redirector.rb", "lib/action_controller/metal/render_options.rb", "lib/action_controller/metal/rendering_controller.rb", "lib/action_controller/metal/request_forgery_protection.rb", "lib/action_controller/metal/rescuable.rb", "lib/action_controller/metal/responder.rb", "lib/action_controller/metal/session.rb", "lib/action_controller/metal/session_management.rb", "lib/action_controller/metal/streaming.rb", "lib/action_controller/metal/testing.rb", "lib/action_controller/metal/url_for.rb", "lib/action_controller/metal/verification.rb", "lib/action_controller/metal.rb", "lib/action_controller/middleware.rb", "lib/action_controller/record_identifier.rb", "lib/action_controller/routing", "lib/action_controller/routing/builder.rb", "lib/action_controller/routing/generation", "lib/action_controller/routing/generation/polymorphic_routes.rb", "lib/action_controller/routing/generation/url_rewriter.rb", "lib/action_controller/routing/optimisations.rb", "lib/action_controller/routing/recognition_optimisation.rb", "lib/action_controller/routing/resources.rb", "lib/action_controller/routing/route.rb", "lib/action_controller/routing/route_set.rb", "lib/action_controller/routing/routing_ext.rb", "lib/action_controller/routing/segments.rb", "lib/action_controller/routing.rb", "lib/action_controller/testing", "lib/action_controller/testing/integration.rb", "lib/action_controller/testing/performance_test.rb", "lib/action_controller/testing/process.rb", "lib/action_controller/testing/test_case.rb", "lib/action_controller/translation.rb", "lib/action_controller/vendor", "lib/action_controller/vendor/html-scanner", "lib/action_controller/vendor/html-scanner/html", "lib/action_controller/vendor/html-scanner/html/document.rb", "lib/action_controller/vendor/html-scanner/html/node.rb", "lib/action_controller/vendor/html-scanner/html/sanitizer.rb", "lib/action_controller/vendor/html-scanner/html/selector.rb", "lib/action_controller/vendor/html-scanner/html/tokenizer.rb", "lib/action_controller/vendor/html-scanner/html/version.rb", "lib/action_controller/vendor/html-scanner.rb", "lib/action_controller.rb", "lib/action_dispatch", "lib/action_dispatch/http", "lib/action_dispatch/http/headers.rb", "lib/action_dispatch/http/mime_type.rb", "lib/action_dispatch/http/mime_types.rb", "lib/action_dispatch/http/request.rb", "lib/action_dispatch/http/response.rb", "lib/action_dispatch/http/status_codes.rb", "lib/action_dispatch/middleware", "lib/action_dispatch/middleware/callbacks.rb", "lib/action_dispatch/middleware/params_parser.rb", "lib/action_dispatch/middleware/rescue.rb", "lib/action_dispatch/middleware/session", "lib/action_dispatch/middleware/session/abstract_store.rb", "lib/action_dispatch/middleware/session/cookie_store.rb", "lib/action_dispatch/middleware/session/mem_cache_store.rb", "lib/action_dispatch/middleware/show_exceptions.rb", "lib/action_dispatch/middleware/stack.rb", "lib/action_dispatch/middleware/templates", "lib/action_dispatch/middleware/templates/rescues", "lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb", "lib/action_dispatch/middleware/templates/rescues/_trace.erb", "lib/action_dispatch/middleware/templates/rescues/diagnostics.erb", "lib/action_dispatch/middleware/templates/rescues/layout.erb", "lib/action_dispatch/middleware/templates/rescues/missing_template.erb", "lib/action_dispatch/middleware/templates/rescues/routing_error.erb", "lib/action_dispatch/middleware/templates/rescues/template_error.erb", "lib/action_dispatch/middleware/templates/rescues/unknown_action.erb", "lib/action_dispatch/testing", "lib/action_dispatch/testing/assertions", "lib/action_dispatch/testing/assertions/dom.rb", "lib/action_dispatch/testing/assertions/model.rb", "lib/action_dispatch/testing/assertions/response.rb", "lib/action_dispatch/testing/assertions/routing.rb", "lib/action_dispatch/testing/assertions/selector.rb", "lib/action_dispatch/testing/assertions/tag.rb", "lib/action_dispatch/testing/assertions.rb", "lib/action_dispatch/testing/test_request.rb", "lib/action_dispatch/testing/test_response.rb", "lib/action_dispatch/vendor", "lib/action_dispatch/vendor/rack-1.1.pre", "lib/action_dispatch/vendor/rack-test", "lib/action_dispatch/vendor/rack-test/rack", "lib/action_dispatch.rb", "lib/action_pack", "lib/action_pack/version.rb", "lib/action_pack.rb", "lib/action_view", "lib/action_view/base.rb", "lib/action_view/context.rb", "lib/action_view/erb", "lib/action_view/erb/util.rb", "lib/action_view/helpers", "lib/action_view/helpers/active_model_helper.rb", "lib/action_view/helpers/ajax_helper.rb", "lib/action_view/helpers/asset_tag_helper.rb", "lib/action_view/helpers/atom_feed_helper.rb", "lib/action_view/helpers/benchmark_helper.rb", "lib/action_view/helpers/cache_helper.rb", "lib/action_view/helpers/capture_helper.rb", "lib/action_view/helpers/date_helper.rb", "lib/action_view/helpers/debug_helper.rb", "lib/action_view/helpers/form_helper.rb", "lib/action_view/helpers/form_options_helper.rb", "lib/action_view/helpers/form_tag_helper.rb", "lib/action_view/helpers/javascript_helper.rb", "lib/action_view/helpers/number_helper.rb", "lib/action_view/helpers/prototype_helper.rb", "lib/action_view/helpers/record_identification_helper.rb", "lib/action_view/helpers/record_tag_helper.rb", "lib/action_view/helpers/sanitize_helper.rb", "lib/action_view/helpers/scriptaculous_helper.rb", "lib/action_view/helpers/tag_helper.rb", "lib/action_view/helpers/text_helper.rb", "lib/action_view/helpers/translation_helper.rb", "lib/action_view/helpers/url_helper.rb", "lib/action_view/helpers.rb", "lib/action_view/locale", "lib/action_view/locale/en.yml", "lib/action_view/paths.rb", "lib/action_view/render", "lib/action_view/render/partials.rb", "lib/action_view/render/rendering.rb", "lib/action_view/template", "lib/action_view/template/error.rb", "lib/action_view/template/handler.rb", "lib/action_view/template/handlers", "lib/action_view/template/handlers/builder.rb", "lib/action_view/template/handlers/erb.rb", "lib/action_view/template/handlers/rjs.rb", "lib/action_view/template/handlers.rb", "lib/action_view/template/inline.rb", "lib/action_view/template/partial.rb", "lib/action_view/template/renderable.rb", "lib/action_view/template/resolver.rb", "lib/action_view/template/template.rb", "lib/action_view/template/text.rb", "lib/action_view/test_case.rb", "lib/action_view.rb", "lib/actionpack.rb", "test/abstract_controller", "test/abstract_controller/abstract_controller_test.rb", "test/abstract_controller/callbacks_test.rb", "test/abstract_controller/helper_test.rb", "test/abstract_controller/layouts_test.rb", "test/abstract_controller/test_helper.rb", "test/abstract_controller/views", "test/abstract_controller/views/abstract_controller", "test/abstract_controller/views/abstract_controller/testing", "test/abstract_controller/views/abstract_controller/testing/me3", "test/abstract_controller/views/abstract_controller/testing/me3/formatted.html.erb", "test/abstract_controller/views/abstract_controller/testing/me3/index.erb", "test/abstract_controller/views/abstract_controller/testing/me4", "test/abstract_controller/views/abstract_controller/testing/me4/index.erb", "test/abstract_controller/views/abstract_controller/testing/me5", "test/abstract_controller/views/abstract_controller/testing/me5/index.erb", "test/abstract_controller/views/action_with_ivars.erb", "test/abstract_controller/views/helper_test.erb", "test/abstract_controller/views/index.erb", "test/abstract_controller/views/layouts", "test/abstract_controller/views/layouts/abstract_controller", "test/abstract_controller/views/layouts/abstract_controller/testing", "test/abstract_controller/views/layouts/abstract_controller/testing/me4.erb", "test/abstract_controller/views/layouts/application.erb", "test/abstract_controller/views/naked_render.erb", "test/abstract_unit.rb", "test/activerecord", "test/activerecord/active_record_store_test.rb", "test/activerecord/polymorphic_routes_test.rb", "test/activerecord/render_partial_with_record_identification_test.rb", "test/controller", "test/controller/action_pack_assertions_test.rb", "test/controller/addresses_render_test.rb", "test/controller/assert_select_test.rb", "test/controller/base_test.rb", "test/controller/benchmark_test.rb", "test/controller/caching_test.rb", "test/controller/capture_test.rb", "test/controller/content_type_test.rb", "test/controller/controller_fixtures", "test/controller/controller_fixtures/app", "test/controller/controller_fixtures/app/controllers", "test/controller/controller_fixtures/app/controllers/admin", "test/controller/controller_fixtures/app/controllers/admin/user_controller.rb", "test/controller/controller_fixtures/app/controllers/user_controller.rb", "test/controller/controller_fixtures/vendor", "test/controller/controller_fixtures/vendor/plugins", "test/controller/controller_fixtures/vendor/plugins/bad_plugin", "test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib", "test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb", "test/controller/cookie_test.rb", "test/controller/deprecation", "test/controller/deprecation/deprecated_base_methods_test.rb", "test/controller/dispatcher_test.rb", "test/controller/filter_params_test.rb", "test/controller/filters_test.rb", "test/controller/flash_test.rb", "test/controller/helper_test.rb", "test/controller/http_basic_authentication_test.rb", "test/controller/http_digest_authentication_test.rb", "test/controller/integration_test.rb", "test/controller/layout_test.rb", "test/controller/logging_test.rb", "test/controller/mime_responds_test.rb", "test/controller/record_identifier_test.rb", "test/controller/redirect_test.rb", "test/controller/render_js_test.rb", "test/controller/render_json_test.rb", "test/controller/render_other_test.rb", "test/controller/render_test.rb", "test/controller/render_xml_test.rb", "test/controller/request", "test/controller/request/test_request_test.rb", "test/controller/request_forgery_protection_test.rb", "test/controller/rescue_test.rb", "test/controller/resources_test.rb", "test/controller/routing_test.rb", "test/controller/selector_test.rb", "test/controller/send_file_test.rb", "test/controller/test_test.rb", "test/controller/translation_test.rb", "test/controller/url_rewriter_test.rb", "test/controller/verification_test.rb", "test/controller/view_paths_test.rb", "test/controller/webservice_test.rb", "test/dispatch", "test/dispatch/header_test.rb", "test/dispatch/middleware_stack_test.rb", "test/dispatch/mime_type_test.rb", "test/dispatch/rack_test.rb", "test/dispatch/request", "test/dispatch/request/json_params_parsing_test.rb", "test/dispatch/request/multipart_params_parsing_test.rb", "test/dispatch/request/query_string_parsing_test.rb", "test/dispatch/request/url_encoded_params_parsing_test.rb", "test/dispatch/request/xml_params_parsing_test.rb", "test/dispatch/request_test.rb", "test/dispatch/response_test.rb", "test/dispatch/session", "test/dispatch/session/cookie_store_test.rb", "test/dispatch/session/mem_cache_store_test.rb", "test/dispatch/session/test_session_test.rb", "test/dispatch/show_exceptions_test.rb", "test/dispatch/test_request_test.rb", "test/fixtures", "test/fixtures/_top_level_partial.html.erb", "test/fixtures/_top_level_partial_only.erb", "test/fixtures/addresses", "test/fixtures/addresses/list.erb", "test/fixtures/alternate_helpers", "test/fixtures/alternate_helpers/foo_helper.rb", "test/fixtures/bad_customers", "test/fixtures/bad_customers/_bad_customer.html.erb", "test/fixtures/companies.yml", "test/fixtures/company.rb", "test/fixtures/content_type", "test/fixtures/content_type/render_default_content_types_for_respond_to.xml.erb", "test/fixtures/content_type/render_default_for_rhtml.rhtml", "test/fixtures/content_type/render_default_for_rjs.rjs", "test/fixtures/content_type/render_default_for_rxml.rxml", "test/fixtures/customers", "test/fixtures/customers/_customer.html.erb", "test/fixtures/db_definitions", "test/fixtures/db_definitions/sqlite.sql", "test/fixtures/developer.rb", "test/fixtures/developers", "test/fixtures/developers/_developer.erb", "test/fixtures/developers.yml", "test/fixtures/developers_projects.yml", "test/fixtures/fun", "test/fixtures/fun/games", "test/fixtures/fun/games/_game.erb", "test/fixtures/fun/games/hello_world.erb", "test/fixtures/fun/serious", "test/fixtures/fun/serious/games", "test/fixtures/fun/serious/games/_game.erb", "test/fixtures/functional_caching", "test/fixtures/functional_caching/_partial.erb", "test/fixtures/functional_caching/formatted_fragment_cached.html.erb", "test/fixtures/functional_caching/formatted_fragment_cached.js.rjs", "test/fixtures/functional_caching/formatted_fragment_cached.xml.builder", "test/fixtures/functional_caching/fragment_cached.html.erb", "test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb", "test/fixtures/functional_caching/inline_fragment_cached.html.erb", "test/fixtures/functional_caching/js_fragment_cached_with_partial.js.rjs", "test/fixtures/good_customers", "test/fixtures/good_customers/_good_customer.html.erb", "test/fixtures/happy_path", "test/fixtures/happy_path/render_action", "test/fixtures/happy_path/render_action/hello_world.erb", "test/fixtures/helpers", "test/fixtures/helpers/abc_helper.rb", "test/fixtures/helpers/fun", "test/fixtures/helpers/fun/games_helper.rb", "test/fixtures/helpers/fun/pdf_helper.rb", "test/fixtures/layout_tests", "test/fixtures/layout_tests/alt", "test/fixtures/layout_tests/alt/hello.rhtml", "test/fixtures/layout_tests/alt/layouts", "test/fixtures/layout_tests/alt/layouts/alt.rhtml", "test/fixtures/layout_tests/layouts", "test/fixtures/layout_tests/layouts/controller_name_space", "test/fixtures/layout_tests/layouts/controller_name_space/nested.rhtml", "test/fixtures/layout_tests/layouts/item.rhtml", "test/fixtures/layout_tests/layouts/layout_test.rhtml", "test/fixtures/layout_tests/layouts/multiple_extensions.html.erb", "test/fixtures/layout_tests/layouts/symlinked", "test/fixtures/layout_tests/layouts/third_party_template_library.mab", "test/fixtures/layout_tests/views", "test/fixtures/layout_tests/views/goodbye.rhtml", "test/fixtures/layout_tests/views/hello.rhtml", "test/fixtures/layouts", "test/fixtures/layouts/_column.html.erb", "test/fixtures/layouts/block_with_layout.erb", "test/fixtures/layouts/builder.builder", "test/fixtures/layouts/partial_with_layout.erb", "test/fixtures/layouts/standard.html.erb", "test/fixtures/layouts/talk_from_action.erb", "test/fixtures/layouts/xhr.html.erb", "test/fixtures/layouts/yield.erb", "test/fixtures/mascot.rb", "test/fixtures/mascots", "test/fixtures/mascots/_mascot.html.erb", "test/fixtures/mascots.yml", "test/fixtures/multipart", "test/fixtures/multipart/binary_file", "test/fixtures/multipart/boundary_problem_file", "test/fixtures/multipart/bracketed_param", "test/fixtures/multipart/empty", "test/fixtures/multipart/hello.txt", "test/fixtures/multipart/large_text_file", "test/fixtures/multipart/mixed_files", "test/fixtures/multipart/mona_lisa.jpg", "test/fixtures/multipart/none", "test/fixtures/multipart/single_parameter", "test/fixtures/multipart/text_file", "test/fixtures/override", "test/fixtures/override/test", "test/fixtures/override/test/hello_world.erb", "test/fixtures/override2", "test/fixtures/override2/layouts", "test/fixtures/override2/layouts/test", "test/fixtures/override2/layouts/test/sub.erb", "test/fixtures/post_test", "test/fixtures/post_test/layouts", "test/fixtures/post_test/layouts/post.html.erb", "test/fixtures/post_test/layouts/super_post.iphone.erb", "test/fixtures/post_test/post", "test/fixtures/post_test/post/index.html.erb", "test/fixtures/post_test/post/index.iphone.erb", "test/fixtures/post_test/super_post", "test/fixtures/post_test/super_post/index.html.erb", "test/fixtures/post_test/super_post/index.iphone.erb", "test/fixtures/project.rb", "test/fixtures/projects", "test/fixtures/projects/_project.erb", "test/fixtures/projects.yml", "test/fixtures/public", "test/fixtures/public/404.html", "test/fixtures/public/500.da.html", "test/fixtures/public/500.html", "test/fixtures/public/absolute", "test/fixtures/public/absolute/test.css", "test/fixtures/public/absolute/test.js", "test/fixtures/public/elsewhere", "test/fixtures/public/elsewhere/cools.js", "test/fixtures/public/elsewhere/file.css", "test/fixtures/public/images", "test/fixtures/public/images/rails.png", "test/fixtures/public/javascripts", "test/fixtures/public/javascripts/application.js", "test/fixtures/public/javascripts/bank.js", "test/fixtures/public/javascripts/cache", "test/fixtures/public/javascripts/common.javascript", "test/fixtures/public/javascripts/controls.js", "test/fixtures/public/javascripts/dragdrop.js", "test/fixtures/public/javascripts/effects.js", "test/fixtures/public/javascripts/prototype.js", "test/fixtures/public/javascripts/robber.js", "test/fixtures/public/javascripts/subdir", "test/fixtures/public/javascripts/subdir/subdir.js", "test/fixtures/public/javascripts/version.1.0.js", "test/fixtures/public/stylesheets", "test/fixtures/public/stylesheets/bank.css", "test/fixtures/public/stylesheets/random.styles", "test/fixtures/public/stylesheets/robber.css", "test/fixtures/public/stylesheets/subdir", "test/fixtures/public/stylesheets/subdir/subdir.css", "test/fixtures/public/stylesheets/version.1.0.css", "test/fixtures/quiz", "test/fixtures/quiz/questions", "test/fixtures/quiz/questions/_question.html.erb", "test/fixtures/replies", "test/fixtures/replies/_reply.erb", "test/fixtures/replies.yml", "test/fixtures/reply.rb", "test/fixtures/respond_to", "test/fixtures/respond_to/all_types_with_layout.html.erb", "test/fixtures/respond_to/all_types_with_layout.js.rjs", "test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb", "test/fixtures/respond_to/iphone_with_html_response_type.html.erb", "test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb", "test/fixtures/respond_to/layouts", "test/fixtures/respond_to/layouts/missing.html.erb", "test/fixtures/respond_to/layouts/standard.html.erb", "test/fixtures/respond_to/layouts/standard.iphone.erb", "test/fixtures/respond_to/using_defaults.html.erb", "test/fixtures/respond_to/using_defaults.js.rjs", "test/fixtures/respond_to/using_defaults.xml.builder", "test/fixtures/respond_to/using_defaults_with_type_list.html.erb", "test/fixtures/respond_to/using_defaults_with_type_list.js.rjs", "test/fixtures/respond_to/using_defaults_with_type_list.xml.builder", "test/fixtures/respond_with", "test/fixtures/respond_with/edit.html.erb", "test/fixtures/respond_with/new.html.erb", "test/fixtures/respond_with/using_defaults.html.erb", "test/fixtures/respond_with/using_defaults.js.rjs", "test/fixtures/respond_with/using_defaults_with_type_list.js.rjs", "test/fixtures/respond_with/using_defaults_with_type_list.xml.builder", "test/fixtures/respond_with/using_resource.js.rjs", "test/fixtures/scope", "test/fixtures/scope/test", "test/fixtures/scope/test/modgreet.erb", "test/fixtures/shared.html.erb", "test/fixtures/symlink_parent", "test/fixtures/symlink_parent/symlinked_layout.erb", "test/fixtures/test", "test/fixtures/test/_counter.html.erb", "test/fixtures/test/_customer.erb", "test/fixtures/test/_customer_counter.erb", "test/fixtures/test/_customer_greeting.erb", "test/fixtures/test/_customer_with_var.erb", "test/fixtures/test/_form.erb", "test/fixtures/test/_hash_greeting.erb", "test/fixtures/test/_hash_object.erb", "test/fixtures/test/_hello.builder", "test/fixtures/test/_labelling_form.erb", "test/fixtures/test/_layout_for_block_with_args.html.erb", "test/fixtures/test/_layout_for_partial.html.erb", "test/fixtures/test/_local_inspector.html.erb", "test/fixtures/test/_one.html.erb", "test/fixtures/test/_partial.erb", "test/fixtures/test/_partial.html.erb", "test/fixtures/test/_partial.js.erb", "test/fixtures/test/_partial_for_use_in_layout.html.erb", "test/fixtures/test/_partial_only.erb", "test/fixtures/test/_partial_with_only_html_version.html.erb", "test/fixtures/test/_person.erb", "test/fixtures/test/_raise.html.erb", "test/fixtures/test/_two.html.erb", "test/fixtures/test/action_talk_to_layout.erb", "test/fixtures/test/basic.html.erb", "test/fixtures/test/calling_partial_with_layout.html.erb", "test/fixtures/test/capturing.erb", "test/fixtures/test/content_for.erb", "test/fixtures/test/content_for_concatenated.erb", "test/fixtures/test/content_for_with_parameter.erb", "test/fixtures/test/delete_with_js.rjs", "test/fixtures/test/dont_pick_me", "test/fixtures/test/dot.directory", "test/fixtures/test/dot.directory/render_file_with_ivar.erb", "test/fixtures/test/enum_rjs_test.rjs", "test/fixtures/test/formatted_html_erb.html.erb", "test/fixtures/test/formatted_xml_erb.builder", "test/fixtures/test/formatted_xml_erb.html.erb", "test/fixtures/test/formatted_xml_erb.xml.erb", "test/fixtures/test/greeting.html.erb", "test/fixtures/test/greeting.js.rjs", "test/fixtures/test/greeting.xml.erb", "test/fixtures/test/hello.builder", "test/fixtures/test/hello_world.da.html.erb", "test/fixtures/test/hello_world.erb", "test/fixtures/test/hello_world.erb~", "test/fixtures/test/hello_world.pt-BR.html.erb", "test/fixtures/test/hello_world_container.builder", "test/fixtures/test/hello_world_from_rxml.builder", "test/fixtures/test/hello_world_with_layout_false.erb", "test/fixtures/test/hello_xml_world.builder", "test/fixtures/test/hyphen-ated.erb", "test/fixtures/test/implicit_content_type.atom.builder", "test/fixtures/test/list.erb", "test/fixtures/test/malformed", "test/fixtures/test/malformed/malformed.en.html.erb~", "test/fixtures/test/malformed/malformed.erb~", "test/fixtures/test/malformed/malformed.html.erb~", "test/fixtures/test/nested_layout.erb", "test/fixtures/test/non_erb_block_content_for.builder", "test/fixtures/test/potential_conflicts.erb", "test/fixtures/test/render_explicit_html_template.js.rjs", "test/fixtures/test/render_file_from_template.html.erb", "test/fixtures/test/render_file_with_ivar.erb", "test/fixtures/test/render_file_with_locals.erb", "test/fixtures/test/render_file_with_locals_and_default.erb", "test/fixtures/test/render_implicit_html_template.js.rjs", "test/fixtures/test/render_implicit_html_template_from_xhr_request.da.html.erb", "test/fixtures/test/render_implicit_html_template_from_xhr_request.html.erb", "test/fixtures/test/render_implicit_js_template_without_layout.js.erb", "test/fixtures/test/render_to_string_test.erb", "test/fixtures/test/sub_template_raise.html.erb", "test/fixtures/test/template.erb", "test/fixtures/test/update_element_with_capture.erb", "test/fixtures/test/using_layout_around_block.html.erb", "test/fixtures/test/utf8.html.erb", "test/fixtures/test/utf8_magic.html.erb", "test/fixtures/topic.rb", "test/fixtures/topics", "test/fixtures/topics/_topic.html.erb", "test/fixtures/topics.yml", "test/html-scanner", "test/html-scanner/cdata_node_test.rb", "test/html-scanner/document_test.rb", "test/html-scanner/node_test.rb", "test/html-scanner/sanitizer_test.rb", "test/html-scanner/tag_node_test.rb", "test/html-scanner/text_node_test.rb", "test/html-scanner/tokenizer_test.rb", "test/javascript", "test/javascript/ajax_test.rb", "test/lib", "test/lib/active_record_unit.rb", "test/lib/controller", "test/lib/controller/fake_controllers.rb", "test/lib/controller/fake_models.rb", "test/lib/fixture_template.rb", "test/lib/testing_sandbox.rb", "test/new_base", "test/new_base/base_test.rb", "test/new_base/content_type_test.rb", "test/new_base/etag_test.rb", "test/new_base/metal_test.rb", "test/new_base/redirect_test.rb", "test/new_base/render_action_test.rb", "test/new_base/render_file_test.rb", "test/new_base/render_implicit_action_test.rb", "test/new_base/render_layout_test.rb", "test/new_base/render_partial_test.rb", "test/new_base/render_rjs_test.rb", "test/new_base/render_template_test.rb", "test/new_base/render_test.rb", "test/new_base/render_text_test.rb", "test/new_base/render_xml_test.rb", "test/new_base/test_helper.rb", "test/old_base", "test/old_base/abstract_unit.rb", "test/runner", "test/template", "test/template/active_record_helper_i18n_test.rb", "test/template/active_record_helper_test.rb", "test/template/asset_tag_helper_test.rb", "test/template/atom_feed_helper_test.rb", "test/template/benchmark_helper_test.rb", "test/template/body_parts_test.rb", "test/template/capture_helper_test.rb", "test/template/compiled_templates_test.rb", "test/template/date_helper_i18n_test.rb", "test/template/date_helper_test.rb", "test/template/erb_util_test.rb", "test/template/form_helper_test.rb", "test/template/form_options_helper_i18n_test.rb", "test/template/form_options_helper_test.rb", "test/template/form_tag_helper_test.rb", "test/template/javascript_helper_test.rb", "test/template/number_helper_i18n_test.rb", "test/template/number_helper_test.rb", "test/template/output_buffer_test.rb", "test/template/prototype_helper_test.rb", "test/template/record_tag_helper_test.rb", "test/template/render_test.rb", "test/template/sanitize_helper_test.rb", "test/template/scriptaculous_helper_test.rb", "test/template/tag_helper_test.rb", "test/template/test_test.rb", "test/template/text_helper_test.rb", "test/template/translation_helper_test.rb", "test/template/url_helper_test.rb", "test/tmp", "test/view", "test/view/test_case_test.rb"] s.homepage = %q{http://www.rubyonrails.org} s.require_paths = ["lib"] s.requirements = ["none"] @@ -24,15 +24,18 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_runtime_dependency(%q<activemodel>, ["= 3.0.pre"]) s.add_runtime_dependency(%q<rack>, ["~> 1.0.0"]) s.add_runtime_dependency(%q<rack-test>, ["~> 0.4.2"]) else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) s.add_dependency(%q<rack>, ["~> 1.0.0"]) s.add_dependency(%q<rack-test>, ["~> 0.4.2"]) end else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) s.add_dependency(%q<rack>, ["~> 1.0.0"]) s.add_dependency(%q<rack-test>, ["~> 0.4.2"]) end diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index ef66b24dd6..796ef40584 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -119,17 +119,17 @@ module AbstractController when true raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil" when nil - self.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1 + self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def _layout(details) self.class.cache_layout(details) do - if view_paths.exists?("#{_implied_layout_name}", details, "layouts") + if template_exists?("#{_implied_layout_name}", details, :_prefix => "layouts") "#{_implied_layout_name}" else super end end end - ruby_eval + RUBY end self.class_eval { private :_layout } end @@ -167,7 +167,7 @@ module AbstractController # details<Hash{Symbol => Object}>:: A list of details to restrict # the lookup to. By default, layout lookup is limited to the # formats specified for the current request. - def _layout_for_name(name, details = {:formats => formats}) + def _layout_for_name(name, details) name && _find_layout(name, details) end @@ -183,7 +183,7 @@ module AbstractController def _find_layout(name, details) # TODO: Make prefix actually part of details in ViewPath#find_by_parts prefix = details.key?(:prefix) ? details.delete(:prefix) : "layouts" - view_paths.find(name, details, prefix) + find_template(name, details, :_prefix => prefix) end # Returns the default layout for this controller and a given set of details. diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index feca1bc4b7..bbf941aa32 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -112,12 +112,18 @@ module AbstractController name = (options[:_template_name] || action_name).to_s options[:_template] ||= with_template_cache(name) do - view_paths.find( - name, { :formats => formats }, options[:_prefix], options[:_partial] - ) + find_template(name, { :formats => formats }, options) end end - + + def find_template(name, details, options) + view_paths.find(name, details, options[:_prefix], options[:_partial]) + end + + def template_exists?(name, details, options) + view_paths.exists?(name, details, options[:_prefix], options[:_partial]) + end + def with_template_cache(name) yield end diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 698189bd46..0dae68c7b7 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -51,7 +51,7 @@ module ActionController def method_for_action(action_name) super || begin - if view_paths.exists?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path) + if template_exists?(action_name.to_s, {:formats => formats}, :_prefix => controller_path) "default_render" end end diff --git a/actionpack/lib/action_controller/legacy/layout.rb b/actionpack/lib/action_controller/legacy/layout.rb index 43aea0eba2..53762158fc 100644 --- a/actionpack/lib/action_controller/legacy/layout.rb +++ b/actionpack/lib/action_controller/legacy/layout.rb @@ -191,7 +191,7 @@ module ActionController #:nodoc: def memoized_find_layout(layout, formats) #:nodoc: return layout if layout.nil? || layout.respond_to?(:render) prefix = layout.to_s =~ /layouts\// ? nil : "layouts" - view_paths.find(layout.to_s, {:formats => formats}, prefix) + find_template(layout.to_s, {:formats => formats}, :_prefix => prefix) end def find_layout(*args) @@ -200,7 +200,7 @@ module ActionController #:nodoc: end def layout_list #:nodoc: - Array(view_paths).sum([]) { |path| Dir["#{path.to_str}/layouts/**/*"] } + Array(view_paths).sum([]) { |path| Dir["#{path}/layouts/**/*"] } end memoize :layout_list diff --git a/actionpack/lib/action_controller/testing/process.rb b/actionpack/lib/action_controller/testing/process.rb index 5fb244e3eb..2fccf01040 100644 --- a/actionpack/lib/action_controller/testing/process.rb +++ b/actionpack/lib/action_controller/testing/process.rb @@ -133,7 +133,7 @@ module ActionController #:nodoc: @request.env['REQUEST_METHOD'] = http_method parameters ||= {} - @request.assign_parameters(@controller.class.controller_path, action.to_s, parameters) + @request.assign_parameters(@controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters) @request.session = ActionController::TestSession.new(session) unless session.nil? @request.session["flash"] = ActionController::Flash::FlashHash.new.update(flash) if flash diff --git a/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb b/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb index 9cfd6956d0..bd552b458a 100644 --- a/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb @@ -49,7 +49,18 @@ module ActionDispatch :expire_after => nil, :httponly => true }.freeze + + class OptionsHash < Hash + def initialize(by, env, default_options) + @session_data = env[CookieStore::ENV_SESSION_KEY] + default_options.each { |key, value| self[key] = value } + end + def [](key) + key == :id ? @session_data[:session_id] : super(key) + end + end + ENV_SESSION_KEY = "rack.session".freeze ENV_SESSION_OPTIONS_KEY = "rack.session.options".freeze HTTP_SET_COOKIE = "Set-Cookie".freeze @@ -90,8 +101,8 @@ module ActionDispatch def call(env) env[ENV_SESSION_KEY] = AbstractStore::SessionHash.new(self, env) - env[ENV_SESSION_OPTIONS_KEY] = @default_options.dup - + env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options) + status, headers, body = @app.call(env) session_data = env[ENV_SESSION_KEY] diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb index 70176a0ea4..d90afb1913 100644 --- a/actionpack/lib/action_view.rb +++ b/actionpack/lib/action_view.rb @@ -40,6 +40,7 @@ module ActionView autoload :MissingTemplate, 'action_view/base' autoload :Partials, 'action_view/render/partials' autoload :Resolver, 'action_view/template/resolver' + autoload :PathResolver, 'action_view/template/resolver' autoload :PathSet, 'action_view/paths' autoload :Rendering, 'action_view/render/rendering' autoload :Renderable, 'action_view/template/renderable' diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index c71840d41f..6b00e7afb5 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -286,7 +286,9 @@ module ActionView end javascript_src_tag(joined_javascript_name, options) else - ensure_javascript_sources!(expand_javascript_sources(sources, recursive)).collect { |source| javascript_src_tag(source, options) }.join("\n") + sources = expand_javascript_sources(sources, recursive) + ensure_javascript_sources!(sources) if cache + sources.collect { |source| javascript_src_tag(source, options) }.join("\n") end end @@ -435,7 +437,9 @@ module ActionView end stylesheet_tag(joined_stylesheet_name, options) else - ensure_stylesheet_sources!(expand_stylesheet_sources(sources, recursive)).collect { |source| stylesheet_tag(source, options) }.join("\n") + sources = expand_stylesheet_sources(sources, recursive) + ensure_stylesheet_sources!(sources) if cache + sources.collect { |source| stylesheet_tag(source, options) }.join("\n") end end diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index ff5a2134ff..7fae0f6b8d 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -106,7 +106,7 @@ module ActionView # escape_once("<< Accept & Checkout") # # => "<< Accept & Checkout" def escape_once(html) - html.to_s.gsub(/[\"><]|&(?!([a-zA-Z]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] } + ActiveSupport::Multibyte.clean(html.to_s).gsub(/[\"><]|&(?!([a-zA-Z]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] } end private diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index 0b4c62d4d0..f5591ead09 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -1,9 +1,28 @@ require "pathname" +require "active_support/core_ext/class" require "action_view/template/template" module ActionView # Abstract superclass class Resolver + + class_inheritable_accessor(:registered_details) + self.registered_details = {} + + def self.register_detail(name, options = {}) + registered_details[name] = lambda do |val| + val ||= yield + val |= [nil] unless options[:allow_nil] == false + val + end + end + + register_detail(:locale) { [I18n.locale] } + register_detail(:formats) { Mime::SET.symbols } + register_detail(:handlers, :allow_nil => false) do + TemplateHandlers.extensions + end + def initialize(options = {}) @cache = options[:cache] @cached = {} @@ -11,15 +30,18 @@ module ActionView # Normalizes the arguments and passes it on to find_template def find(*args) - find_all_by_parts(*args).first + find_all(*args).first end - - def find_all_by_parts(name, details = {}, prefix = nil, partial = nil) - details[:locales] = [I18n.locale] - name = name.to_s.gsub(handler_matcher, '').split("/") - find_templates(name.pop, details, [prefix, *name].compact.join("/"), partial) + + def find_all(name, details = {}, prefix = nil, partial = nil) + details = normalize_details(details) + name, prefix = normalize_name(name, prefix) + + cached([name, details, prefix, partial]) do + find_templates(name, details, prefix, partial) + end end - + private # This is what child classes implement. No defaults are needed @@ -28,29 +50,26 @@ module ActionView def find_templates(name, details, prefix, partial) raise NotImplementedError end - - def valid_handlers - @valid_handlers ||= TemplateHandlers.extensions - end - def handler_matcher - @handler_matcher ||= begin - e = valid_handlers.join('|') - /\.(?:#{e})$/ + def normalize_details(details) + details = details.dup + # TODO: Refactor this concern out of the resolver + details.delete(:formats) if details[:formats] == [:"*/*"] + registered_details.each do |k, v| + details[k] = v.call(details[k]) end + details end - def handler_glob - @handler_glob ||= begin - e = TemplateHandlers.extensions.map{|h| ".#{h}"}.join(",") - "{#{e}}" - end - end - - def formats_glob - @formats_glob ||= begin - '{' + Mime::SET.symbols.map { |l| ".#{l}," }.join + '}' - end + # Support legacy foo.erb names even though we now ignore .erb + # as well as incorrectly putting part of the path in the template + # name instead of the prefix. + def normalize_name(name, prefix) + handlers = TemplateHandlers.extensions.join('|') + name = name.to_s.gsub(/\.(?:#{handlers})$/, '') + + parts = name.split('/') + return parts.pop, [prefix, *parts].compact.join("/") end def cached(key) @@ -60,80 +79,49 @@ module ActionView end end - class FileSystemResolver < Resolver - - def self.cached_glob - @@cached_glob ||= {} - end - - def initialize(path, options = {}) - raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver) - super(options) - @path = Pathname.new(path).expand_path - end + class PathResolver < Resolver - # TODO: This is the currently needed API. Make this suck less - # ==== <suck> - attr_reader :path + EXTENSION_ORDER = [:locale, :formats, :handlers] def to_s - path.to_s + @path.to_s end + alias to_path to_s - def to_str - path.to_s + def find_templates(name, details, prefix, partial) + path = build_path(name, details, prefix, partial) + query(path, EXTENSION_ORDER.map { |ext| details[ext] }) end - def ==(path) - to_str == path.to_str - end + private - def eql?(path) - to_str == path.to_str + def build_path(name, details, prefix, partial) + path = "" + path << "#{prefix}/" unless prefix.empty? + path << (partial ? "_#{name}" : name) + path end - # ==== </suck> - - def find_templates(name, details, prefix, partial, root = "#{@path}/") - if glob = details_to_glob(name, details, prefix, partial, root) - cached(glob) do - Dir[glob].map do |path| - next if File.directory?(path) - source = File.read(path) - identifier = Pathname.new(path).expand_path.to_s - Template.new(source, identifier, *path_to_details(path)) - end.compact - end + def query(path, exts) + query = "#{@path}/#{path}" + exts.each do |ext| + query << '{' << ext.map {|e| e && ".#{e}" }.join(',') << '}' end - end - - private - # :api: plugin - def details_to_glob(name, details, prefix, partial, root) - self.class.cached_glob[[name, prefix, partial, details, root]] ||= begin - path = "" - path << "#{prefix}/" unless prefix.empty? - path << (partial ? "_#{name}" : name) - - extensions = "" - [:locales, :formats].each do |k| - extensions << if exts = details[k] - '{' + exts.map {|e| ".#{e},"}.join + '}' - else - k == :formats ? formats_glob : '' - end - end - - "#{root}#{path}#{extensions}#{handler_glob}" - end + Dir[query].map do |path| + next if File.directory?(path) + source = File.read(path) + identifier = Pathname.new(path).expand_path.to_s + + Template.new(source, identifier, *path_to_details(path)) + end.compact end - # TODO: fix me - # :api: plugin + # # TODO: fix me + # # :api: plugin def path_to_details(path) # [:erb, :format => :html, :locale => :en, :partial => true/false] - if m = path.match(%r'/(_)?[\w-]+(\.[\w-]+)*\.(\w+)$') + if m = path.match(%r'(?:^|/)(_)?[\w-]+(\.[\w-]+)*\.(\w+)$') partial = m[1] == '_' details = (m[2]||"").split('.').reject { |e| e.empty? } handler = Template.handler_class_for_extension(m[3]) @@ -146,13 +134,32 @@ module ActionView end end - class FileSystemResolverWithFallback < FileSystemResolver + class FileSystemResolver < PathResolver + def initialize(path, options = {}) + raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver) + super(options) + @path = Pathname.new(path).expand_path + end + end - def find_templates(name, details, prefix, partial) - templates = super - return super(name, details, prefix, partial, '') if templates.empty? - templates + # OMG HAX + # TODO: remove hax + class FileSystemResolverWithFallback < Resolver + def initialize(path, options = {}) + super(options) + @paths = [FileSystemResolver.new(path, options), FileSystemResolver.new("", options), FileSystemResolver.new("/", options)] end + def find_templates(*args) + @paths.each do |p| + template = p.find_templates(*args) + return template unless template.empty? + end + [] + end + + def to_s + @paths.first.to_s + end end end
\ No newline at end of file diff --git a/actionpack/test/abstract_controller/abstract_controller_test.rb b/actionpack/test/abstract_controller/abstract_controller_test.rb index 7991436703..3b4046a424 100644 --- a/actionpack/test/abstract_controller/abstract_controller_test.rb +++ b/actionpack/test/abstract_controller/abstract_controller_test.rb @@ -148,10 +148,10 @@ module AbstractController private def self.layout(formats) begin - view_paths.find(name.underscore, {:formats => formats}, "layouts") + find_template(name.underscore, {:formats => formats}, :_prefix => "layouts") rescue ActionView::MissingTemplate begin - view_paths.find("application", {:formats => formats}, "layouts") + find_template("application", {:formats => formats}, :_prefix => "layouts") rescue ActionView::MissingTemplate end end diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index a46ce7a0aa..19d9c955a5 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -176,6 +176,7 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest c.connect "/:action" end end + reset_app! yield end end diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 453812c128..901cb940ea 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' require 'action_controller/vendor/html-scanner' +require 'controller/fake_controllers' # a controller class to facilitate the tests class ActionPackAssertionsController < ActionController::Base diff --git a/actionpack/test/controller/addresses_render_test.rb b/actionpack/test/controller/addresses_render_test.rb index 2d2a2745b0..c1cd22113d 100644 --- a/actionpack/test/controller/addresses_render_test.rb +++ b/actionpack/test/controller/addresses_render_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' require 'logger' +require 'controller/fake_controllers' class Address def Address.count(conditions = nil, join = nil) @@ -15,13 +16,8 @@ class Address end end -class AddressesTestController < ActionController::Base - def self.controller_name; "addresses"; end - def self.controller_path; "addresses"; end -end - class AddressesTest < ActionController::TestCase - tests AddressesTestController + tests AddressesController def setup super diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 197ba0c69c..93f5bfa272 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -371,6 +371,7 @@ class IntegrationProcessTest < ActionController::IntegrationTest c.connect "/:action" end end + reset! yield end end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index d20684296f..1aabf71cad 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -232,14 +232,18 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_basic_named_route - rs.add_named_route :home, '', :controller => 'content', :action => 'list' + rs.draw do |map| + map.home '', :controller => 'content', :action => 'list' + end x = setup_for_named_route assert_equal("http://test.host/", x.send(:home_url)) end def test_basic_named_route_with_relative_url_root - rs.add_named_route :home, '', :controller => 'content', :action => 'list' + rs.draw do |map| + map.home '', :controller => 'content', :action => 'list' + end x = setup_for_named_route ActionController::Base.relative_url_root = "/foo" assert_equal("http://test.host/foo/", @@ -249,14 +253,18 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_named_route_with_option - rs.add_named_route :page, 'page/:title', :controller => 'content', :action => 'show_page' + rs.draw do |map| + map.page 'page/:title', :controller => 'content', :action => 'show_page' + end x = setup_for_named_route assert_equal("http://test.host/page/new%20stuff", x.send(:page_url, :title => 'new stuff')) end def test_named_route_with_default - rs.add_named_route :page, 'page/:title', :controller => 'content', :action => 'show_page', :title => 'AboutPage' + rs.draw do |map| + map.page 'page/:title', :controller => 'content', :action => 'show_page', :title => 'AboutPage' + end x = setup_for_named_route assert_equal("http://test.host/page/AboutRails", x.send(:page_url, :title => "AboutRails")) @@ -264,36 +272,46 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_named_route_with_name_prefix - rs.add_named_route :page, 'page', :controller => 'content', :action => 'show_page', :name_prefix => 'my_' + rs.draw do |map| + map.page 'page', :controller => 'content', :action => 'show_page', :name_prefix => 'my_' + end x = setup_for_named_route assert_equal("http://test.host/page", x.send(:my_page_url)) end def test_named_route_with_path_prefix - rs.add_named_route :page, 'page', :controller => 'content', :action => 'show_page', :path_prefix => 'my' + rs.draw do |map| + map.page 'page', :controller => 'content', :action => 'show_page', :path_prefix => 'my' + end x = setup_for_named_route assert_equal("http://test.host/my/page", x.send(:page_url)) end def test_named_route_with_blank_path_prefix - rs.add_named_route :page, 'page', :controller => 'content', :action => 'show_page', :path_prefix => '' + rs.draw do |map| + map.page 'page', :controller => 'content', :action => 'show_page', :path_prefix => '' + end x = setup_for_named_route assert_equal("http://test.host/page", x.send(:page_url)) end def test_named_route_with_nested_controller - rs.add_named_route :users, 'admin/user', :controller => 'admin/user', :action => 'index' + rs.draw do |map| + map.users 'admin/user', :controller => 'admin/user', :action => 'index' + end x = setup_for_named_route assert_equal("http://test.host/admin/user", x.send(:users_url)) end def test_optimised_named_route_call_never_uses_url_for - rs.add_named_route :users, 'admin/user', :controller => '/admin/user', :action => 'index' - rs.add_named_route :user, 'admin/user/:id', :controller=>'/admin/user', :action=>'show' + rs.draw do |map| + map.users 'admin/user', :controller => '/admin/user', :action => 'index' + map.user 'admin/user/:id', :controller=>'/admin/user', :action=>'show' + end x = setup_for_named_route x.expects(:url_for).never x.send(:users_url) @@ -303,7 +321,9 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_optimised_named_route_with_host - rs.add_named_route :pages, 'pages', :controller => 'content', :action => 'show_page', :host => 'foo.com' + rs.draw do |map| + map.pages 'pages', :controller => 'content', :action => 'show_page', :host => 'foo.com' + end x = setup_for_named_route x.expects(:url_for).with(:host => 'foo.com', :only_path => false, :controller => 'content', :action => 'show_page', :use_route => :pages).once x.send(:pages_url) @@ -378,7 +398,9 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_paths_slashes_unescaped_with_ordered_parameters - rs.add_named_route :path, '/file/*path', :controller => 'content' + rs.draw do |map| + map.path '/file/*path', :controller => 'content' + end # No / to %2F in URI, only for query params. x = setup_for_named_route @@ -1781,23 +1803,23 @@ class RouteSetTest < ActiveSupport::TestCase end def test_default_route_recognition - expected = {:controller => 'accounts', :action => 'show', :id => '10'} - assert_equal expected, default_route_set.recognize_path('/accounts/show/10') - assert_equal expected, default_route_set.recognize_path('/accounts/show/10/') + expected = {:controller => 'pages', :action => 'show', :id => '10'} + assert_equal expected, default_route_set.recognize_path('/pages/show/10') + assert_equal expected, default_route_set.recognize_path('/pages/show/10/') expected[:id] = 'jamis' - assert_equal expected, default_route_set.recognize_path('/accounts/show/jamis/') + assert_equal expected, default_route_set.recognize_path('/pages/show/jamis/') expected.delete :id - assert_equal expected, default_route_set.recognize_path('/accounts/show') - assert_equal expected, default_route_set.recognize_path('/accounts/show/') + assert_equal expected, default_route_set.recognize_path('/pages/show') + assert_equal expected, default_route_set.recognize_path('/pages/show/') expected[:action] = 'index' - assert_equal expected, default_route_set.recognize_path('/accounts/') - assert_equal expected, default_route_set.recognize_path('/accounts') + assert_equal expected, default_route_set.recognize_path('/pages/') + assert_equal expected, default_route_set.recognize_path('/pages') assert_raise(ActionController::RoutingError) { default_route_set.recognize_path('/') } - assert_raise(ActionController::RoutingError) { default_route_set.recognize_path('/accounts/how/goood/it/is/to/be/free') } + assert_raise(ActionController::RoutingError) { default_route_set.recognize_path('/pages/how/goood/it/is/to/be/free') } end def test_default_route_should_omit_default_action @@ -1813,15 +1835,15 @@ class RouteSetTest < ActiveSupport::TestCase end def test_default_route_should_uri_escape_pluses - expected = { :controller => 'accounts', :action => 'show', :id => 'hello world' } - assert_equal expected, default_route_set.recognize_path('/accounts/show/hello world') - assert_equal expected, default_route_set.recognize_path('/accounts/show/hello%20world') - assert_equal '/accounts/show/hello%20world', default_route_set.generate(expected, expected) + expected = { :controller => 'pages', :action => 'show', :id => 'hello world' } + assert_equal expected, default_route_set.recognize_path('/pages/show/hello world') + assert_equal expected, default_route_set.recognize_path('/pages/show/hello%20world') + assert_equal '/pages/show/hello%20world', default_route_set.generate(expected, expected) expected[:id] = 'hello+world' - assert_equal expected, default_route_set.recognize_path('/accounts/show/hello+world') - assert_equal expected, default_route_set.recognize_path('/accounts/show/hello%2Bworld') - assert_equal '/accounts/show/hello+world', default_route_set.generate(expected, expected) + assert_equal expected, default_route_set.recognize_path('/pages/show/hello+world') + assert_equal expected, default_route_set.recognize_path('/pages/show/hello%2Bworld') + assert_equal '/pages/show/hello+world', default_route_set.generate(expected, expected) end def test_parameter_shell diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index 9b8d07222b..4c4bf9ade4 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'controller/fake_controllers' ActionController::UrlRewriter diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index c732d1c910..05d2c8407c 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -43,7 +43,7 @@ class ViewLoadPathsTest < ActionController::TestCase end def expand(array) - array.map {|x| File.expand_path(x)} + array.map {|x| File.expand_path(x.to_s)} end def assert_paths(*paths) diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index 0723a76d2b..d695be0be4 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -30,7 +30,7 @@ class CookieStoreTest < ActionController::IntegrationTest end def get_session_id - render :text => "foo: #{session[:foo].inspect}; id: #{request.session_options[:id]}" + render :text => "id: #{request.session_options[:id]}" end def call_reset_session @@ -119,7 +119,7 @@ class CookieStoreTest < ActionController::IntegrationTest get '/get_session_id' assert_response :success - assert_equal "foo: \"bar\"; id: #{session_id}", response.body + assert_equal "id: #{session_id}", response.body end end diff --git a/actionpack/test/lib/controller/fake_controllers.rb b/actionpack/test/lib/controller/fake_controllers.rb index 6e02e2d21b..22729188a2 100644 --- a/actionpack/test/lib/controller/fake_controllers.rb +++ b/actionpack/test/lib/controller/fake_controllers.rb @@ -9,7 +9,14 @@ module Admin class UserController < ActionController::Base; end class NewsFeedController < ActionController::Base; end end - +class ElsewhereController < ActionController::Base; end +class AddressesController < ActionController::Base; end +class SessionsController < ActionController::Base; end +class FooController < ActionController::Base; end +class CController < ActionController::Base; end +class HiController < ActionController::Base; end +class BraveController < ActionController::Base; end +class ImageController < ActionController::Base; end # For speed test class SpeedController < ActionController::Base; end @@ -24,7 +31,6 @@ class UsersController < SpeedController; end class SettingsController < SpeedController; end class ChannelsController < SpeedController; end class ChannelVideosController < SpeedController; end -class SessionsController < SpeedController; end class LostPasswordsController < SpeedController; end class PagesController < SpeedController; end diff --git a/actionpack/test/lib/fixture_template.rb b/actionpack/test/lib/fixture_template.rb index 8da92180d1..6b9e7c5270 100644 --- a/actionpack/test/lib/fixture_template.rb +++ b/actionpack/test/lib/fixture_template.rb @@ -1,67 +1,24 @@ module ActionView #:nodoc: - class FixtureResolver < Resolver + class FixtureResolver < PathResolver def initialize(hash = {}, options = {}) super(options) @hash = hash end - def find_templates(name, details, prefix, partial) - if regexp = details_to_regexp(name, details, prefix, partial) - cached(regexp) do - templates = [] - @hash.select { |k,v| k =~ regexp }.each do |path, source| - templates << Template.new(source, path, *path_to_details(path)) - end - templates.sort_by {|t| -t.details.values.compact.size } - end - end - end - private - def formats_regexp - @formats_regexp ||= begin - formats = Mime::SET.symbols - '(?:' + formats.map { |l| "\\.#{Regexp.escape(l.to_s)}" }.join('|') + ')?' + def query(path, exts) + query = Regexp.escape(path) + exts.each do |ext| + query << '(?:' << ext.map {|e| e && Regexp.escape(".#{e}") }.join('|') << ')' end - end - - def handler_regexp - e = TemplateHandlers.extensions.map{|h| "\\.#{Regexp.escape(h.to_s)}"}.join("|") - "(?:#{e})" - end - def details_to_regexp(name, details, prefix, partial) - path = "" - path << "#{prefix}/" unless prefix.empty? - path << (partial ? "_#{name}" : name) - - extensions = "" - [:locales, :formats].each do |k| - extensions << if exts = details[k] - '(?:' + exts.map {|e| "\\.#{Regexp.escape(e.to_s)}"}.join('|') + ')?' - else - k == :formats ? formats_regexp : '' - end + templates = [] + @hash.select { |k,v| k =~ /^#{query}$/ }.each do |path, source| + templates << Template.new(source, path, *path_to_details(path)) end - - %r'^#{Regexp.escape(path)}#{extensions}#{handler_regexp}$' + templates.sort_by {|t| -t.details.values.compact.size } end - # TODO: fix me - # :api: plugin - def path_to_details(path) - # [:erb, :format => :html, :locale => :en, :partial => true/false] - if m = path.match(%r'(_)?[\w-]+((?:\.[\w-]+)*)\.(\w+)$') - partial = m[1] == '_' - details = (m[2]||"").split('.').reject { |e| e.empty? } - handler = Template.handler_class_for_extension(m[3]) - - format = Mime[details.last] && details.pop.to_sym - locale = details.last && details.pop.to_sym - - return handler, :format => format, :locale => locale, :partial => partial - end - end end end
\ No newline at end of file diff --git a/actionpack/test/new_base/content_negotiation_test.rb b/actionpack/test/new_base/content_negotiation_test.rb new file mode 100644 index 0000000000..d2f732738d --- /dev/null +++ b/actionpack/test/new_base/content_negotiation_test.rb @@ -0,0 +1,18 @@ +require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") + +module ContentNegotiation + + # This has no layout and it works + class BasicController < ActionController::Base + self.view_paths = [ActionView::FixtureResolver.new( + "content_negotiation/basic/hello.html.erb" => "Hello world <%= request.formats %>!" + )] + end + + class TestContentNegotiation < SimpleRouteCase + test "A */* Accept header will return HTML" do + get "/content_negotiation/basic/hello", {}, "HTTP_ACCEPT" => "*/*" + assert_body "Hello world */*!" + end + end +end
\ No newline at end of file diff --git a/actionpack/test/new_base/render_file_test.rb b/actionpack/test/new_base/render_file_test.rb index 769949be0c..8d7f49dbc2 100644 --- a/actionpack/test/new_base/render_file_test.rb +++ b/actionpack/test/new_base/render_file_test.rb @@ -3,7 +3,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") module RenderFile class BasicController < ActionController::Base - self.view_paths = "." + self.view_paths = File.dirname(__FILE__) def index render :file => File.join(File.dirname(__FILE__), *%w[.. fixtures test hello_world]) diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 28f9d48671..83fc6a282c 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -213,11 +213,11 @@ class AssetTagHelperTest < ActionView::TestCase end def test_javascript_include_tag_with_missing_source - assert_raise(Errno::ENOENT) { + assert_nothing_raised { javascript_include_tag('missing_security_guard') } - assert_raise(Errno::ENOENT) { + assert_nothing_raised { javascript_include_tag(:defaults, 'missing_security_guard') } @@ -276,7 +276,7 @@ class AssetTagHelperTest < ActionView::TestCase end def test_stylesheet_link_tag_with_missing_source - assert_raise(Errno::ENOENT) { + assert_nothing_raised { stylesheet_link_tag('missing_security_guard') } @@ -639,6 +639,40 @@ class AssetTagHelperTest < ActionView::TestCase assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js')) end + def test_caching_javascript_include_tag_when_caching_on_and_missing_javascript_file + ENV["RAILS_ASSET_ID"] = "" + ActionController::Base.perform_caching = true + + assert_raise(Errno::ENOENT) { + javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => true) + } + + assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) + + assert_raise(Errno::ENOENT) { + javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => "money") + } + + assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js')) + end + + def test_caching_javascript_include_tag_when_caching_off_and_missing_javascript_file + ENV["RAILS_ASSET_ID"] = "" + ActionController::Base.perform_caching = false + + assert_raise(Errno::ENOENT) { + javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => true) + } + + assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) + + assert_raise(Errno::ENOENT) { + javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => "money") + } + + assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js')) + end + def test_caching_stylesheet_link_tag_when_caching_on ENV["RAILS_ASSET_ID"] = "" ActionController::Base.asset_host = 'http://a0.example.com' @@ -709,7 +743,6 @@ class AssetTagHelperTest < ActionView::TestCase def test_caching_stylesheet_link_tag_when_caching_on_and_missing_css_file ENV["RAILS_ASSET_ID"] = "" - ActionController::Base.asset_host = 'http://a0.example.com' ActionController::Base.perform_caching = true assert_raise(Errno::ENOENT) { @@ -729,6 +762,27 @@ class AssetTagHelperTest < ActionView::TestCase FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css')) end + def test_caching_stylesheet_link_tag_when_caching_off_and_missing_css_file + ENV["RAILS_ASSET_ID"] = "" + ActionController::Base.perform_caching = false + + assert_raise(Errno::ENOENT) { + stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => true) + } + + assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) + + assert_raise(Errno::ENOENT) { + stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => "money") + } + + assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css')) + + ensure + FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) + FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css')) + end + def test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host ENV["RAILS_ASSET_ID"] = "" ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" } diff --git a/actionpack/test/template/compiled_templates_test.rb b/actionpack/test/template/compiled_templates_test.rb index 7734e6da73..632988bb2e 100644 --- a/actionpack/test/template/compiled_templates_test.rb +++ b/actionpack/test/template/compiled_templates_test.rb @@ -14,6 +14,9 @@ class CompiledTemplatesTest < Test::Unit::TestCase assert_equal "two", render(:file => "test/render_file_with_locals_and_default.erb", :locals => { :secret => "two" }) end + # This is broken in 1.8.6 (not supported in Rails 3.0) because the cache uses a Hash + # key. Since Ruby 1.8.6 implements Hash#hash using the hash's object_id, it will never + # successfully get a cache hit here. def test_template_changes_are_not_reflected_with_cached_templates assert_equal "Hello world!", render(:file => "test/hello_world.erb") modify_template "test/hello_world.erb", "Goodbye world!" do diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 0e24fbd24d..44f1925653 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -367,25 +367,25 @@ class UrlHelperTest < ActionView::TestCase end end -class UrlHelperWithControllerTest < ActionView::TestCase - class UrlHelperController < ActionController::Base - def self.controller_path; 'url_helper_with_controller' end - - def show_url_for - render :inline => "<%= url_for :controller => 'url_helper_with_controller', :action => 'show_url_for' %>" - end +class UrlHelperController < ActionController::Base + def self.controller_path; 'url_helper_with_controller' end - def show_named_route - render :inline => "<%= show_named_route_#{params[:kind]} %>" - end + def show_url_for + render :inline => "<%= url_for :controller => 'url_helper_with_controller', :action => 'show_url_for' %>" + end - def nil_url_for - render :inline => '<%= url_for(nil) %>' - end + def show_named_route + render :inline => "<%= show_named_route_#{params[:kind]} %>" + end - def rescue_action(e) raise e end + def nil_url_for + render :inline => '<%= url_for(nil) %>' end + def rescue_action(e) raise e end +end + +class UrlHelperWithControllerTest < ActionView::TestCase tests ActionView::Helpers::UrlHelper def setup @@ -416,7 +416,7 @@ class UrlHelperWithControllerTest < ActionView::TestCase def test_url_for_nil_returns_current_path get :nil_url_for - assert_equal '/url_helper_with_controller/nil_url_for', @response.body + assert_equal '/url_helper/nil_url_for', @response.body end def test_named_route_should_show_host_and_path_using_controller_default_url_options @@ -436,35 +436,33 @@ class UrlHelperWithControllerTest < ActionView::TestCase def with_url_helper_routing with_routing do |set| set.draw do |map| - map.show_named_route 'url_helper_with_controller/show_named_route', :controller => 'url_helper_with_controller', :action => 'show_named_route' + map.show_named_route 'url_helper_with_controller/show_named_route', :controller => 'url_helper', :action => 'show_named_route' end yield end end end -class LinkToUnlessCurrentWithControllerTest < ActionView::TestCase - class TasksController < ActionController::Base - def self.controller_path; 'tasks' end - - def index - render_default - end +class TasksController < ActionController::Base + def index + render_default + end - def show - render_default - end + def show + render_default + end - def rescue_action(e) raise e end + def rescue_action(e) raise e end - protected - def render_default - render :inline => - "<%= link_to_unless_current(\"tasks\", tasks_path) %>\n" + - "<%= link_to_unless_current(\"tasks\", tasks_url) %>" - end - end + protected + def render_default + render :inline => + "<%= link_to_unless_current(\"tasks\", tasks_path) %>\n" + + "<%= link_to_unless_current(\"tasks\", tasks_url) %>" + end +end +class LinkToUnlessCurrentWithControllerTest < ActionView::TestCase tests ActionView::Helpers::UrlHelper def setup @@ -537,41 +535,37 @@ class Session end end -class PolymorphicControllerTest < ActionView::TestCase - class WorkshopsController < ActionController::Base - def self.controller_path; 'workshops' end - - def index - @workshop = Workshop.new(1, true) - render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" - end - - def show - @workshop = Workshop.new(params[:id], false) - render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" - end - - def rescue_action(e) raise e end +class WorkshopsController < ActionController::Base + def index + @workshop = Workshop.new(1, true) + render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" end - class SessionsController < ActionController::Base - def self.controller_path; 'sessions' end + def show + @workshop = Workshop.new(params[:id], false) + render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" + end - def index - @workshop = Workshop.new(params[:workshop_id], false) - @session = Session.new(1, true) - render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>" - end + def rescue_action(e) raise e end +end - def show - @workshop = Workshop.new(params[:workshop_id], false) - @session = Session.new(params[:id], false) - render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>" - end +class SessionsController < ActionController::Base + def index + @workshop = Workshop.new(params[:workshop_id], false) + @session = Session.new(1, true) + render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>" + end - def rescue_action(e) raise e end + def show + @workshop = Workshop.new(params[:workshop_id], false) + @session = Session.new(params[:id], false) + render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>" end + def rescue_action(e) raise e end +end + +class PolymorphicControllerTest < ActionView::TestCase tests ActionView::Helpers::UrlHelper def setup diff --git a/activemodel/Rakefile b/activemodel/Rakefile index dcd1eaa444..4a64c90dd9 100755 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -15,12 +15,13 @@ Rake::TestTask.new do |t| t.libs << "test" t.test_files = Dir.glob("test/cases/**/*_test.rb").sort t.verbose = true + t.warning = true end task :isolated_test do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) Dir.glob("test/**/*_test.rb").all? do |file| - system(ruby, '-Ilib:test', file) + system(ruby, '-w', '-Ilib:test', file) end or raise "Failures" end diff --git a/activemodel/activemodel.gemspec b/activemodel/activemodel.gemspec index 700b645eb3..e96718e6fd 100644 --- a/activemodel/activemodel.gemspec +++ b/activemodel/activemodel.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Extracts common modeling concerns from ActiveRecord to share between similar frameworks like ActiveResource.} s.email = %q{david@loudthinking.com} s.files = ["CHANGELOG", "MIT-LICENSE", "README", "Rakefile", "lib/active_model", "lib/active_model/attribute_methods.rb", "lib/active_model/conversion.rb", "lib/active_model/deprecated_error_methods.rb", "lib/active_model/dirty.rb", "lib/active_model/errors.rb", "lib/active_model/lint.rb", "lib/active_model/locale", "lib/active_model/locale/en.yml", "lib/active_model/naming.rb", "lib/active_model/observing.rb", "lib/active_model/serialization.rb", "lib/active_model/serializers", "lib/active_model/serializers/json.rb", "lib/active_model/serializers/xml.rb", "lib/active_model/state_machine", "lib/active_model/state_machine/event.rb", "lib/active_model/state_machine/machine.rb", "lib/active_model/state_machine/state.rb", "lib/active_model/state_machine/state_transition.rb", "lib/active_model/state_machine.rb", "lib/active_model/test_case.rb", "lib/active_model/validations", "lib/active_model/validations/acceptance.rb", "lib/active_model/validations/confirmation.rb", "lib/active_model/validations/exclusion.rb", "lib/active_model/validations/format.rb", "lib/active_model/validations/inclusion.rb", "lib/active_model/validations/length.rb", "lib/active_model/validations/numericality.rb", "lib/active_model/validations/presence.rb", "lib/active_model/validations/with.rb", "lib/active_model/validations.rb", "lib/active_model/validations_repair_helper.rb", "lib/active_model/version.rb", "lib/active_model.rb", "lib/activemodel.rb", "test/cases", "test/cases/helper.rb", "test/cases/lint_test.rb", "test/cases/naming_test.rb", "test/cases/observing_test.rb", "test/cases/serializeration", "test/cases/serializeration/json_serialization_test.rb", "test/cases/serializeration/xml_serialization_test.rb", "test/cases/state_machine", "test/cases/state_machine/event_test.rb", "test/cases/state_machine/machine_test.rb", "test/cases/state_machine/state_test.rb", "test/cases/state_machine/state_transition_test.rb", "test/cases/state_machine_test.rb", "test/cases/tests_database.rb", "test/cases/validations", "test/cases/validations/acceptance_validation_test.rb", "test/cases/validations/conditional_validation_test.rb", "test/cases/validations/confirmation_validation_test.rb", "test/cases/validations/exclusion_validation_test.rb", "test/cases/validations/format_validation_test.rb", "test/cases/validations/i18n_generate_message_validation_test.rb", "test/cases/validations/i18n_validation_test.rb", "test/cases/validations/inclusion_validation_test.rb", "test/cases/validations/length_validation_test.rb", "test/cases/validations/numericality_validation_test.rb", "test/cases/validations/presence_validation_test.rb", "test/cases/validations/with_validation_test.rb", "test/cases/validations_test.rb", "test/config.rb", "test/fixtures", "test/fixtures/topics.yml", "test/models", "test/models/contact.rb", "test/models/custom_reader.rb", "test/models/developer.rb", "test/models/person.rb", "test/models/reply.rb", "test/models/topic.rb", "test/schema.rb"] diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 1091ad3095..aa35a2726e 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -181,7 +181,7 @@ module ActiveModel end def attribute_methods_generated? - @attribute_methods_generated ? true : false + @attribute_methods_generated ||= nil end protected diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index 3b230c43b9..d9d1ab8967 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -40,23 +40,6 @@ module ActiveModel observers.each { |o| instantiate_observer(o) } end - # Wraps methods with before and after notifications. - # - # wrap_with_notifications :create, :save, :update, :destroy - def wrap_with_notifications(*methods) - methods.each do |method| - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{method}_with_notifications(*args, &block) - notify_observers(:before_#{method}) - result = #{method}_without_notifications(*args, &block) - notify_observers(:after_#{method}) - result - end - EOS - alias_method_chain(method, :notifications) - end - end - protected def instantiate_observer(observer) #:nodoc: # string/symbol diff --git a/activemodel/lib/active_model/validations_repair_helper.rb b/activemodel/lib/active_model/validations_repair_helper.rb index 432e411308..0809e7c0d1 100644 --- a/activemodel/lib/active_model/validations_repair_helper.rb +++ b/activemodel/lib/active_model/validations_repair_helper.rb @@ -7,7 +7,8 @@ module ActiveModel model_classes.inject({}) do |repair, klass| repair[klass] ||= {} [:validate, :validate_on_create, :validate_on_update].each do |callback| - the_callback = klass.instance_variable_get("@#{callback.to_s}_callbacks") + ivar = "@#{callback.to_s}_callbacks" + the_callback = klass.instance_variable_get(ivar) if klass.instance_variable_defined?(ivar) repair[klass][callback] = (the_callback.nil? ? nil : the_callback.dup) end repair diff --git a/activemodel/test/cases/observing_test.rb b/activemodel/test/cases/observing_test.rb index fbf93c19ef..e23bda0528 100644 --- a/activemodel/test/cases/observing_test.rb +++ b/activemodel/test/cases/observing_test.rb @@ -78,6 +78,7 @@ class ObserverTest < ActiveModel::TestCase def teardown FooObserver.instance_eval do + undef_method :observed_classes alias_method :observed_classes, :original_observed_classes end end diff --git a/activemodel/test/cases/serializeration/json_serialization_test.rb b/activemodel/test/cases/serializeration/json_serialization_test.rb index 6227aedc39..81df52fcb9 100644 --- a/activemodel/test/cases/serializeration/json_serialization_test.rb +++ b/activemodel/test/cases/serializeration/json_serialization_test.rb @@ -1,12 +1,14 @@ require 'cases/helper' require 'models/contact' +require 'active_support/core_ext/object/instance_variables' class Contact + extend ActiveModel::Naming include ActiveModel::Serializers::JSON def attributes instance_values - end + end unless method_defined?(:attributes) end class JsonSerializationTest < ActiveModel::TestCase diff --git a/activemodel/test/cases/serializeration/xml_serialization_test.rb b/activemodel/test/cases/serializeration/xml_serialization_test.rb index 428e5a6bd1..6340aad531 100644 --- a/activemodel/test/cases/serializeration/xml_serialization_test.rb +++ b/activemodel/test/cases/serializeration/xml_serialization_test.rb @@ -1,12 +1,14 @@ require 'cases/helper' require 'models/contact' +require 'active_support/core_ext/object/instance_variables' class Contact + extend ActiveModel::Naming include ActiveModel::Serializers::Xml def attributes instance_values - end + end unless method_defined?(:attributes) end module Admin diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index cc68d847a2..544b680b4b 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -107,32 +107,6 @@ class I18nValidationTest < ActiveModel::TestCase @person.valid? end - def test_validates_length_of_within_generates_message_with_title_too_short - Person.validates_length_of :title, :within => 3..5 - @person.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => nil}) - @person.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_short_and_custom_default_message - Person.validates_length_of :title, :within => 3..5, :too_short => 'custom' - @person.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => 'custom'}) - @person.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long - Person.validates_length_of :title, :within => 3..5 - @person.title = 'this title is too long' - @person.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => nil}) - @person.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long_and_custom_default_message - Person.validates_length_of :title, :within => 3..5, :too_long => 'custom' - @person.title = 'this title is too long' - @person.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => 'custom'}) - @person.valid? - end - # validates_length_of :within w/ mocha def test_validates_length_of_within_generates_message_with_title_too_short @@ -280,7 +254,7 @@ class I18nValidationTest < ActiveModel::TestCase @person.valid? end - def test_validates_numericality_of_odd_generates_message_with_custom_default_message + def test_validates_numericality_of_less_than_odd_generates_message_with_custom_default_message Person.validates_numericality_of :title, :only_integer => true, :less_than => 0, :message => 'custom' @person.title = 1 @person.errors.expects(:generate_message).with(:title, :less_than, {:value => 1, :count => 0, :default => 'custom'}) @@ -384,24 +358,6 @@ class I18nValidationTest < ActiveModel::TestCase assert_equal ['global message'], @person.errors[:title] end - def test_validates_length_of_is_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:wrong_length => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activemodel => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Person.validates_length_of :title, :is => 5 - @person.valid? - assert_equal ['custom message'], @person.errors[:title] - end - - def test_validates_length_of_is_finds_global_default_translation - I18n.backend.store_translations 'en', :activemodel => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Person.validates_length_of :title, :is => 5 - @person.valid? - assert_equal ['global message'], @person.errors[:title] - end - - # validates_format_of w/o mocha def test_validates_format_of_finds_custom_model_key_translation diff --git a/activemodel/test/cases/validations/presence_validation_test.rb b/activemodel/test/cases/validations/presence_validation_test.rb index bb6fb91774..90b0951a77 100644 --- a/activemodel/test/cases/validations/presence_validation_test.rb +++ b/activemodel/test/cases/validations/presence_validation_test.rb @@ -5,6 +5,7 @@ require 'cases/tests_database' require 'models/topic' require 'models/developer' require 'models/person' +require 'models/custom_reader' class PresenceValidationTest < ActiveModel::TestCase include ActiveModel::TestsDatabase diff --git a/activemodel/test/cases/validations/with_validation_test.rb b/activemodel/test/cases/validations/with_validation_test.rb index f55fdc5864..c290b49a28 100644 --- a/activemodel/test/cases/validations/with_validation_test.rb +++ b/activemodel/test/cases/validations/with_validation_test.rb @@ -1,9 +1,11 @@ # encoding: utf-8 require 'cases/helper' +require 'cases/tests_database' require 'models/topic' class ValidatesWithTest < ActiveRecord::TestCase + include ActiveModel::TestsDatabase include ActiveModel::ValidationsRepairHelper repair_validations(Topic) diff --git a/activerecord/Rakefile b/activerecord/Rakefile index e8c6c1ae67..aa2c998d07 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -208,6 +208,7 @@ spec = Gem::Specification.new do |s| end s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD) + s.add_dependency('activemodel', '= 3.0.pre' + PKG_BUILD) s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite" s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite" diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index ca614c5da0..af61f18fe8 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -7,11 +7,11 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.autorequire = %q{active_record} - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database tables and classes together for business objects, like Customer or Subscription, that can find, save, and destroy themselves without resorting to manual SQL.} s.email = %q{david@loudthinking.com} s.extra_rdoc_files = ["README"] - s.files = ["Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "lib/active_record", "lib/active_record/aggregations.rb", "lib/active_record/association_preload.rb", "lib/active_record/associations", "lib/active_record/associations/association_collection.rb", "lib/active_record/associations/association_proxy.rb", "lib/active_record/associations/belongs_to_association.rb", "lib/active_record/associations/belongs_to_polymorphic_association.rb", "lib/active_record/associations/has_and_belongs_to_many_association.rb", "lib/active_record/associations/has_many_association.rb", "lib/active_record/associations/has_many_through_association.rb", "lib/active_record/associations/has_one_association.rb", "lib/active_record/associations/has_one_through_association.rb", "lib/active_record/associations/through_association_scope.rb", "lib/active_record/associations.rb", "lib/active_record/attribute_methods", "lib/active_record/attribute_methods/before_type_cast.rb", "lib/active_record/attribute_methods/dirty.rb", "lib/active_record/attribute_methods/primary_key.rb", "lib/active_record/attribute_methods/query.rb", "lib/active_record/attribute_methods/read.rb", "lib/active_record/attribute_methods/time_zone_conversion.rb", "lib/active_record/attribute_methods/write.rb", "lib/active_record/attribute_methods.rb", "lib/active_record/autosave_association.rb", "lib/active_record/base.rb", "lib/active_record/batches.rb", "lib/active_record/calculations.rb", "lib/active_record/callbacks.rb", "lib/active_record/connection_adapters", "lib/active_record/connection_adapters/abstract", "lib/active_record/connection_adapters/abstract/connection_pool.rb", "lib/active_record/connection_adapters/abstract/connection_specification.rb", "lib/active_record/connection_adapters/abstract/database_statements.rb", "lib/active_record/connection_adapters/abstract/query_cache.rb", "lib/active_record/connection_adapters/abstract/quoting.rb", "lib/active_record/connection_adapters/abstract/schema_definitions.rb", "lib/active_record/connection_adapters/abstract/schema_statements.rb", "lib/active_record/connection_adapters/abstract_adapter.rb", "lib/active_record/connection_adapters/mysql_adapter.rb", "lib/active_record/connection_adapters/postgresql_adapter.rb", "lib/active_record/connection_adapters/sqlite3_adapter.rb", "lib/active_record/connection_adapters/sqlite_adapter.rb", "lib/active_record/dynamic_finder_match.rb", "lib/active_record/dynamic_scope_match.rb", "lib/active_record/fixtures.rb", "lib/active_record/locale", "lib/active_record/locale/en.yml", "lib/active_record/locking", "lib/active_record/locking/optimistic.rb", "lib/active_record/locking/pessimistic.rb", "lib/active_record/migration.rb", "lib/active_record/named_scope.rb", "lib/active_record/nested_attributes.rb", "lib/active_record/observer.rb", "lib/active_record/query_cache.rb", "lib/active_record/reflection.rb", "lib/active_record/schema.rb", "lib/active_record/schema_dumper.rb", "lib/active_record/serialization.rb", "lib/active_record/serializers", "lib/active_record/serializers/xml_serializer.rb", "lib/active_record/session_store.rb", "lib/active_record/state_machine.rb", "lib/active_record/test_case.rb", "lib/active_record/timestamp.rb", "lib/active_record/transactions.rb", "lib/active_record/validations", "lib/active_record/validations/associated.rb", "lib/active_record/validations/uniqueness.rb", "lib/active_record/validations.rb", "lib/active_record/validator.rb", "lib/active_record/version.rb", "lib/active_record.rb", "lib/activerecord.rb", "test/assets", "test/assets/example.log", "test/assets/flowers.jpg", "test/cases", "test/cases/active_schema_test_mysql.rb", "test/cases/active_schema_test_postgresql.rb", "test/cases/adapter_test.rb", "test/cases/aggregations_test.rb", "test/cases/ar_schema_test.rb", "test/cases/associations", "test/cases/associations/belongs_to_associations_test.rb", "test/cases/associations/callbacks_test.rb", "test/cases/associations/cascaded_eager_loading_test.rb", "test/cases/associations/eager_load_includes_full_sti_class_test.rb", "test/cases/associations/eager_load_nested_include_test.rb", "test/cases/associations/eager_singularization_test.rb", "test/cases/associations/eager_test.rb", "test/cases/associations/extension_test.rb", "test/cases/associations/habtm_join_table_test.rb", "test/cases/associations/has_and_belongs_to_many_associations_test.rb", "test/cases/associations/has_many_associations_test.rb", "test/cases/associations/has_many_through_associations_test.rb", "test/cases/associations/has_one_associations_test.rb", "test/cases/associations/has_one_through_associations_test.rb", "test/cases/associations/inner_join_association_test.rb", "test/cases/associations/inverse_associations_test.rb", "test/cases/associations/join_model_test.rb", "test/cases/associations_test.rb", "test/cases/attribute_methods_test.rb", "test/cases/autosave_association_test.rb", "test/cases/base_test.rb", "test/cases/batches_test.rb", "test/cases/binary_test.rb", "test/cases/calculations_test.rb", "test/cases/callbacks_observers_test.rb", "test/cases/callbacks_test.rb", "test/cases/class_inheritable_attributes_test.rb", "test/cases/column_alias_test.rb", "test/cases/column_definition_test.rb", "test/cases/connection_pool_test.rb", "test/cases/connection_test_firebird.rb", "test/cases/connection_test_mysql.rb", "test/cases/copy_table_test_sqlite.rb", "test/cases/database_statements_test.rb", "test/cases/datatype_test_postgresql.rb", "test/cases/date_time_test.rb", "test/cases/default_test_firebird.rb", "test/cases/defaults_test.rb", "test/cases/deprecated_finder_test.rb", "test/cases/dirty_test.rb", "test/cases/finder_respond_to_test.rb", "test/cases/finder_test.rb", "test/cases/fixtures_test.rb", "test/cases/helper.rb", "test/cases/i18n_test.rb", "test/cases/inheritance_test.rb", "test/cases/invalid_date_test.rb", "test/cases/json_serialization_test.rb", "test/cases/lifecycle_test.rb", "test/cases/locking_test.rb", "test/cases/method_scoping_test.rb", "test/cases/migration_test.rb", "test/cases/migration_test_firebird.rb", "test/cases/mixin_test.rb", "test/cases/modules_test.rb", "test/cases/multiple_db_test.rb", "test/cases/named_scope_test.rb", "test/cases/nested_attributes_test.rb", "test/cases/pk_test.rb", "test/cases/pooled_connections_test.rb", "test/cases/query_cache_test.rb", "test/cases/readonly_test.rb", "test/cases/reflection_test.rb", "test/cases/reload_models_test.rb", "test/cases/repair_helper.rb", "test/cases/reserved_word_test_mysql.rb", "test/cases/sanitize_test.rb", "test/cases/schema_authorization_test_postgresql.rb", "test/cases/schema_dumper_test.rb", "test/cases/schema_test_postgresql.rb", "test/cases/serialization_test.rb", "test/cases/state_machine_test.rb", "test/cases/synonym_test_oracle.rb", "test/cases/timestamp_test.rb", "test/cases/transactions_test.rb", "test/cases/unconnected_test.rb", "test/cases/validations", "test/cases/validations/association_validation_test.rb", "test/cases/validations/i18n_generate_message_validation_test.rb", "test/cases/validations/i18n_validation_test.rb", "test/cases/validations/uniqueness_validation_test.rb", "test/cases/validations_test.rb", "test/cases/xml_serialization_test.rb", "test/config.rb", "test/connections", "test/connections/jdbc_jdbcderby", "test/connections/jdbc_jdbcderby/connection.rb", "test/connections/jdbc_jdbch2", "test/connections/jdbc_jdbch2/connection.rb", "test/connections/jdbc_jdbchsqldb", "test/connections/jdbc_jdbchsqldb/connection.rb", "test/connections/jdbc_jdbcmysql", "test/connections/jdbc_jdbcmysql/connection.rb", "test/connections/jdbc_jdbcpostgresql", "test/connections/jdbc_jdbcpostgresql/connection.rb", "test/connections/jdbc_jdbcsqlite3", "test/connections/jdbc_jdbcsqlite3/connection.rb", "test/connections/native_db2", "test/connections/native_db2/connection.rb", "test/connections/native_firebird", "test/connections/native_firebird/connection.rb", "test/connections/native_frontbase", "test/connections/native_frontbase/connection.rb", "test/connections/native_mysql", "test/connections/native_mysql/connection.rb", "test/connections/native_openbase", "test/connections/native_openbase/connection.rb", "test/connections/native_oracle", "test/connections/native_oracle/connection.rb", "test/connections/native_postgresql", "test/connections/native_postgresql/connection.rb", "test/connections/native_sqlite3", "test/connections/native_sqlite3/connection.rb", "test/connections/native_sqlite3/in_memory_connection.rb", "test/connections/native_sybase", "test/connections/native_sybase/connection.rb", "test/fixtures", "test/fixtures/accounts.yml", "test/fixtures/all", "test/fixtures/all/developers.yml", "test/fixtures/all/people.csv", "test/fixtures/all/tasks.yml", "test/fixtures/author_addresses.yml", "test/fixtures/author_favorites.yml", "test/fixtures/authors.yml", "test/fixtures/binaries.yml", "test/fixtures/books.yml", "test/fixtures/categories", "test/fixtures/categories/special_categories.yml", "test/fixtures/categories/subsubdir", "test/fixtures/categories/subsubdir/arbitrary_filename.yml", "test/fixtures/categories.yml", "test/fixtures/categories_ordered.yml", "test/fixtures/categories_posts.yml", "test/fixtures/categorizations.yml", "test/fixtures/clubs.yml", "test/fixtures/comments.yml", "test/fixtures/companies.yml", "test/fixtures/computers.yml", "test/fixtures/courses.yml", "test/fixtures/customers.yml", "test/fixtures/developers.yml", "test/fixtures/developers_projects.yml", "test/fixtures/edges.yml", "test/fixtures/entrants.yml", "test/fixtures/faces.yml", "test/fixtures/fk_test_has_fk.yml", "test/fixtures/fk_test_has_pk.yml", "test/fixtures/funny_jokes.yml", "test/fixtures/interests.yml", "test/fixtures/items.yml", "test/fixtures/jobs.yml", "test/fixtures/legacy_things.yml", "test/fixtures/mateys.yml", "test/fixtures/member_types.yml", "test/fixtures/members.yml", "test/fixtures/memberships.yml", "test/fixtures/men.yml", "test/fixtures/minimalistics.yml", "test/fixtures/mixed_case_monkeys.yml", "test/fixtures/mixins.yml", "test/fixtures/movies.yml", "test/fixtures/naked", "test/fixtures/naked/csv", "test/fixtures/naked/csv/accounts.csv", "test/fixtures/naked/yml", "test/fixtures/naked/yml/accounts.yml", "test/fixtures/naked/yml/companies.yml", "test/fixtures/naked/yml/courses.yml", "test/fixtures/organizations.yml", "test/fixtures/owners.yml", "test/fixtures/parrots.yml", "test/fixtures/parrots_pirates.yml", "test/fixtures/people.yml", "test/fixtures/pets.yml", "test/fixtures/pirates.yml", "test/fixtures/posts.yml", "test/fixtures/price_estimates.yml", "test/fixtures/projects.yml", "test/fixtures/readers.yml", "test/fixtures/references.yml", "test/fixtures/reserved_words", "test/fixtures/reserved_words/distinct.yml", "test/fixtures/reserved_words/distincts_selects.yml", "test/fixtures/reserved_words/group.yml", "test/fixtures/reserved_words/select.yml", "test/fixtures/reserved_words/values.yml", "test/fixtures/ships.yml", "test/fixtures/sponsors.yml", "test/fixtures/subscribers.yml", "test/fixtures/subscriptions.yml", "test/fixtures/taggings.yml", "test/fixtures/tags.yml", "test/fixtures/tasks.yml", "test/fixtures/topics.yml", "test/fixtures/toys.yml", "test/fixtures/treasures.yml", "test/fixtures/vertices.yml", "test/fixtures/warehouse-things.yml", "test/fixtures/zines.yml", "test/migrations", "test/migrations/broken", "test/migrations/broken/100_migration_that_raises_exception.rb", "test/migrations/decimal", "test/migrations/decimal/1_give_me_big_numbers.rb", "test/migrations/duplicate", "test/migrations/duplicate/1_people_have_last_names.rb", "test/migrations/duplicate/2_we_need_reminders.rb", "test/migrations/duplicate/3_foo.rb", "test/migrations/duplicate/3_innocent_jointable.rb", "test/migrations/duplicate_names", "test/migrations/duplicate_names/20080507052938_chunky.rb", "test/migrations/duplicate_names/20080507053028_chunky.rb", "test/migrations/interleaved", "test/migrations/interleaved/pass_1", "test/migrations/interleaved/pass_1/3_innocent_jointable.rb", "test/migrations/interleaved/pass_2", "test/migrations/interleaved/pass_2/1_people_have_last_names.rb", "test/migrations/interleaved/pass_2/3_innocent_jointable.rb", "test/migrations/interleaved/pass_3", "test/migrations/interleaved/pass_3/1_people_have_last_names.rb", "test/migrations/interleaved/pass_3/2_i_raise_on_down.rb", "test/migrations/interleaved/pass_3/3_innocent_jointable.rb", "test/migrations/missing", "test/migrations/missing/1000_people_have_middle_names.rb", "test/migrations/missing/1_people_have_last_names.rb", "test/migrations/missing/3_we_need_reminders.rb", "test/migrations/missing/4_innocent_jointable.rb", "test/migrations/valid", "test/migrations/valid/1_people_have_last_names.rb", "test/migrations/valid/2_we_need_reminders.rb", "test/migrations/valid/3_innocent_jointable.rb", "test/models", "test/models/author.rb", "test/models/auto_id.rb", "test/models/binary.rb", "test/models/bird.rb", "test/models/book.rb", "test/models/categorization.rb", "test/models/category.rb", "test/models/citation.rb", "test/models/club.rb", "test/models/column_name.rb", "test/models/comment.rb", "test/models/company.rb", "test/models/company_in_module.rb", "test/models/computer.rb", "test/models/contact.rb", "test/models/contract.rb", "test/models/course.rb", "test/models/customer.rb", "test/models/default.rb", "test/models/developer.rb", "test/models/edge.rb", "test/models/entrant.rb", "test/models/essay.rb", "test/models/event.rb", "test/models/face.rb", "test/models/guid.rb", "test/models/interest.rb", "test/models/item.rb", "test/models/job.rb", "test/models/joke.rb", "test/models/keyboard.rb", "test/models/legacy_thing.rb", "test/models/man.rb", "test/models/matey.rb", "test/models/member.rb", "test/models/member_detail.rb", "test/models/member_type.rb", "test/models/membership.rb", "test/models/minimalistic.rb", "test/models/mixed_case_monkey.rb", "test/models/movie.rb", "test/models/order.rb", "test/models/organization.rb", "test/models/owner.rb", "test/models/parrot.rb", "test/models/person.rb", "test/models/pet.rb", "test/models/pirate.rb", "test/models/post.rb", "test/models/price_estimate.rb", "test/models/project.rb", "test/models/reader.rb", "test/models/reference.rb", "test/models/reply.rb", "test/models/ship.rb", "test/models/ship_part.rb", "test/models/sponsor.rb", "test/models/subject.rb", "test/models/subscriber.rb", "test/models/subscription.rb", "test/models/tag.rb", "test/models/tagging.rb", "test/models/task.rb", "test/models/topic.rb", "test/models/toy.rb", "test/models/traffic_light.rb", "test/models/treasure.rb", "test/models/vertex.rb", "test/models/warehouse_thing.rb", "test/models/zine.rb", "test/schema", "test/schema/mysql_specific_schema.rb", "test/schema/oracle_specific_schema.rb", "test/schema/postgresql_specific_schema.rb", "test/schema/schema.rb", "test/schema/sqlite_specific_schema.rb", "examples/associations.png", "examples/performance.rb", "examples/simple.rb"] + s.files = ["Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "lib/active_record", "lib/active_record/aggregations.rb", "lib/active_record/association_preload.rb", "lib/active_record/associations", "lib/active_record/associations/association_collection.rb", "lib/active_record/associations/association_proxy.rb", "lib/active_record/associations/belongs_to_association.rb", "lib/active_record/associations/belongs_to_polymorphic_association.rb", "lib/active_record/associations/has_and_belongs_to_many_association.rb", "lib/active_record/associations/has_many_association.rb", "lib/active_record/associations/has_many_through_association.rb", "lib/active_record/associations/has_one_association.rb", "lib/active_record/associations/has_one_through_association.rb", "lib/active_record/associations/through_association_scope.rb", "lib/active_record/associations.rb", "lib/active_record/attribute_methods", "lib/active_record/attribute_methods/before_type_cast.rb", "lib/active_record/attribute_methods/dirty.rb", "lib/active_record/attribute_methods/primary_key.rb", "lib/active_record/attribute_methods/query.rb", "lib/active_record/attribute_methods/read.rb", "lib/active_record/attribute_methods/time_zone_conversion.rb", "lib/active_record/attribute_methods/write.rb", "lib/active_record/attribute_methods.rb", "lib/active_record/autosave_association.rb", "lib/active_record/base.rb", "lib/active_record/batches.rb", "lib/active_record/calculations.rb", "lib/active_record/callbacks.rb", "lib/active_record/connection_adapters", "lib/active_record/connection_adapters/abstract", "lib/active_record/connection_adapters/abstract/connection_pool.rb", "lib/active_record/connection_adapters/abstract/connection_specification.rb", "lib/active_record/connection_adapters/abstract/database_statements.rb", "lib/active_record/connection_adapters/abstract/query_cache.rb", "lib/active_record/connection_adapters/abstract/quoting.rb", "lib/active_record/connection_adapters/abstract/schema_definitions.rb", "lib/active_record/connection_adapters/abstract/schema_statements.rb", "lib/active_record/connection_adapters/abstract_adapter.rb", "lib/active_record/connection_adapters/mysql_adapter.rb", "lib/active_record/connection_adapters/postgresql_adapter.rb", "lib/active_record/connection_adapters/sqlite3_adapter.rb", "lib/active_record/connection_adapters/sqlite_adapter.rb", "lib/active_record/dynamic_finder_match.rb", "lib/active_record/dynamic_scope_match.rb", "lib/active_record/fixtures.rb", "lib/active_record/locale", "lib/active_record/locale/en.yml", "lib/active_record/locking", "lib/active_record/locking/optimistic.rb", "lib/active_record/locking/pessimistic.rb", "lib/active_record/migration.rb", "lib/active_record/named_scope.rb", "lib/active_record/nested_attributes.rb", "lib/active_record/observer.rb", "lib/active_record/query_cache.rb", "lib/active_record/reflection.rb", "lib/active_record/schema.rb", "lib/active_record/schema_dumper.rb", "lib/active_record/serialization.rb", "lib/active_record/serializers", "lib/active_record/serializers/xml_serializer.rb", "lib/active_record/session_store.rb", "lib/active_record/state_machine.rb", "lib/active_record/test_case.rb", "lib/active_record/timestamp.rb", "lib/active_record/transactions.rb", "lib/active_record/validations", "lib/active_record/validations/associated.rb", "lib/active_record/validations/uniqueness.rb", "lib/active_record/validations.rb", "lib/active_record/validator.rb", "lib/active_record/version.rb", "lib/active_record.rb", "lib/activerecord.rb", "test/assets", "test/assets/example.log", "test/assets/flowers.jpg", "test/cases", "test/cases/active_schema_test_mysql.rb", "test/cases/active_schema_test_postgresql.rb", "test/cases/adapter_test.rb", "test/cases/aggregations_test.rb", "test/cases/ar_schema_test.rb", "test/cases/associations", "test/cases/associations/belongs_to_associations_test.rb", "test/cases/associations/callbacks_test.rb", "test/cases/associations/cascaded_eager_loading_test.rb", "test/cases/associations/eager_load_includes_full_sti_class_test.rb", "test/cases/associations/eager_load_nested_include_test.rb", "test/cases/associations/eager_singularization_test.rb", "test/cases/associations/eager_test.rb", "test/cases/associations/extension_test.rb", "test/cases/associations/habtm_join_table_test.rb", "test/cases/associations/has_and_belongs_to_many_associations_test.rb", "test/cases/associations/has_many_associations_test.rb", "test/cases/associations/has_many_through_associations_test.rb", "test/cases/associations/has_one_associations_test.rb", "test/cases/associations/has_one_through_associations_test.rb", "test/cases/associations/inner_join_association_test.rb", "test/cases/associations/inverse_associations_test.rb", "test/cases/associations/join_model_test.rb", "test/cases/associations_test.rb", "test/cases/attribute_methods_test.rb", "test/cases/autosave_association_test.rb", "test/cases/base_test.rb", "test/cases/batches_test.rb", "test/cases/binary_test.rb", "test/cases/calculations_test.rb", "test/cases/callbacks_observers_test.rb", "test/cases/callbacks_test.rb", "test/cases/class_inheritable_attributes_test.rb", "test/cases/column_alias_test.rb", "test/cases/column_definition_test.rb", "test/cases/connection_pool_test.rb", "test/cases/connection_test_firebird.rb", "test/cases/connection_test_mysql.rb", "test/cases/copy_table_test_sqlite.rb", "test/cases/database_statements_test.rb", "test/cases/datatype_test_postgresql.rb", "test/cases/date_time_test.rb", "test/cases/default_test_firebird.rb", "test/cases/defaults_test.rb", "test/cases/deprecated_finder_test.rb", "test/cases/dirty_test.rb", "test/cases/finder_respond_to_test.rb", "test/cases/finder_test.rb", "test/cases/fixtures_test.rb", "test/cases/helper.rb", "test/cases/i18n_test.rb", "test/cases/inheritance_test.rb", "test/cases/invalid_date_test.rb", "test/cases/json_serialization_test.rb", "test/cases/lifecycle_test.rb", "test/cases/locking_test.rb", "test/cases/method_scoping_test.rb", "test/cases/migration_test.rb", "test/cases/migration_test_firebird.rb", "test/cases/mixin_test.rb", "test/cases/modules_test.rb", "test/cases/multiple_db_test.rb", "test/cases/named_scope_test.rb", "test/cases/nested_attributes_test.rb", "test/cases/pk_test.rb", "test/cases/pooled_connections_test.rb", "test/cases/query_cache_test.rb", "test/cases/readonly_test.rb", "test/cases/reflection_test.rb", "test/cases/reload_models_test.rb", "test/cases/repair_helper.rb", "test/cases/reserved_word_test_mysql.rb", "test/cases/sanitize_test.rb", "test/cases/schema_authorization_test_postgresql.rb", "test/cases/schema_dumper_test.rb", "test/cases/schema_test_postgresql.rb", "test/cases/serialization_test.rb", "test/cases/state_machine_test.rb", "test/cases/synonym_test_oracle.rb", "test/cases/timestamp_test.rb", "test/cases/transactions_test.rb", "test/cases/unconnected_test.rb", "test/cases/validations", "test/cases/validations/association_validation_test.rb", "test/cases/validations/i18n_generate_message_validation_test.rb", "test/cases/validations/i18n_validation_test.rb", "test/cases/validations/uniqueness_validation_test.rb", "test/cases/validations_test.rb", "test/cases/xml_serialization_test.rb", "test/config.rb", "test/connections", "test/connections/jdbc_jdbcderby", "test/connections/jdbc_jdbcderby/connection.rb", "test/connections/jdbc_jdbch2", "test/connections/jdbc_jdbch2/connection.rb", "test/connections/jdbc_jdbchsqldb", "test/connections/jdbc_jdbchsqldb/connection.rb", "test/connections/jdbc_jdbcmysql", "test/connections/jdbc_jdbcmysql/connection.rb", "test/connections/jdbc_jdbcpostgresql", "test/connections/jdbc_jdbcpostgresql/connection.rb", "test/connections/jdbc_jdbcsqlite3", "test/connections/jdbc_jdbcsqlite3/connection.rb", "test/connections/native_db2", "test/connections/native_db2/connection.rb", "test/connections/native_firebird", "test/connections/native_firebird/connection.rb", "test/connections/native_frontbase", "test/connections/native_frontbase/connection.rb", "test/connections/native_mysql", "test/connections/native_mysql/connection.rb", "test/connections/native_openbase", "test/connections/native_openbase/connection.rb", "test/connections/native_oracle", "test/connections/native_oracle/connection.rb", "test/connections/native_postgresql", "test/connections/native_postgresql/connection.rb", "test/connections/native_sqlite3", "test/connections/native_sqlite3/connection.rb", "test/connections/native_sqlite3/in_memory_connection.rb", "test/connections/native_sybase", "test/connections/native_sybase/connection.rb", "test/fixtures", "test/fixtures/accounts.yml", "test/fixtures/all", "test/fixtures/all/developers.yml", "test/fixtures/all/people.csv", "test/fixtures/all/tasks.yml", "test/fixtures/author_addresses.yml", "test/fixtures/author_favorites.yml", "test/fixtures/authors.yml", "test/fixtures/binaries.yml", "test/fixtures/books.yml", "test/fixtures/categories", "test/fixtures/categories/special_categories.yml", "test/fixtures/categories/subsubdir", "test/fixtures/categories/subsubdir/arbitrary_filename.yml", "test/fixtures/categories.yml", "test/fixtures/categories_ordered.yml", "test/fixtures/categories_posts.yml", "test/fixtures/categorizations.yml", "test/fixtures/clubs.yml", "test/fixtures/comments.yml", "test/fixtures/companies.yml", "test/fixtures/computers.yml", "test/fixtures/courses.yml", "test/fixtures/customers.yml", "test/fixtures/developers.yml", "test/fixtures/developers_projects.yml", "test/fixtures/edges.yml", "test/fixtures/entrants.yml", "test/fixtures/faces.yml", "test/fixtures/fixture_database.sqlite3", "test/fixtures/fixture_database_2.sqlite3", "test/fixtures/fk_test_has_fk.yml", "test/fixtures/fk_test_has_pk.yml", "test/fixtures/funny_jokes.yml", "test/fixtures/interests.yml", "test/fixtures/items.yml", "test/fixtures/jobs.yml", "test/fixtures/legacy_things.yml", "test/fixtures/mateys.yml", "test/fixtures/member_types.yml", "test/fixtures/members.yml", "test/fixtures/memberships.yml", "test/fixtures/men.yml", "test/fixtures/minimalistics.yml", "test/fixtures/mixed_case_monkeys.yml", "test/fixtures/mixins.yml", "test/fixtures/movies.yml", "test/fixtures/naked", "test/fixtures/naked/csv", "test/fixtures/naked/csv/accounts.csv", "test/fixtures/naked/yml", "test/fixtures/naked/yml/accounts.yml", "test/fixtures/naked/yml/companies.yml", "test/fixtures/naked/yml/courses.yml", "test/fixtures/organizations.yml", "test/fixtures/owners.yml", "test/fixtures/parrots.yml", "test/fixtures/parrots_pirates.yml", "test/fixtures/people.yml", "test/fixtures/pets.yml", "test/fixtures/pirates.yml", "test/fixtures/posts.yml", "test/fixtures/price_estimates.yml", "test/fixtures/projects.yml", "test/fixtures/readers.yml", "test/fixtures/references.yml", "test/fixtures/reserved_words", "test/fixtures/reserved_words/distinct.yml", "test/fixtures/reserved_words/distincts_selects.yml", "test/fixtures/reserved_words/group.yml", "test/fixtures/reserved_words/select.yml", "test/fixtures/reserved_words/values.yml", "test/fixtures/ships.yml", "test/fixtures/sponsors.yml", "test/fixtures/subscribers.yml", "test/fixtures/subscriptions.yml", "test/fixtures/taggings.yml", "test/fixtures/tags.yml", "test/fixtures/tasks.yml", "test/fixtures/topics.yml", "test/fixtures/toys.yml", "test/fixtures/treasures.yml", "test/fixtures/vertices.yml", "test/fixtures/warehouse-things.yml", "test/fixtures/zines.yml", "test/migrations", "test/migrations/broken", "test/migrations/broken/100_migration_that_raises_exception.rb", "test/migrations/decimal", "test/migrations/decimal/1_give_me_big_numbers.rb", "test/migrations/duplicate", "test/migrations/duplicate/1_people_have_last_names.rb", "test/migrations/duplicate/2_we_need_reminders.rb", "test/migrations/duplicate/3_foo.rb", "test/migrations/duplicate/3_innocent_jointable.rb", "test/migrations/duplicate_names", "test/migrations/duplicate_names/20080507052938_chunky.rb", "test/migrations/duplicate_names/20080507053028_chunky.rb", "test/migrations/interleaved", "test/migrations/interleaved/pass_1", "test/migrations/interleaved/pass_1/3_innocent_jointable.rb", "test/migrations/interleaved/pass_2", "test/migrations/interleaved/pass_2/1_people_have_last_names.rb", "test/migrations/interleaved/pass_2/3_innocent_jointable.rb", "test/migrations/interleaved/pass_3", "test/migrations/interleaved/pass_3/1_people_have_last_names.rb", "test/migrations/interleaved/pass_3/2_i_raise_on_down.rb", "test/migrations/interleaved/pass_3/3_innocent_jointable.rb", "test/migrations/missing", "test/migrations/missing/1000_people_have_middle_names.rb", "test/migrations/missing/1_people_have_last_names.rb", "test/migrations/missing/3_we_need_reminders.rb", "test/migrations/missing/4_innocent_jointable.rb", "test/migrations/valid", "test/migrations/valid/1_people_have_last_names.rb", "test/migrations/valid/2_we_need_reminders.rb", "test/migrations/valid/3_innocent_jointable.rb", "test/models", "test/models/author.rb", "test/models/auto_id.rb", "test/models/binary.rb", "test/models/bird.rb", "test/models/book.rb", "test/models/categorization.rb", "test/models/category.rb", "test/models/citation.rb", "test/models/club.rb", "test/models/column_name.rb", "test/models/comment.rb", "test/models/company.rb", "test/models/company_in_module.rb", "test/models/computer.rb", "test/models/contact.rb", "test/models/contract.rb", "test/models/course.rb", "test/models/customer.rb", "test/models/default.rb", "test/models/developer.rb", "test/models/edge.rb", "test/models/entrant.rb", "test/models/essay.rb", "test/models/event.rb", "test/models/face.rb", "test/models/guid.rb", "test/models/interest.rb", "test/models/item.rb", "test/models/job.rb", "test/models/joke.rb", "test/models/keyboard.rb", "test/models/legacy_thing.rb", "test/models/man.rb", "test/models/matey.rb", "test/models/member.rb", "test/models/member_detail.rb", "test/models/member_type.rb", "test/models/membership.rb", "test/models/minimalistic.rb", "test/models/mixed_case_monkey.rb", "test/models/movie.rb", "test/models/order.rb", "test/models/organization.rb", "test/models/owner.rb", "test/models/parrot.rb", "test/models/person.rb", "test/models/pet.rb", "test/models/pirate.rb", "test/models/post.rb", "test/models/price_estimate.rb", "test/models/project.rb", "test/models/reader.rb", "test/models/reference.rb", "test/models/reply.rb", "test/models/ship.rb", "test/models/ship_part.rb", "test/models/sponsor.rb", "test/models/subject.rb", "test/models/subscriber.rb", "test/models/subscription.rb", "test/models/tag.rb", "test/models/tagging.rb", "test/models/task.rb", "test/models/topic.rb", "test/models/toy.rb", "test/models/traffic_light.rb", "test/models/treasure.rb", "test/models/vertex.rb", "test/models/warehouse_thing.rb", "test/models/zine.rb", "test/schema", "test/schema/mysql_specific_schema.rb", "test/schema/oracle_specific_schema.rb", "test/schema/postgresql_specific_schema.rb", "test/schema/schema.rb", "test/schema/sqlite_specific_schema.rb", "examples/associations.png", "examples/performance.rb", "examples/simple.rb"] s.homepage = %q{http://www.rubyonrails.org} s.rdoc_options = ["--main", "README"] s.require_paths = ["lib"] @@ -25,10 +25,13 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_runtime_dependency(%q<activemodel>, ["= 3.0.pre"]) else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end end diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 98a633eb41..b363cceccb 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -60,12 +60,6 @@ module ActiveRecord end end - class HasAndBelongsToManyAssociationWithPrimaryKeyError < ActiveRecordError #:nodoc: - def initialize(reflection) - super("Primary key is not allowed in a has_and_belongs_to_many join table (#{reflection.options[:join_table]}).") - end - end - class HasAndBelongsToManyAssociationForeignKeyNeeded < ActiveRecordError #:nodoc: def initialize(reflection) super("Cannot create self referential has_and_belongs_to_many association on '#{reflection.class_name rescue nil}##{reflection.name rescue nil}'. :association_foreign_key cannot be the same as the :foreign_key.") @@ -1658,19 +1652,16 @@ module ActiveRecord def create_has_and_belongs_to_many_reflection(association_id, options, &extension) options.assert_valid_keys(valid_keys_for_has_and_belongs_to_many_association) + options[:extend] = create_extension_modules(association_id, extension, options[:extend]) reflection = create_reflection(:has_and_belongs_to_many, association_id, options, self) - reflection.options[:join_table] ||= join_table_name(undecorated_table_name(self.to_s), undecorated_table_name(reflection.class_name)) if reflection.association_foreign_key == reflection.primary_key_name raise HasAndBelongsToManyAssociationForeignKeyNeeded.new(reflection) end - if connection.supports_primary_key? && - (connection.primary_key(reflection.options[:join_table]) rescue false) - raise HasAndBelongsToManyAssociationWithPrimaryKeyError.new(reflection) - end + reflection.options[:join_table] ||= join_table_name(undecorated_table_name(self.to_s), undecorated_table_name(reflection.class_name)) reflection end diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 21a56fefd3..da1fbfe0b7 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -1,6 +1,11 @@ module ActiveRecord module Associations class HasAndBelongsToManyAssociation < AssociationCollection #:nodoc: + def initialize(owner, reflection) + super + @primary_key_list = {} + end + def create(attributes = {}) create_record(attributes) { |record| insert_record(record) } end @@ -17,6 +22,12 @@ module ActiveRecord @reflection.reset_column_information end + def has_primary_key? + return @has_primary_key unless @has_primary_key.nil? + @has_primary_key = (ActiveRecord::Base.connection.supports_primary_key? && + ActiveRecord::Base.connection.primary_key(@reflection.options[:join_table])) + end + protected def construct_find_options!(options) options[:joins] = @join_sql @@ -29,6 +40,11 @@ module ActiveRecord end def insert_record(record, force = true, validate = true) + if has_primary_key? + raise ActiveRecord::ConfigurationError, + "Primary key is not allowed in a has_and_belongs_to_many join table (#{@reflection.options[:join_table]})." + end + if record.new_record? if force record.save! diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 402d68c36e..b279b7469a 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2949,7 +2949,9 @@ module ActiveRecord #:nodoc: end def log_protected_attribute_removal(*attributes) - logger.debug "WARNING: Can't mass-assign these protected attributes: #{attributes.join(', ')}" + if logger + logger.debug "WARNING: Can't mass-assign these protected attributes: #{attributes.join(', ')}" + end end # The primary key and inheritance column can never be set by mass-assignment for security reasons. diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 4a2ec5bf95..dd509b6c6a 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -227,7 +227,7 @@ module ActiveRecord end include ActiveSupport::Callbacks - define_callbacks *CALLBACKS + define_callbacks(*CALLBACKS) end # Is called when the object was instantiated by one of the finders, like <tt>Base.find</tt>. diff --git a/activerecord/test/cases/associations/habtm_join_table_test.rb b/activerecord/test/cases/associations/habtm_join_table_test.rb index 745f169ad7..bf3e04c3eb 100644 --- a/activerecord/test/cases/associations/habtm_join_table_test.rb +++ b/activerecord/test/cases/associations/habtm_join_table_test.rb @@ -36,9 +36,21 @@ class HabtmJoinTableTest < ActiveRecord::TestCase uses_transaction :test_should_raise_exception_when_join_table_has_a_primary_key def test_should_raise_exception_when_join_table_has_a_primary_key if ActiveRecord::Base.connection.supports_primary_key? - assert_raise ActiveRecord::HasAndBelongsToManyAssociationWithPrimaryKeyError do - MyReader.has_and_belongs_to_many :my_books + assert_raise ActiveRecord::ConfigurationError do + jaime = MyReader.create(:name=>"Jaime") + jaime.my_books << MyBook.create(:name=>'Great Expectations') end end end + + uses_transaction :test_should_cache_result_of_primary_key_check + def test_should_cache_result_of_primary_key_check + if ActiveRecord::Base.connection.supports_primary_key? + ActiveRecord::Base.connection.stubs(:primary_key).with('my_books_my_readers').returns(false).once + weaz = MyReader.create(:name=>'Weaz') + + weaz.my_books << MyBook.create(:name=>'Great Expectations') + weaz.my_books << MyBook.create(:name=>'Greater Expectations') + end + end end diff --git a/activerecord/test/cases/class_inheritable_attributes_test.rb b/activerecord/test/cases/class_inheritable_attributes_test.rb deleted file mode 100644 index abeb63c591..0000000000 --- a/activerecord/test/cases/class_inheritable_attributes_test.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'test/unit' -require "cases/helper" -require 'active_support/core_ext/class/inheritable_attributes' - -class A - include ClassInheritableAttributes -end - -class B < A - write_inheritable_array "first", [ :one, :two ] -end - -class C < A - write_inheritable_array "first", [ :three ] -end - -class D < B - write_inheritable_array "first", [ :four ] -end - - -class ClassInheritableAttributesTest < ActiveRecord::TestCase - def test_first_level - assert_equal [ :one, :two ], B.read_inheritable_attribute("first") - assert_equal [ :three ], C.read_inheritable_attribute("first") - end - - def test_second_level - assert_equal [ :one, :two, :four ], D.read_inheritable_attribute("first") - assert_equal [ :one, :two ], B.read_inheritable_attribute("first") - end -end diff --git a/activerecord/test/fixtures/edges.yml b/activerecord/test/fixtures/edges.yml index b804f7b6a6..c16c70dd2f 100644 --- a/activerecord/test/fixtures/edges.yml +++ b/activerecord/test/fixtures/edges.yml @@ -1,5 +1,6 @@ <% (1..4).each do |id| %> edge_<%= id %>: + id: <%= id %> source_id: <%= id %> sink_id: <%= id + 1 %> -<% end %> +<% end %>
\ No newline at end of file diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 5c12cb1a0c..9ab4cf6f43 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -159,7 +159,7 @@ ActiveRecord::Schema.define do t.integer :access_level, :default => 1 end - create_table :edges, :force => true, :id => false do |t| + create_table :edges, :force => true do |t| t.column :source_id, :integer, :null => false t.column :sink_id, :integer, :null => false end diff --git a/activeresource/Rakefile b/activeresource/Rakefile index 6234b159cd..54c3fe44c6 100644 --- a/activeresource/Rakefile +++ b/activeresource/Rakefile @@ -34,11 +34,12 @@ Rake::TestTask.new { |t| t.verbose = true t.warning = true } + task :isolated_test do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib" Dir.glob("test/**/*_test.rb").all? do |file| - system(ruby, "-Ilib:test:#{activesupport_path}", file) + system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file) end or raise "Failures" end @@ -74,6 +75,7 @@ spec = Gem::Specification.new do |s| end s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD) + s.add_dependency('activemodel', '= 3.0.pre' + PKG_BUILD) s.require_path = 'lib' s.autorequire = 'active_resource' diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec index 0ce1a71d5a..c3bb6e3622 100644 --- a/activeresource/activeresource.gemspec +++ b/activeresource/activeresource.gemspec @@ -7,11 +7,11 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.autorequire = %q{active_resource} - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Wraps web resources in model classes that can be manipulated through XML over REST.} s.email = %q{david@loudthinking.com} s.extra_rdoc_files = ["README"] - s.files = ["Rakefile", "README", "CHANGELOG", "lib/active_resource", "lib/active_resource/base.rb", "lib/active_resource/connection.rb", "lib/active_resource/custom_methods.rb", "lib/active_resource/exceptions.rb", "lib/active_resource/formats", "lib/active_resource/formats/json_format.rb", "lib/active_resource/formats/xml_format.rb", "lib/active_resource/formats.rb", "lib/active_resource/http_mock.rb", "lib/active_resource/observing.rb", "lib/active_resource/validations.rb", "lib/active_resource/version.rb", "lib/active_resource.rb", "lib/activeresource.rb", "test/abstract_unit.rb", "test/cases", "test/cases/authorization_test.rb", "test/cases/base", "test/cases/base/custom_methods_test.rb", "test/cases/base/equality_test.rb", "test/cases/base/load_test.rb", "test/cases/base_errors_test.rb", "test/cases/base_test.rb", "test/cases/finder_test.rb", "test/cases/format_test.rb", "test/cases/observing_test.rb", "test/cases/validations_test.rb", "test/connection_test.rb", "test/fixtures", "test/fixtures/beast.rb", "test/fixtures/customer.rb", "test/fixtures/person.rb", "test/fixtures/project.rb", "test/fixtures/proxy.rb", "test/fixtures/street_address.rb", "test/setter_trap.rb", "examples/simple.rb"] + s.files = ["Rakefile", "README", "CHANGELOG", "lib/active_resource", "lib/active_resource/base.rb", "lib/active_resource/connection.rb", "lib/active_resource/custom_methods.rb", "lib/active_resource/exceptions.rb", "lib/active_resource/formats", "lib/active_resource/formats/json_format.rb", "lib/active_resource/formats/xml_format.rb", "lib/active_resource/formats.rb", "lib/active_resource/http_mock.rb", "lib/active_resource/observing.rb", "lib/active_resource/validations.rb", "lib/active_resource/version.rb", "lib/active_resource.rb", "lib/activeresource.rb", "test/abstract_unit.rb", "test/cases", "test/cases/authorization_test.rb", "test/cases/base", "test/cases/base/custom_methods_test.rb", "test/cases/base/equality_test.rb", "test/cases/base/load_test.rb", "test/cases/base_errors_test.rb", "test/cases/base_test.rb", "test/cases/finder_test.rb", "test/cases/format_test.rb", "test/cases/observing_test.rb", "test/cases/validations_test.rb", "test/connection_test.rb", "test/debug.log", "test/fixtures", "test/fixtures/beast.rb", "test/fixtures/customer.rb", "test/fixtures/person.rb", "test/fixtures/project.rb", "test/fixtures/proxy.rb", "test/fixtures/street_address.rb", "test/setter_trap.rb", "examples/simple.rb"] s.homepage = %q{http://www.rubyonrails.org} s.rdoc_options = ["--main", "README"] s.require_paths = ["lib"] @@ -25,10 +25,13 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_runtime_dependency(%q<activemodel>, ["= 3.0.pre"]) else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end end diff --git a/activeresource/lib/active_resource/observing.rb b/activeresource/lib/active_resource/observing.rb index 94836f4bb1..3c74d49c80 100644 --- a/activeresource/lib/active_resource/observing.rb +++ b/activeresource/lib/active_resource/observing.rb @@ -4,7 +4,18 @@ module ActiveResource include ActiveModel::Observing included do - wrap_with_notifications :create, :save, :update, :destroy + %w( create save update destroy ).each do |method| + class_eval(<<-EOS, __FILE__, __LINE__ + 1) + def #{method}_with_notifications(*args, &block) + notify_observers(:before_#{method}) + if result = #{method}_without_notifications(*args, &block) + notify_observers(:after_#{method}) + end + result + end + EOS + alias_method_chain(method, :notifications) + end end end end diff --git a/activeresource/test/cases/observing_test.rb b/activeresource/test/cases/observing_test.rb index 334b256772..9599ff7b0f 100644 --- a/activeresource/test/cases/observing_test.rb +++ b/activeresource/test/cases/observing_test.rb @@ -1,4 +1,6 @@ require 'abstract_unit' +require 'fixtures/person' +require 'active_support/core_ext/hash/conversions' class ObservingTest < Test::Unit::TestCase cattr_accessor :history diff --git a/activeresource/test/cases/validations_test.rb b/activeresource/test/cases/validations_test.rb index a8ab7d64e7..c05f625fb7 100644 --- a/activeresource/test/cases/validations_test.rb +++ b/activeresource/test/cases/validations_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' -require "fixtures/project" +require 'fixtures/project' +require 'active_support/core_ext/hash/conversions' # The validations are tested thoroughly under ActiveModel::Validations # This test case simply makes sur that they are all accessible by diff --git a/activesupport/Rakefile b/activesupport/Rakefile index 539ce2720e..91c874d729 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -24,7 +24,7 @@ Rake::TestTask.new { |t| task :isolated_test do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) Dir['test/**/*_test.rb'].all? do |file| - system(ruby, '-Ilib:test', file) + system(ruby, '-w', '-Ilib:test', file) end or raise "Failures" end diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index fadeb7e1e3..9260e068ed 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Utility library which carries commonly used classes and goodies from the Rails framework} s.email = %q{david@loudthinking.com} s.files = ["CHANGELOG", "README", "lib/active_support", "lib/active_support/all.rb", "lib/active_support/autoload.rb", "lib/active_support/backtrace_cleaner.rb", "lib/active_support/base64.rb", "lib/active_support/basic_object.rb", "lib/active_support/buffered_logger.rb", "lib/active_support/cache", "lib/active_support/cache/compressed_mem_cache_store.rb", "lib/active_support/cache/file_store.rb", "lib/active_support/cache/mem_cache_store.rb", "lib/active_support/cache/memory_store.rb", "lib/active_support/cache/strategy", "lib/active_support/cache/strategy/local_cache.rb", "lib/active_support/cache/synchronized_memory_store.rb", "lib/active_support/cache.rb", "lib/active_support/callbacks.rb", "lib/active_support/concern.rb", "lib/active_support/concurrent_hash.rb", "lib/active_support/core_ext", "lib/active_support/core_ext/array", "lib/active_support/core_ext/array/access.rb", "lib/active_support/core_ext/array/conversions.rb", "lib/active_support/core_ext/array/extract_options.rb", "lib/active_support/core_ext/array/grouping.rb", "lib/active_support/core_ext/array/random_access.rb", "lib/active_support/core_ext/array/wrap.rb", "lib/active_support/core_ext/array.rb", "lib/active_support/core_ext/benchmark.rb", "lib/active_support/core_ext/big_decimal", "lib/active_support/core_ext/big_decimal/conversions.rb", "lib/active_support/core_ext/big_decimal.rb", "lib/active_support/core_ext/boolean", "lib/active_support/core_ext/boolean/conversions.rb", "lib/active_support/core_ext/boolean.rb", "lib/active_support/core_ext/cgi", "lib/active_support/core_ext/cgi/escape_skipping_slashes.rb", "lib/active_support/core_ext/cgi.rb", "lib/active_support/core_ext/class", "lib/active_support/core_ext/class/attribute_accessors.rb", "lib/active_support/core_ext/class/delegating_attributes.rb", "lib/active_support/core_ext/class/inheritable_attributes.rb", "lib/active_support/core_ext/class/removal.rb", "lib/active_support/core_ext/class.rb", "lib/active_support/core_ext/date", "lib/active_support/core_ext/date/acts_like.rb", "lib/active_support/core_ext/date/calculations.rb", "lib/active_support/core_ext/date/conversions.rb", "lib/active_support/core_ext/date/freeze.rb", "lib/active_support/core_ext/date.rb", "lib/active_support/core_ext/date_time", "lib/active_support/core_ext/date_time/acts_like.rb", "lib/active_support/core_ext/date_time/calculations.rb", "lib/active_support/core_ext/date_time/conversions.rb", "lib/active_support/core_ext/date_time/zones.rb", "lib/active_support/core_ext/date_time.rb", "lib/active_support/core_ext/enumerable.rb", "lib/active_support/core_ext/exception.rb", "lib/active_support/core_ext/file", "lib/active_support/core_ext/file/atomic.rb", "lib/active_support/core_ext/file.rb", "lib/active_support/core_ext/float", "lib/active_support/core_ext/float/rounding.rb", "lib/active_support/core_ext/float.rb", "lib/active_support/core_ext/hash", "lib/active_support/core_ext/hash/conversions.rb", "lib/active_support/core_ext/hash/deep_merge.rb", "lib/active_support/core_ext/hash/diff.rb", "lib/active_support/core_ext/hash/except.rb", "lib/active_support/core_ext/hash/indifferent_access.rb", "lib/active_support/core_ext/hash/keys.rb", "lib/active_support/core_ext/hash/reverse_merge.rb", "lib/active_support/core_ext/hash/slice.rb", "lib/active_support/core_ext/hash.rb", "lib/active_support/core_ext/integer", "lib/active_support/core_ext/integer/even_odd.rb", "lib/active_support/core_ext/integer/inflections.rb", "lib/active_support/core_ext/integer/time.rb", "lib/active_support/core_ext/integer.rb", "lib/active_support/core_ext/kernel", "lib/active_support/core_ext/kernel/agnostics.rb", "lib/active_support/core_ext/kernel/daemonizing.rb", "lib/active_support/core_ext/kernel/debugger.rb", "lib/active_support/core_ext/kernel/reporting.rb", "lib/active_support/core_ext/kernel/requires.rb", "lib/active_support/core_ext/kernel.rb", "lib/active_support/core_ext/load_error.rb", "lib/active_support/core_ext/logger.rb", "lib/active_support/core_ext/module", "lib/active_support/core_ext/module/aliasing.rb", "lib/active_support/core_ext/module/attr_accessor_with_default.rb", "lib/active_support/core_ext/module/attr_internal.rb", "lib/active_support/core_ext/module/attribute_accessors.rb", "lib/active_support/core_ext/module/delegation.rb", "lib/active_support/core_ext/module/deprecation.rb", "lib/active_support/core_ext/module/inclusion.rb", "lib/active_support/core_ext/module/introspection.rb", "lib/active_support/core_ext/module/loading.rb", "lib/active_support/core_ext/module/synchronization.rb", "lib/active_support/core_ext/module.rb", "lib/active_support/core_ext/name_error.rb", "lib/active_support/core_ext/nil", "lib/active_support/core_ext/nil/conversions.rb", "lib/active_support/core_ext/nil.rb", "lib/active_support/core_ext/numeric", "lib/active_support/core_ext/numeric/bytes.rb", "lib/active_support/core_ext/numeric/time.rb", "lib/active_support/core_ext/numeric.rb", "lib/active_support/core_ext/object", "lib/active_support/core_ext/object/acts_like.rb", "lib/active_support/core_ext/object/blank.rb", "lib/active_support/core_ext/object/conversions.rb", "lib/active_support/core_ext/object/duplicable.rb", "lib/active_support/core_ext/object/extending.rb", "lib/active_support/core_ext/object/instance_variables.rb", "lib/active_support/core_ext/object/metaclass.rb", "lib/active_support/core_ext/object/misc.rb", "lib/active_support/core_ext/object/returning.rb", "lib/active_support/core_ext/object/tap.rb", "lib/active_support/core_ext/object/try.rb", "lib/active_support/core_ext/object/with_options.rb", "lib/active_support/core_ext/object.rb", "lib/active_support/core_ext/proc.rb", "lib/active_support/core_ext/process", "lib/active_support/core_ext/process/daemon.rb", "lib/active_support/core_ext/process.rb", "lib/active_support/core_ext/range", "lib/active_support/core_ext/range/blockless_step.rb", "lib/active_support/core_ext/range/conversions.rb", "lib/active_support/core_ext/range/include_range.rb", "lib/active_support/core_ext/range/overlaps.rb", "lib/active_support/core_ext/range.rb", "lib/active_support/core_ext/regexp.rb", "lib/active_support/core_ext/rexml.rb", "lib/active_support/core_ext/string", "lib/active_support/core_ext/string/access.rb", "lib/active_support/core_ext/string/behavior.rb", "lib/active_support/core_ext/string/bytesize.rb", "lib/active_support/core_ext/string/conversions.rb", "lib/active_support/core_ext/string/filters.rb", "lib/active_support/core_ext/string/inflections.rb", "lib/active_support/core_ext/string/interpolation.rb", "lib/active_support/core_ext/string/iterators.rb", "lib/active_support/core_ext/string/multibyte.rb", "lib/active_support/core_ext/string/starts_ends_with.rb", "lib/active_support/core_ext/string/xchar.rb", "lib/active_support/core_ext/string.rb", "lib/active_support/core_ext/symbol", "lib/active_support/core_ext/symbol/to_proc.rb", "lib/active_support/core_ext/symbol.rb", "lib/active_support/core_ext/time", "lib/active_support/core_ext/time/acts_like.rb", "lib/active_support/core_ext/time/calculations.rb", "lib/active_support/core_ext/time/conversions.rb", "lib/active_support/core_ext/time/marshal_with_utc_flag.rb", "lib/active_support/core_ext/time/publicize_conversion_methods.rb", "lib/active_support/core_ext/time/zones.rb", "lib/active_support/core_ext/time.rb", "lib/active_support/core_ext/uri.rb", "lib/active_support/core_ext.rb", "lib/active_support/dependencies.rb", "lib/active_support/dependency_module.rb", "lib/active_support/deprecation", "lib/active_support/deprecation/behaviors.rb", "lib/active_support/deprecation/method_wrappers.rb", "lib/active_support/deprecation/proxy_wrappers.rb", "lib/active_support/deprecation/reporting.rb", "lib/active_support/deprecation.rb", "lib/active_support/duration.rb", "lib/active_support/gzip.rb", "lib/active_support/hash_with_indifferent_access.rb", "lib/active_support/inflections.rb", "lib/active_support/inflector.rb", "lib/active_support/json", "lib/active_support/json/backends", "lib/active_support/json/backends/jsongem.rb", "lib/active_support/json/backends/yaml.rb", "lib/active_support/json/decoding.rb", "lib/active_support/json/encoding.rb", "lib/active_support/json/variable.rb", "lib/active_support/json.rb", "lib/active_support/locale", "lib/active_support/locale/en.yml", "lib/active_support/memoizable.rb", "lib/active_support/message_encryptor.rb", "lib/active_support/message_verifier.rb", "lib/active_support/mini.rb", "lib/active_support/multibyte", "lib/active_support/multibyte/chars.rb", "lib/active_support/multibyte/exceptions.rb", "lib/active_support/multibyte/unicode_database.rb", "lib/active_support/multibyte.rb", "lib/active_support/new_callbacks.rb", "lib/active_support/option_merger.rb", "lib/active_support/ordered_hash.rb", "lib/active_support/ordered_options.rb", "lib/active_support/rescuable.rb", "lib/active_support/ruby", "lib/active_support/ruby/shim.rb", "lib/active_support/secure_random.rb", "lib/active_support/string_inquirer.rb", "lib/active_support/test_case.rb", "lib/active_support/testing", "lib/active_support/testing/assertions.rb", "lib/active_support/testing/declarative.rb", "lib/active_support/testing/default.rb", "lib/active_support/testing/deprecation.rb", "lib/active_support/testing/isolation.rb", "lib/active_support/testing/pending.rb", "lib/active_support/testing/performance.rb", "lib/active_support/testing/setup_and_teardown.rb", "lib/active_support/time", "lib/active_support/time/autoload.rb", "lib/active_support/time.rb", "lib/active_support/time_with_zone.rb", "lib/active_support/values", "lib/active_support/values/time_zone.rb", "lib/active_support/values/unicode_tables.dat", "lib/active_support/vendor", "lib/active_support/vendor/builder-2.1.2", "lib/active_support/vendor/builder-2.1.2/blankslate.rb", "lib/active_support/vendor/builder-2.1.2/builder", "lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb", "lib/active_support/vendor/builder-2.1.2/builder/css.rb", "lib/active_support/vendor/builder-2.1.2/builder/xchar.rb", "lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb", "lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb", "lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb", "lib/active_support/vendor/builder-2.1.2/builder.rb", "lib/active_support/vendor/i18n-0.1.3", "lib/active_support/vendor/i18n-0.1.3/i18n.gemspec", "lib/active_support/vendor/i18n-0.1.3/lib", "lib/active_support/vendor/i18n-0.1.3/lib/i18n", "lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend", "lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb", "lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb", "lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb", "lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE", "lib/active_support/vendor/i18n-0.1.3/Rakefile", "lib/active_support/vendor/i18n-0.1.3/README.textile", "lib/active_support/vendor/i18n-0.1.3/test", "lib/active_support/vendor/i18n-0.1.3/test/all.rb", "lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb", "lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb", "lib/active_support/vendor/i18n-0.1.3/test/locale", "lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb", "lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml", "lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb", "lib/active_support/vendor/memcache-client-1.6.5", "lib/active_support/vendor/memcache-client-1.6.5/memcache.rb", "lib/active_support/vendor/tzinfo-0.3.13", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/data_timezone_info.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Algiers.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Cairo.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Casablanca.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Harare.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Johannesburg.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Monrovia.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Africa/Nairobi.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/Buenos_Aires.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Argentina/San_Juan.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Bogota.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Caracas.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chicago.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Chihuahua.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Denver.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Godthab.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Guatemala.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Halifax.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Indiana", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Indiana/Indianapolis.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Juneau.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/La_Paz.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Lima.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Los_Angeles.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mazatlan.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Mexico_City.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Monterrey.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/New_York.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Phoenix.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Regina.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Santiago.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Sao_Paulo.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/St_Johns.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/America/Tijuana.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Almaty.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baghdad.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Baku.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Bangkok.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Chongqing.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Colombo.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Dhaka.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Hong_Kong.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Irkutsk.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jakarta.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Jerusalem.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kabul.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kamchatka.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Karachi.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kathmandu.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kolkata.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Krasnoyarsk.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuala_Lumpur.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Kuwait.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Magadan.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Muscat.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Novosibirsk.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Rangoon.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Riyadh.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Seoul.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Shanghai.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Singapore.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Taipei.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tashkent.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tbilisi.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tehran.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Tokyo.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Ulaanbaatar.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Urumqi.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Vladivostok.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yakutsk.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yekaterinburg.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Asia/Yerevan.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Azores.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/Cape_Verde.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Atlantic/South_Georgia.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Adelaide.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Brisbane.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Darwin.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Hobart.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Melbourne.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Perth.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Australia/Sydney.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Etc", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Etc/UTC.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Amsterdam.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Athens.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Belgrade.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Berlin.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bratislava.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Brussels.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Bucharest.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Budapest.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Copenhagen.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Dublin.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Helsinki.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Istanbul.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Kiev.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Lisbon.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Ljubljana.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/London.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Madrid.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Minsk.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Moscow.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Paris.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Prague.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Riga.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Rome.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sarajevo.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Skopje.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Sofia.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Stockholm.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Tallinn.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vienna.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Vilnius.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Warsaw.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Europe/Zagreb.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Auckland.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Fiji.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Guam.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Honolulu.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Majuro.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Midway.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Noumea.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Pago_Pago.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Port_Moresby.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/definitions/Pacific/Tongatapu.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/info_timezone.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/linked_timezone_info.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/offset_rationals.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/ruby_core_support.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/time_or_datetime.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_definition.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_info.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_offset_info.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_period.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo/timezone_transition_info.rb", "lib/active_support/vendor/tzinfo-0.3.13/tzinfo.rb", "lib/active_support/vendor.rb", "lib/active_support/version.rb", "lib/active_support/whiny_nil.rb", "lib/active_support/xml_mini", "lib/active_support/xml_mini/jdom.rb", "lib/active_support/xml_mini/libxml.rb", "lib/active_support/xml_mini/nokogiri.rb", "lib/active_support/xml_mini/rexml.rb", "lib/active_support/xml_mini.rb", "lib/active_support.rb", "lib/activesupport.rb"] diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb index b24acb9f47..aae5a3416d 100644 --- a/activesupport/lib/active_support/message_verifier.rb +++ b/activesupport/lib/active_support/message_verifier.rb @@ -25,10 +25,10 @@ module ActiveSupport def verify(signed_message) data, digest = signed_message.split("--") - if digest != generate_digest(data) - raise InvalidSignature - else + if secure_compare(digest, generate_digest(data)) Marshal.load(ActiveSupport::Base64.decode64(data)) + else + raise InvalidSignature end end @@ -38,6 +38,19 @@ module ActiveSupport end private + # constant-time comparison algorithm to prevent timing attacks + def secure_compare(a, b) + if a.length == b.length + result = 0 + for i in 0..(a.length - 1) + result |= a[i] ^ b[i] + end + result == 0 + else + false + end + end + def generate_digest(data) require 'openssl' unless defined?(OpenSSL) OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(@digest), @secret, data) diff --git a/activesupport/lib/active_support/multibyte.rb b/activesupport/lib/active_support/multibyte.rb index d8d58f3bce..6f2016a409 100644 --- a/activesupport/lib/active_support/multibyte.rb +++ b/activesupport/lib/active_support/multibyte.rb @@ -1,9 +1,5 @@ # encoding: utf-8 -require 'active_support/multibyte/chars' -require 'active_support/multibyte/exceptions' -require 'active_support/multibyte/unicode_database' - require 'active_support/core_ext/module/attribute_accessors' module ActiveSupport #:nodoc: @@ -29,7 +25,35 @@ module ActiveSupport #:nodoc: # # Example: # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 - mattr_accessor :proxy_class - self.proxy_class = ActiveSupport::Multibyte::Chars + def self.proxy_class=(klass) + @proxy_class = klass + end + + # Returns the currect proxy class + def self.proxy_class + @proxy_class ||= ActiveSupport::Multibyte::Chars + end + + # Regular expressions that describe valid byte sequences for a character + VALID_CHARACTER = { + # Borrowed from the Kconv library by Shinji KONO - (also as seen on the W3C site) + 'UTF-8' => /\A(?: + [\x00-\x7f] | + [\xc2-\xdf] [\x80-\xbf] | + \xe0 [\xa0-\xbf] [\x80-\xbf] | + [\xe1-\xef] [\x80-\xbf] [\x80-\xbf] | + \xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] | + [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] | + \xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf])\z /xn, + # Quick check for valid Shift-JIS characters, disregards the odd-even pairing + 'Shift_JIS' => /\A(?: + [\x00-\x7e \xa1-\xdf] | + [\x81-\x9f \xe0-\xef] [\x40-\x7e \x80-\x9e \x9f-\xfc])\z /xn + } end end + +require 'active_support/multibyte/chars' +require 'active_support/multibyte/exceptions' +require 'active_support/multibyte/unicode_database' +require 'active_support/multibyte/utils' diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 64a35dca40..579ccc124d 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -74,16 +74,7 @@ module ActiveSupport #:nodoc: UNICODE_TRAILERS_PAT = /(#{codepoints_to_pattern(UNICODE_LEADERS_AND_TRAILERS)})+\Z/ UNICODE_LEADERS_PAT = /\A(#{codepoints_to_pattern(UNICODE_LEADERS_AND_TRAILERS)})+/ - # Borrowed from the Kconv library by Shinji KONO - (also as seen on the W3C site) - UTF8_PAT = /\A(?: - [\x00-\x7f] | - [\xc2-\xdf] [\x80-\xbf] | - \xe0 [\xa0-\xbf] [\x80-\xbf] | - [\xe1-\xef] [\x80-\xbf] [\x80-\xbf] | - \xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] | - [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] | - \xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf] - )*\z/xn + UTF8_PAT = ActiveSupport::Multibyte::VALID_CHARACTER['UTF-8'] attr_reader :wrapped_string alias to_s wrapped_string @@ -308,23 +299,23 @@ module ActiveSupport #:nodoc: def rstrip chars(@wrapped_string.gsub(UNICODE_TRAILERS_PAT, '')) end - + # Strips entire range of Unicode whitespace from the left of the string. def lstrip chars(@wrapped_string.gsub(UNICODE_LEADERS_PAT, '')) end - + # Strips entire range of Unicode whitespace from the right and left of the string. def strip rstrip.lstrip end - + # Returns the number of codepoints in the string def size self.class.u_unpack(@wrapped_string).size end alias_method :length, :size - + # Reverses all characters in the string. # # Example: @@ -332,7 +323,7 @@ module ActiveSupport #:nodoc: def reverse chars(self.class.u_unpack(@wrapped_string).reverse.pack('U*')) end - + # Implements Unicode-aware slice with codepoints. Slicing on one point returns the codepoints for that # character. # @@ -647,7 +638,7 @@ module ActiveSupport #:nodoc: string.split(//u).map do |c| c.force_encoding(Encoding::ASCII) if c.respond_to?(:force_encoding) - if !UTF8_PAT.match(c) + if !ActiveSupport::Multibyte::VALID_CHARACTER['UTF-8'].match(c) n = c.unpack('C')[0] n < 128 ? n.chr : n < 160 ? [UCD.cp1252[n] || n].pack('U') : diff --git a/activesupport/lib/active_support/multibyte/utils.rb b/activesupport/lib/active_support/multibyte/utils.rb new file mode 100644 index 0000000000..acef84da91 --- /dev/null +++ b/activesupport/lib/active_support/multibyte/utils.rb @@ -0,0 +1,61 @@ +# encoding: utf-8 + +module ActiveSupport #:nodoc: + module Multibyte #:nodoc: + if Kernel.const_defined?(:Encoding) + # Returns a regular expression that matches valid characters in the current encoding + def self.valid_character + VALID_CHARACTER[Encoding.default_internal.to_s] + end + else + def self.valid_character + case $KCODE + when 'UTF8' + VALID_CHARACTER['UTF-8'] + when 'SJIS' + VALID_CHARACTER['Shift_JIS'] + end + end + end + + if 'string'.respond_to?(:valid_encoding?) + # Verifies the encoding of a string + def self.verify(string) + string.valid_encoding? + end + else + def self.verify(string) + if expression = valid_character + for c in string.split(//) + return false unless valid_character.match(c) + end + end + true + end + end + + # Verifies the encoding of the string and raises an exception when it's not valid + def self.verify!(string) + raise EncodingError.new("Found characters with invalid encoding") unless verify(string) + end + + if 'string'.respond_to?(:force_encoding) + # Removes all invalid characters from the string. + # + # Note: this method is a no-op in Ruby 1.9 + def self.clean(string) + string + end + else + def self.clean(string) + if expression = valid_character + stripped = []; for c in string.split(//) + stripped << c if valid_character.match(c) + end; stripped.join + else + string + end + end + end + end +end
\ No newline at end of file diff --git a/activesupport/test/core_ext/boolean_ext_test.rb b/activesupport/test/core_ext/boolean_ext_test.rb index 751f703745..9439716efb 100644 --- a/activesupport/test/core_ext/boolean_ext_test.rb +++ b/activesupport/test/core_ext/boolean_ext_test.rb @@ -1,3 +1,6 @@ +require 'abstract_unit' +require 'active_support/core_ext/boolean/conversions' + class BooleanExtAccessTests < Test::Unit::TestCase def test_to_param_on_true assert_equal true, true.to_param @@ -6,4 +9,4 @@ class BooleanExtAccessTests < Test::Unit::TestCase def test_to_param_on_false assert_equal false, false.to_param end -end
\ No newline at end of file +end diff --git a/activesupport/test/core_ext/nil_ext_test.rb b/activesupport/test/core_ext/nil_ext_test.rb index 945d3af239..1062676d65 100644 --- a/activesupport/test/core_ext/nil_ext_test.rb +++ b/activesupport/test/core_ext/nil_ext_test.rb @@ -1,5 +1,8 @@ +require 'abstract_unit' +require 'active_support/core_ext/nil/conversions' + class NilExtAccessTests < Test::Unit::TestCase def test_to_param assert_nil nil.to_param end -end
\ No newline at end of file +end diff --git a/activesupport/test/core_ext/object_ext_test.rb b/activesupport/test/core_ext/object_ext_test.rb index 72e3bffa4c..484eecaab6 100644 --- a/activesupport/test/core_ext/object_ext_test.rb +++ b/activesupport/test/core_ext/object_ext_test.rb @@ -1,4 +1,6 @@ require 'abstract_unit' +require 'active_support/core_ext/object/metaclass' +require 'active_support/core_ext/object/conversions' class ObjectExtTest < Test::Unit::TestCase def test_tap_yields_and_returns_self diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index e2d9140bca..cc3f07d5c5 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -1,3 +1,6 @@ +require 'abstract_unit' +require 'active_support/core_ext/regexp' + class RegexpExtAccessTests < Test::Unit::TestCase def test_number_of_captures assert_equal 0, //.number_of_captures @@ -23,4 +26,4 @@ class RegexpExtAccessTests < Test::Unit::TestCase assert_equal "foo", Regexp.unoptionalize("(?:foo)?") assert_equal "", Regexp.unoptionalize("") end -end
\ No newline at end of file +end diff --git a/activesupport/test/multibyte_utils_test.rb b/activesupport/test/multibyte_utils_test.rb new file mode 100644 index 0000000000..d8ac5ff139 --- /dev/null +++ b/activesupport/test/multibyte_utils_test.rb @@ -0,0 +1,141 @@ +# encoding: utf-8 + +require 'abstract_unit' +require 'multibyte_test_helpers' + +class MultibyteUtilsTest < ActiveSupport::TestCase + include MultibyteTestHelpers + + test "valid_character returns an expression for the current encoding" do + with_encoding('None') do + assert_nil ActiveSupport::Multibyte.valid_character + end + with_encoding('UTF8') do + assert_equal ActiveSupport::Multibyte::VALID_CHARACTER['UTF-8'], ActiveSupport::Multibyte.valid_character + end + with_encoding('SJIS') do + assert_equal ActiveSupport::Multibyte::VALID_CHARACTER['Shift_JIS'], ActiveSupport::Multibyte.valid_character + end + end + + test "verify verifies ASCII strings are properly encoded" do + with_encoding('None') do + examples.each do |example| + assert ActiveSupport::Multibyte.verify(example) + end + end + end + + test "verify verifies UTF-8 strings are properly encoded" do + with_encoding('UTF8') do + assert ActiveSupport::Multibyte.verify(example('valid UTF-8')) + assert !ActiveSupport::Multibyte.verify(example('invalid UTF-8')) + end + end + + test "verify verifies Shift-JIS strings are properly encoded" do + with_encoding('SJIS') do + assert ActiveSupport::Multibyte.verify(example('valid Shift-JIS')) + assert !ActiveSupport::Multibyte.verify(example('invalid Shift-JIS')) + end + end + + test "verify! raises an exception when it finds an invalid character" do + with_encoding('UTF8') do + assert_raises(ActiveSupport::Multibyte::EncodingError) do + ActiveSupport::Multibyte.verify!(example('invalid UTF-8')) + end + end + end + + test "verify! doesn't raise an exception when the encoding is valid" do + with_encoding('UTF8') do + assert_nothing_raised do + ActiveSupport::Multibyte.verify!(example('valid UTF-8')) + end + end + end + + if RUBY_VERSION < '1.9' + test "clean leaves ASCII strings intact" do + with_encoding('None') do + [ + 'word', "\270\236\010\210\245" + ].each do |string| + assert_equal string, ActiveSupport::Multibyte.clean(string) + end + end + end + + test "clean cleans invalid characters from UTF-8 encoded strings" do + with_encoding('UTF8') do + cleaned_utf8 = [8].pack('C*') + assert_equal example('valid UTF-8'), ActiveSupport::Multibyte.clean(example('valid UTF-8')) + assert_equal cleaned_utf8, ActiveSupport::Multibyte.clean(example('invalid UTF-8')) + end + end + + test "clean cleans invalid characters from Shift-JIS encoded strings" do + with_encoding('SJIS') do + cleaned_sjis = [184, 0, 136, 165].pack('C*') + assert_equal example('valid Shift-JIS'), ActiveSupport::Multibyte.clean(example('valid Shift-JIS')) + assert_equal cleaned_sjis, ActiveSupport::Multibyte.clean(example('invalid Shift-JIS')) + end + end + else + test "clean is a no-op" do + with_encoding('UTF8') do + assert_equal example('invalid Shift-JIS'), ActiveSupport::Multibyte.clean(example('invalid Shift-JIS')) + end + end + end + + private + + STRINGS = { + 'valid ASCII' => [65, 83, 67, 73, 73].pack('C*'), + 'invalid ASCII' => [128].pack('C*'), + 'valid UTF-8' => [227, 129, 147, 227, 129, 171, 227, 129, 161, 227, 130, 143].pack('C*'), + 'invalid UTF-8' => [184, 158, 8, 136, 165].pack('C*'), + 'valid Shift-JIS' => [131, 122, 129, 91, 131, 128].pack('C*'), + 'invalid Shift-JIS' => [184, 158, 8, 0, 255, 136, 165].pack('C*') + } + + if Kernel.const_defined?(:Encoding) + def example(key) + STRINGS[key].force_encoding(Encoding.default_internal) + end + + def examples + STRINGS.values.map { |s| s.force_encoding(Encoding.default_internal) } + end + else + def example(key) + STRINGS[key] + end + + def examples + STRINGS.values + end + end + + if 'string'.respond_to?(:encoding) + def with_encoding(enc) + before = Encoding.default_internal + + case enc + when 'UTF8' + Encoding.default_internal = Encoding::UTF_8 + when 'SJIS' + Encoding.default_internal = Encoding::Shift_JIS + else + Encoding.default_internal = Encoding::BINARY + end + yield + + Encoding.default_internal = before + end + else + alias with_encoding with_kcode + end +end
\ No newline at end of file diff --git a/railties/Rakefile b/railties/Rakefile index 33c7a0d89a..6ebb11dbb5 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -142,7 +142,7 @@ PKG_FILES = FileList[ 'bin/**/*', 'builtin/**/*', 'guides/**/*', - 'lib/**/*' + 'lib/**/{*,.[a-z]*}' ] - [ 'test' ] spec = Gem::Specification.new do |s| diff --git a/railties/lib/test_help.rb b/railties/lib/test_help.rb index 4318203a42..53f28264e8 100644 --- a/railties/lib/test_help.rb +++ b/railties/lib/test_help.rb @@ -2,6 +2,10 @@ # so fixtures are loaded to the right database silence_warnings { RAILS_ENV = "test" } +require 'rubygems' +gem "rack", "~> 1.0.0" +gem "rack-test", "~> 0.4.2" + require 'test/unit' require 'active_support/core_ext/kernel/requires' require 'action_controller/testing/test_case' diff --git a/railties/lib/vendor/bundler/README.markdown b/railties/lib/vendor/bundler/README.markdown new file mode 100644 index 0000000000..26863e96f2 --- /dev/null +++ b/railties/lib/vendor/bundler/README.markdown @@ -0,0 +1,162 @@ +## Bundler : A gem to bundle gems + + Github: http://github.com/wycats/bundler + Mailing list: http://groups.google.com/group/ruby-bundler + IRC: #carlhuda on freenode + +## Intro + +Bundler is a tool that manages gem dependencies for your ruby application. It +takes a gem manifest file and is able to fetch, download, and install the gems +and all child dependencies specified in this manifest. It can manage any update +to the gem manifest file and update the bundled gems accordingly. It also lets +you run any ruby code in context of the bundled gem environment. + +## Disclaimer + +This project is under rapid development. It is usable today, but there will be +many changes in the near future, including to the Gemfile DSL. We will bump up +versions with changes though. We greatly appreciate feedback. + +## Installation + +Bundler has no dependencies. Just clone the git repository and install the gem +with the following rake task: + + rake install + +## Usage + +Bundler requires a gem manifest file to be created. This should be a file named +`Gemfile` located in the root directory of your application. After the manifest +has been created, in your shell, cd into your application's directory and run +`gem bundle`. This will start the bundling process. + +### Manifest file + +This is where you specify all of your application's dependencies. By default +this should be in a file named `Gemfile` located in your application's root +directory. The following is an example of a potential `Gemfile`. For more +information, please refer to Bundler::ManifestBuilder. + + # Specify a dependency on rails. When the bundler downloads gems, + # it will download rails as well as all of rails' dependencies (such as + # activerecord, actionpack, etc...) + # + # At least one dependency must be specified + gem "rails" + + # Specify a dependency on rack v.1.0.0. The version is optional. If present, + # it can be specified the same way as with rubygems' #gem method. + gem "rack", "1.0.0" + + # Specify a dependency rspec, but only activate that gem in the "testing" + # environment (read more about environments later). :except is also a valid + # option to specify environment restrictions. + gem "rspec", :only => :testing + + # Add http://gems.github.com as a source that the bundler will use + # to find gems listed in the manifest. By default, + # http://gems.rubyforge.org is already added to the list. + # + # This is an optional setting. + source "http://gems.github.com" + + # Specify where the bundled gems should be stashed. This directory will + # be a gem repository where all gems are downloaded to and installed to. + # + # This is an optional setting. + # The default is: vendor/gems + bundle_path "my/bundled/gems" + + # Specify where gem executables should be copied to. + # + # This is an optional setting. + # The default is: bin + bin_path "my/executables" + + # Specify that rubygems should be completely disabled. This means that it + # will be impossible to require it and that available gems will be + # limited exclusively to gems that have been bundled. + # + # The default is to automatically require rubygems. There is also a + # `disable_system_gems` option that will limit available rubygems to + # the ones that have been bundled. + disable_rubygems + +### Running Bundler + +Once a manifest file has been created, the only thing that needs to be done +is to run the `gem bundle` command anywhere in your application. The script +will load the manifest file, resole all the dependencies, download all +needed gems, and install them into the specified directory. + +Every time an update is made to the manifest file, run `gem bundle` again to +get the changes installed. This will only check the remote sources if your +currently installed gems do not satisfy the `Gemfile`. If you want to force +checking for updates on the remote sources, use the `--update` option. + +### Running your application + +The easiest way to run your application is to start it with an executable +copied to the specified bin directory (by default, simply bin). For example, +if the application in question is a rack app, start it with `bin/rackup`. +This will automatically set the gem environment correctly. + +Another way to run arbitrary ruby code in context of the bundled gems is to +run it with the `gem exec` command. For example: + + gem exec ruby my_ruby_script.rb + +Yet another way is to manually require the environment file first. This is +located in `[bundle_path]/environments/default.rb`. For example: + + ruby -r vendor/gems/environment.rb my_ruby_script.rb + +### Using Bundler with Rails today + +It should be possible to use Bundler with Rails today. Here are the steps +to follow. + +* In your rails app, create a Gemfile and specify the gems that your + application depends on. Make sure to specify rails as well: + + gem "rails", "2.1.2" + gem "will_paginate" + + # Optionally, you can disable system gems all together and only + # use bundled gems. + disable_system_gems + +* Run `gem bundle` + +* You can now use rails if you prepend `gem exec` to every call to `script/*` + but that isn't fun. + +* At the top of `config/boot.rb`, add the following line: + + require File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'environment')) + +In theory, this should be enough to get going. + +## To require rubygems or not + +Ideally, no gem would assume the presence of rubygems at runtime. Rubygems provides +enough features so that this isn't necessary. However, there are a number of gems +that require specific rubygem features. + +If the `disable_rubygems` option is used, Bundler will stub out the most common +of these features, but it is possible that things will not go as intended quite +yet. So, if you are brave, try your code without rubygems at runtime. + +## Known Issues + +* When a gem points to a git repository, the git repository will be cloned + every time Bundler does a gem dependency resolve. + +## Reporting bugs + +Please report all bugs on the github issue tracker for the project located +at: + + http://github.com/wycats/bundler/issues/
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/Rakefile b/railties/lib/vendor/bundler/Rakefile index fd39fbff77..dc4c3d6d46 100644 --- a/railties/lib/vendor/bundler/Rakefile +++ b/railties/lib/vendor/bundler/Rakefile @@ -1,52 +1,57 @@ require 'rubygems' unless ENV['NO_RUBYGEMS'] -require 'rake/gempackagetask' require 'rubygems/specification' require 'date' -require 'spec/rake/spectask' spec = Gem::Specification.new do |s| - s.name = "bundler" - s.version = "0.0.1" - s.author = "Your Name" - s.email = "Your Email" - s.homepage = "http://example.com" - s.description = s.summary = "A gem that provides..." + s.name = "bundler" + s.version = "0.5.0.pre" + s.author = "Yehuda Katz" + s.email = "wycats@gmail.com" + s.homepage = "http://github.com/wycats/bundler" + s.description = s.summary = "An easy way to vendor gem dependencies" s.platform = Gem::Platform::RUBY s.has_rdoc = true - s.extra_rdoc_files = ["README", "LICENSE"] - s.summary = "" + s.extra_rdoc_files = ["README.markdown", "LICENSE"] - # Uncomment this to add a dependency - # s.add_dependency "foo" + s.required_rubygems_version = ">= 1.3.5" - s.bindir = "bin" - s.executables = %w( gem_bundler ) s.require_path = 'lib' - s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*") + s.files = %w(LICENSE README.markdown Rakefile) + Dir.glob("lib/**/*") end task :default => :spec -desc "Run specs" -Spec::Rake::SpecTask.new do |t| - t.spec_files = FileList['spec/**/*_spec.rb'] - t.spec_opts = %w(-fs --color) +begin + require 'spec/rake/spectask' +rescue LoadError + task(:spec) { $stderr.puts '`gem install rspec` to run specs' } +else + desc "Run specs" + Spec::Rake::SpecTask.new do |t| + t.spec_files = FileList['spec/**/*_spec.rb'] - FileList['spec/fixtures/**/*_spec.rb'] + t.spec_opts = %w(-fs --color) + end end - -Rake::GemPackageTask.new(spec) do |pkg| - pkg.gem_spec = spec +begin + require 'rake/gempackagetask' +rescue LoadError + task(:gem) { $stderr.puts '`gem install rake` to package gems' } +else + Rake::GemPackageTask.new(spec) do |pkg| + pkg.gem_spec = spec + end end desc "install the gem locally" task :install => [:package] do - sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}} + sh %{gem install pkg/#{spec.name}-#{spec.version}} end desc "create a gemspec file" task :make_spec do - File.open("#{GEM}.gemspec", "w") do |file| + File.open("#{spec.name}.gemspec", "w") do |file| file.puts spec.to_ruby end -end
\ No newline at end of file +end diff --git a/railties/lib/vendor/bundler/bin/gem_bundler b/railties/lib/vendor/bundler/bin/gem_bundler deleted file mode 100755 index 7a8771efee..0000000000 --- a/railties/lib/vendor/bundler/bin/gem_bundler +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env ruby -require "optparse" -require "bundler" - -options = {} - -parser = OptionParser.new do |op| - op.banner = "Usage: gem_bundler [OPTIONS] [PATH]" - - op.on("-m", "--manifest MANIFEST") do |manifest| - options[:manifest] = manifest - end - - op.on_tail("-h", "--help", "Show this message") do - puts op - exit - end -end -parser.parse! - -options[:path] = ARGV.shift - -unless options[:path] - puts parser - puts %( - [PATH] must be specified - ) - exit -end - -unless options[:manifest] && File.exist?(options[:manifest]) - puts parser - puts %( - MANIFEST must be a valid manifest file - ) - exit -end - - -Bundler.run(options)
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler.rb b/railties/lib/vendor/bundler/lib/bundler.rb index 4dcab20da9..1ede3517dd 100644 --- a/railties/lib/vendor/bundler/lib/bundler.rb +++ b/railties/lib/vendor/bundler/lib/bundler.rb @@ -1,24 +1,34 @@ +require 'pathname' require 'logger' require 'set' +require 'erb' # Required elements of rubygems require "rubygems/remote_fetcher" require "rubygems/installer" require "bundler/gem_bundle" -require "bundler/installer" +require "bundler/source" require "bundler/finder" -require "bundler/gem_specification" +require "bundler/gem_ext" require "bundler/resolver" -require "bundler/manifest" -require "bundler/dependency" -require "bundler/runtime" +require "bundler/environment" +require "bundler/dsl" require "bundler/cli" +require "bundler/repository" +require "bundler/dependency" module Bundler VERSION = "0.5.0" - def self.run(options = {}) - manifest = ManifestBuilder.load(options[:path], options[:manifest]) - manifest.install + class << self + attr_writer :logger + + def logger + @logger ||= begin + logger = Logger.new(STDOUT, Logger::INFO) + logger.formatter = proc {|_,_,_,msg| "#{msg}\n" } + logger + end + end end -end
\ No newline at end of file +end diff --git a/railties/lib/vendor/bundler/lib/bundler/cli.rb b/railties/lib/vendor/bundler/lib/bundler/cli.rb index ed49ef88f0..df9181fbc4 100644 --- a/railties/lib/vendor/bundler/lib/bundler/cli.rb +++ b/railties/lib/vendor/bundler/lib/bundler/cli.rb @@ -1,24 +1,44 @@ -module Bundler - module CLI +require "optparse" - def default_manifest - current = Pathname.new(Dir.pwd) +module Bundler + class CLI + def self.run(command, options = {}) + new(options).run(command) + rescue DefaultManifestNotFound => e + Bundler.logger.error "Could not find a Gemfile to use" + exit 2 + rescue InvalidEnvironmentName => e + Bundler.logger.error "Gemfile error: #{e.message}" + exit + rescue InvalidRepository => e + Bundler.logger.error e.message + exit + rescue VersionConflict => e + Bundler.logger.error e.message + exit + rescue GemNotFound => e + Bundler.logger.error e.message + exit + end - begin - manifest = current.join("Gemfile") - return manifest.to_s if File.exist?(manifest) - current = current.parent - end until current.root? - nil + def initialize(options) + @options = options + @manifest = Bundler::Environment.load(@options[:manifest]) end - module_function :default_manifest + def bundle + @manifest.install(@options[:update]) + end - def default_path - Pathname.new(File.dirname(default_manifest)).join("vendor").join("gems").to_s + def exec + @manifest.setup_environment + # w0t? + super(*@options[:args]) end - module_function :default_path + def run(command) + send(command) + end end -end
\ No newline at end of file +end diff --git a/railties/lib/vendor/bundler/lib/bundler/commands/bundle_command.rb b/railties/lib/vendor/bundler/lib/bundler/commands/bundle_command.rb new file mode 100644 index 0000000000..a1f9590f75 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/commands/bundle_command.rb @@ -0,0 +1,31 @@ +class Gem::Commands::BundleCommand < Gem::Command + + def initialize + super('bundle', 'Create a gem bundle based on your Gemfile', {:manifest => nil, :update => false}) + + add_option('-m', '--manifest MANIFEST', "Specify the path to the manifest file") do |manifest, options| + options[:manifest] = manifest + end + + add_option('-u', '--update', "Force a remote check for newer gems") do + options[:update] = true + end + end + + def usage + "#{program_name}" + end + + def description # :nodoc: + <<-EOF +Bundle stuff + EOF + end + + def execute + # Prevent the bundler from getting required unless it is actually being used + require 'bundler' + Bundler::CLI.run(:bundle, options) + end + +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/commands/exec_command.rb b/railties/lib/vendor/bundler/lib/bundler/commands/exec_command.rb new file mode 100644 index 0000000000..228aa60619 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/commands/exec_command.rb @@ -0,0 +1,31 @@ +class Gem::Commands::ExecCommand < Gem::Command + + def initialize + super('exec', 'Run a command in context of a gem bundle', {:manifest => nil}) + + add_option('-m', '--manifest MANIFEST', "Specify the path to the manifest file") do |manifest, options| + options[:manifest] = manifest + end + end + + def usage + "#{program_name} COMMAND" + end + + def arguments # :nodoc: + "COMMAND command to run in context of the gem bundle" + end + + def description # :nodoc: + <<-EOF.gsub(' ', '') + Run in context of a bundle + EOF + end + + def execute + # Prevent the bundler from getting required unless it is actually being used + require 'bundler' + Bundler::CLI.run(:exec, options) + end + +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/dependency.rb b/railties/lib/vendor/bundler/lib/bundler/dependency.rb index 739a7a117d..b627b58662 100644 --- a/railties/lib/vendor/bundler/lib/bundler/dependency.rb +++ b/railties/lib/vendor/bundler/lib/bundler/dependency.rb @@ -1,9 +1,10 @@ module Bundler - class Dependency + class InvalidEnvironmentName < StandardError; end + class Dependency attr_reader :name, :version, :require_as, :only, :except - def initialize(name, options = {}) + def initialize(name, options = {}, &block) options.each do |k, v| options[k.to_s] = v end @@ -11,8 +12,13 @@ module Bundler @name = name @version = options["version"] || ">= 0" @require_as = Array(options["require_as"] || name) - @only = Array(options["only"]).map {|e| e.to_s } if options["only"] - @except = Array(options["except"]).map {|e| e.to_s } if options["except"] + @only = options["only"] + @except = options["except"] + @block = block + + if (@only && @only.include?("rubygems")) || (@except && @except.include?("rubygems")) + raise InvalidEnvironmentName, "'rubygems' is not a valid environment name" + end end def in?(environment) @@ -27,9 +33,24 @@ module Bundler to_gem_dependency.to_s end + def require(environment) + return unless in?(environment) + + @require_as.each do |file| + super(file) + end + + @block.call if @block + end + def to_gem_dependency @gem_dep ||= Gem::Dependency.new(name, version) end + def ==(o) + [name, version, require_as, only, except] == + [o.name, o.version, o.require_as, o.only, o.except] + end + end -end
\ No newline at end of file +end diff --git a/railties/lib/vendor/bundler/lib/bundler/dsl.rb b/railties/lib/vendor/bundler/lib/bundler/dsl.rb new file mode 100644 index 0000000000..d9a86ee1fd --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/dsl.rb @@ -0,0 +1,109 @@ +module Bundler + class ManifestFileNotFound < StandardError; end + + class Dsl + def initialize(environment) + @environment = environment + @sources = Hash.new { |h,k| h[k] = {} } + end + + def bundle_path(path) + path = Pathname.new(path) + @environment.gem_path = (path.relative? ? + @environment.root.join(path) : path).expand_path + end + + def bin_path(path) + path = Pathname.new(path) + @environment.bindir = (path.relative? ? + @environment.root.join(path) : path).expand_path + end + + def disable_rubygems + @environment.rubygems = false + end + + def disable_system_gems + @environment.system_gems = false + end + + def source(source) + source = GemSource.new(:uri => source) + unless @environment.sources.include?(source) + @environment.add_source(source) + end + end + + def only(env) + old, @only = @only, _combine_onlys(env) + yield + @only = old + end + + def except(env) + old, @except = @except, _combine_excepts(env) + yield + @except = old + end + + def clear_sources + @environment.clear_sources + end + + def gem(name, *args) + options = args.last.is_a?(Hash) ? args.pop : {} + version = args.last + + options[:only] = _combine_onlys(options[:only] || options["only"]) + options[:except] = _combine_excepts(options[:except] || options["except"]) + + dep = Dependency.new(name, options.merge(:version => version)) + + # OMG REFACTORZ. KTHX + if vendored_at = options[:vendored_at] + vendored_at = Pathname.new(vendored_at) + vendored_at = @environment.filename.dirname.join(vendored_at) if vendored_at.relative? + + @sources[:directory][vendored_at.to_s] ||= begin + source = DirectorySource.new( + :name => name, + :version => version, + :location => vendored_at + ) + @environment.add_priority_source(source) + true + end + elsif git = options[:git] + @sources[:git][git] ||= begin + source = GitSource.new( + :name => name, + :version => version, + :uri => git, + :ref => options[:commit] || options[:tag], + :branch => options[:branch] + ) + @environment.add_priority_source(source) + true + end + end + + @environment.dependencies << dep + end + + private + + def _combine_onlys(only) + return @only unless only + only = [only].flatten.compact.uniq.map { |o| o.to_s } + only &= @only if @only + only + end + + def _combine_excepts(except) + return @except unless except + except = [except].flatten.compact.uniq.map { |o| o.to_s } + except |= @except if @except + except + end + end +end diff --git a/railties/lib/vendor/bundler/lib/bundler/environment.rb b/railties/lib/vendor/bundler/lib/bundler/environment.rb new file mode 100644 index 0000000000..f07a9e2c6f --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/environment.rb @@ -0,0 +1,111 @@ +require "rubygems/source_index" + +module Bundler + class DefaultManifestNotFound < StandardError; end + + class Environment + attr_reader :filename, :dependencies + attr_accessor :rubygems, :system_gems, :gem_path, :bindir + + def self.load(gemfile = nil) + gemfile = gemfile ? Pathname.new(gemfile) : default_manifest_file + + unless gemfile.file? + raise ManifestFileNotFound, "#{filename.inspect} does not exist" + end + + new(gemfile) + end + + def self.default_manifest_file + current = Pathname.new(Dir.pwd) + + until current.root? + filename = current.join("Gemfile") + return filename if filename.exist? + current = current.parent + end + + raise DefaultManifestNotFound + end + + def initialize(filename) #, sources, dependencies, bindir, path, rubygems, system_gems) + @filename = filename + @default_sources = [GemSource.new(:uri => "http://gems.rubyforge.org")] + @sources = [] + @priority_sources = [] + @dependencies = [] + @rubygems = true + @system_gems = true + + # Evaluate the Gemfile + builder = Dsl.new(self) + builder.instance_eval(File.read(filename)) + end + + def install(update = false) + begin + tmp_path = filename.dirname.join(".tmp") + FileUtils.mkdir_p(tmp_path) + sources.each { |s| s.tmp_path = tmp_path } + repository.install(gem_dependencies, sources, + :rubygems => rubygems, + :system_gems => system_gems, + :manifest => filename, + :update => update + ) + ensure + FileUtils.rm_rf(tmp_path) + end + Bundler.logger.info "Done." + end + + def setup_environment + unless system_gems + ENV["GEM_HOME"] = gem_path + ENV["GEM_PATH"] = gem_path + end + ENV["PATH"] = "#{bindir}:#{ENV["PATH"]}" + ENV["RUBYOPT"] = "-r#{gem_path}/environment #{ENV["RUBYOPT"]}" + end + + def root + filename.parent + end + + def gem_path + @gem_path ||= root.join("vendor", "gems") + end + + def bindir + @bindir ||= root.join("bin") + end + + def sources + @priority_sources + @sources + @default_sources + end + + def add_source(source) + @sources << source + end + + def add_priority_source(source) + @priority_sources << source + end + + def clear_sources + @sources.clear + @default_sources.clear + end + + private + + def repository + @repository ||= Repository.new(gem_path, bindir) + end + + def gem_dependencies + @gem_dependencies ||= dependencies.map { |d| d.to_gem_dependency } + end + end +end diff --git a/railties/lib/vendor/bundler/lib/bundler/finder.rb b/railties/lib/vendor/bundler/lib/bundler/finder.rb index 43ff370ae4..b77ca65709 100644 --- a/railties/lib/vendor/bundler/lib/bundler/finder.rb +++ b/railties/lib/vendor/bundler/lib/bundler/finder.rb @@ -1,42 +1,51 @@ module Bundler + # Finder behaves like a rubygems source index in that it responds + # to #search. It also resolves a list of dependencies finding the + # best possible configuration of gems that satisifes all requirements + # without causing any gem activation errors. class Finder - def initialize(*sources) - @results = {} - @index = Hash.new { |h,k| h[k] = {} } - sources.each { |source| fetch(source) } + # Takes an array of gem sources and fetches the full index of + # gems from each one. It then combines the indexes together keeping + # track of the original source so that any resolved gem can be + # fetched from the correct source. + # + # ==== Parameters + # *sources<String>:: URI pointing to the gem repository + def initialize(*sources) + @cache = {} + @index = {} + @sources = sources end - def resolve(*dependencies) - resolved = Resolver.resolve(dependencies, self) - resolved && GemBundle.new(resolved.all_specs) + # Searches for a gem that matches the dependency + # + # ==== Parameters + # dependency<Gem::Dependency>:: The gem dependency to search for + # + # ==== Returns + # [Gem::Specification]:: A collection of gem specifications + # matching the search + def search(dependency) + @cache[dependency.hash] ||= begin + find_by_name(dependency.name).select do |spec| + dependency =~ spec + end.sort_by {|s| s.version } + end end - def fetch(source) - deflated = Gem::RemoteFetcher.fetcher.fetch_path("#{source}/Marshal.4.8.Z") - inflated = Gem.inflate deflated + private - append(Marshal.load(inflated), source) - rescue Gem::RemoteFetcher::FetchError => e - raise ArgumentError, "#{source} is not a valid source: #{e.message}" - end - - def append(index, source) - index.gems.values.each do |spec| - next unless Gem::Platform.match(spec.platform) - spec.source = source - @index[spec.name][spec.version] ||= spec + def find_by_name(name) + matches = @index[name] ||= begin + versions = {} + @sources.reverse_each do |source| + versions.merge! source.specs[name] || {} + end + versions end - self + matches.values end - def search(dependency) - @results[dependency.hash] ||= begin - possibilities = @index[dependency.name].values - possibilities.select do |spec| - dependency =~ spec - end.sort_by {|s| s.version } - end - end end end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/gem_bundle.rb b/railties/lib/vendor/bundler/lib/bundler/gem_bundle.rb index b749720fd9..80d7710683 100644 --- a/railties/lib/vendor/bundler/lib/bundler/gem_bundle.rb +++ b/railties/lib/vendor/bundler/lib/bundler/gem_bundle.rb @@ -1,22 +1,10 @@ module Bundler class GemBundle < Array - def download(directory) - FileUtils.mkdir_p(directory) - - current = Dir[File.join(directory, "cache", "*.gem*")] - - each do |spec| - cached = File.join(directory, "cache", "#{spec.full_name}.gem") - - unless File.file?(cached) - Gem::RemoteFetcher.fetcher.download(spec, spec.source, directory) - end - - current.delete(cached) + def download(repository) + sort_by {|s| s.full_name.downcase }.each do |spec| + spec.source.download(spec, repository) end - current.each { |file| File.delete(file) } - self end end diff --git a/railties/lib/vendor/bundler/lib/bundler/gem_ext.rb b/railties/lib/vendor/bundler/lib/bundler/gem_ext.rb new file mode 100644 index 0000000000..155ad04c7e --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/gem_ext.rb @@ -0,0 +1,25 @@ +module Gem + class Installer + def app_script_text(bin_file_name) + path = @gem_home + template = File.read(File.join(File.dirname(__FILE__), "templates", "app_script.erb")) + erb = ERB.new(template, nil, '-') + erb.result(binding) + end + end + + class Specification + attr_accessor :source + attr_accessor :location + + # Hack to fix github's strange marshal file + def specification_version + @specification_version && @specification_version.to_i + end + + alias full_gem_path_without_location full_gem_path + def full_gem_path + @location ? @location : full_gem_path_without_location + end + end +end diff --git a/railties/lib/vendor/bundler/lib/bundler/gem_specification.rb b/railties/lib/vendor/bundler/lib/bundler/gem_specification.rb deleted file mode 100644 index 680b61fd69..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/gem_specification.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Gem - class Specification - attribute :source - - def source=(source) - @source = source.is_a?(URI) ? source : URI.parse(source) - raise ArgumentError, "The source must be an absolute URI" unless @source.absolute? - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/installer.rb b/railties/lib/vendor/bundler/lib/bundler/installer.rb deleted file mode 100644 index 581d9d3c8e..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/installer.rb +++ /dev/null @@ -1,44 +0,0 @@ -module Bundler - class Installer - def initialize(path) - if !File.directory?(path) - raise ArgumentError, "#{path} is not a directory" - elsif !File.directory?(File.join(path, "cache")) - raise ArgumentError, "#{path} is not a valid environment (it does not contain a cache directory)" - end - - @path = path - @gems = Dir[(File.join(path, "cache", "*.gem"))] - end - - def install(options = {}) - bin_dir = options[:bin_dir] ||= File.join(@path, "bin") - - specs = Dir[File.join(@path, "specifications", "*.gemspec")] - gems = Dir[File.join(@path, "gems", "*")] - - @gems.each do |gem| - name = File.basename(gem).gsub(/\.gem$/, '') - installed = specs.any? { |g| File.basename(g) == "#{name}.gemspec" } && - gems.any? { |g| File.basename(g) == name } - - unless installed - installer = Gem::Installer.new(gem, :install_dir => @path, - :ignore_dependencies => true, - :env_shebang => true, - :wrappers => true, - :bin_dir => bin_dir) - installer.install - end - - # remove this spec - specs.delete_if { |g| File.basename(g) == "#{name}.gemspec"} - gems.delete_if { |g| File.basename(g) == name } - end - - (specs + gems).each do |path| - FileUtils.rm_rf(path) - end - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/manifest.rb b/railties/lib/vendor/bundler/lib/bundler/manifest.rb deleted file mode 100644 index 847a41940d..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/manifest.rb +++ /dev/null @@ -1,130 +0,0 @@ -require "rubygems/source_index" -require "pathname" - -module Bundler - class VersionConflict < StandardError; end - - class Manifest - attr_reader :sources, :dependencies, :path - - def initialize(sources, dependencies, path) - sources.map! {|s| s.is_a?(URI) ? s : URI.parse(s) } - @sources, @dependencies, @path = sources, dependencies, Pathname.new(path) - end - - def fetch - return if all_gems_installed? - - finder = Finder.new(*sources) - unless bundle = finder.resolve(*gem_dependencies) - gems = @dependencies.map {|d| " #{d.to_s}" }.join("\n") - raise VersionConflict, "No compatible versions could be found for:\n#{gems}" - end - - bundle.download(@path) - end - - def install(options = {}) - fetch - installer = Installer.new(@path) - installer.install # options come here - create_load_paths_files(File.join(@path, "environments")) - create_fake_rubygems(File.join(@path, "environments")) - end - - def activate(environment = "default") - require File.join(@path, "environments", "#{environment}.rb") - end - - def require_all - dependencies.each do |dep| - dep.require_as.each {|file| require file } - end - end - - def gems_for(environment) - deps = dependencies.select { |d| d.in?(environment) } - deps.map! { |d| d.to_gem_dependency } - index = Gem::SourceIndex.from_gems_in(File.join(@path, "specifications")) - Resolver.resolve(deps, index).all_specs - end - - def environments - envs = dependencies.map {|dep| Array(dep.only) + Array(dep.except) }.flatten - envs << "default" - end - - private - - def gem_dependencies - @gem_dependencies ||= dependencies.map { |d| d.to_gem_dependency } - end - - def all_gems_installed? - gem_versions = {} - - Dir[File.join(@path, "cache", "*.gem")].each do |file| - file =~ /\/([^\/]+)-([\d\.]+)\.gem$/ - name, version = $1, $2 - gem_versions[name] = Gem::Version.new(version) - end - - gem_dependencies.all? do |dep| - gem_versions[dep.name] && - dep.version_requirements.satisfied_by?(gem_versions[dep.name]) - end - end - - def create_load_paths_files(path) - FileUtils.mkdir_p(path) - environments.each do |environment| - gem_specs = gems_for(environment) - File.open(File.join(path, "#{environment}.rb"), "w") do |file| - file.puts <<-RUBY_EVAL - module Bundler - def self.rubygems_required - #{create_gem_stubs(path, gem_specs)} - end - end - RUBY_EVAL - file.puts "$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))" - load_paths_for_specs(gem_specs).each do |load_path| - file.puts "$LOAD_PATH.unshift #{load_path.inspect}" - end - end - end - end - - def create_gem_stubs(path, gem_specs) - gem_specs.map do |spec| - path = File.expand_path(File.join(path, '..', 'specifications', "#{spec.full_name}.gemspec")) - %{ - Gem.loaded_specs["#{spec.name}"] = eval(File.read("#{path}")) - } - end.join("\n") - end - - def create_fake_rubygems(path) - File.open(File.join(path, "rubygems.rb"), "w") do |file| - file.puts <<-RUBY_EVAL - $:.delete File.expand_path(File.dirname(__FILE__)) - load "rubygems.rb" - if defined?(Bundler) && Bundler.respond_to?(:rubygems_required) - Bundler.rubygems_required - end - RUBY_EVAL - end - end - - def load_paths_for_specs(specs) - load_paths = [] - specs.each do |spec| - load_paths << File.join(spec.full_gem_path, spec.bindir) if spec.bindir - spec.require_paths.each do |path| - load_paths << File.join(spec.full_gem_path, path) - end - end - load_paths - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/repository.rb b/railties/lib/vendor/bundler/lib/bundler/repository.rb new file mode 100644 index 0000000000..1a1dc7497d --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/repository.rb @@ -0,0 +1,151 @@ +require "bundler/repository/gem_repository" +require "bundler/repository/directory_repository" + +module Bundler + class InvalidRepository < StandardError ; end + + class Repository + attr_reader :path + + def initialize(path, bindir) + FileUtils.mkdir_p(path) + + @path = Pathname.new(path) + @bindir = Pathname.new(bindir) + + @repos = { + :gem => Gems.new(@path, @bindir), + :directory => Directory.new(@path.join("dirs"), @bindir) + } + end + + def install(dependencies, sources, options = {}) + if options[:update] || !satisfies?(dependencies) + fetch(dependencies, sources) + expand(options) + else + # Remove any gems that are still around if the Gemfile changed without + # requiring new gems to be download (e.g. a line in the Gemfile was + # removed) + cleanup(Resolver.resolve(dependencies, [source_index])) + end + configure(options) + sync + end + + def gems + gems = [] + each_repo do |repo| + gems.concat repo.gems + end + gems + end + + def satisfies?(dependencies) + index = source_index + dependencies.all? { |dep| index.search(dep).size > 0 } + end + + def source_index + index = Gem::SourceIndex.new + + each_repo do |repo| + index.gems.merge!(repo.source_index.gems) + end + + index + end + + def add_spec(type, spec) + @repos[type].add_spec(spec) + end + + def download_path_for(type) + @repos[type].download_path_for + end + + private + + def cleanup(bundle) + each_repo do |repo| + repo.cleanup(bundle) + end + end + + def each_repo + @repos.each do |k, repo| + yield repo + end + end + + def fetch(dependencies, sources) + bundle = Resolver.resolve(dependencies, sources) + # Cleanup here to remove any gems that could cause problem in the expansion + # phase + # + # TODO: Try to avoid double cleanup + cleanup(bundle) + bundle.download(self) + end + + def sync + glob = gems.map { |g| g.executables }.flatten.join(',') + + (Dir[@bindir.join("*")] - Dir[@bindir.join("{#{glob}}")]).each do |file| + Bundler.logger.info "Deleting bin file: #{File.basename(file)}" + FileUtils.rm_rf(file) + end + end + + def expand(options) + each_repo do |repo| + repo.expand(options) + end + end + + def configure(options) + generate_environment(options) + end + + def generate_environment(options) + FileUtils.mkdir_p(path) + + specs = gems + load_paths = load_paths_for_specs(specs) + bindir = @bindir.relative_path_from(path).to_s + filename = options[:manifest].relative_path_from(path).to_s + spec_files = specs.inject({}) do |hash, spec| + relative = spec.loaded_from.relative_path_from(@path).to_s + hash.merge!(spec.name => relative) + end + + File.open(path.join("environment.rb"), "w") do |file| + template = File.read(File.join(File.dirname(__FILE__), "templates", "environment.erb")) + erb = ERB.new(template, nil, '-') + file.puts erb.result(binding) + end + end + + def load_paths_for_specs(specs) + load_paths = [] + specs.each do |spec| + gem_path = Pathname.new(spec.full_gem_path) + if spec.bindir + load_paths << gem_path.join(spec.bindir).relative_path_from(@path).to_s + end + spec.require_paths.each do |path| + load_paths << gem_path.join(path).relative_path_from(@path).to_s + end + end + load_paths + end + + def require_code(file, dep) + constraint = case + when dep.only then %{ if #{dep.only.inspect}.include?(env)} + when dep.except then %{ unless #{dep.except.inspect}.include?(env)} + end + "require #{file.inspect}#{constraint}" + end + end +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/repository/directory_repository.rb b/railties/lib/vendor/bundler/lib/bundler/repository/directory_repository.rb new file mode 100644 index 0000000000..e97dd38dd5 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/repository/directory_repository.rb @@ -0,0 +1,46 @@ +module Bundler + class Repository + class Directory + attr_reader :path, :bindir + + def initialize(path, bindir) + @path = path + @bindir = bindir + + FileUtils.mkdir_p(path.to_s) + end + + def source_index + index = Gem::SourceIndex.from_gems_in(@path.join("specifications")) + index.each { |n, spec| spec.loaded_from = @path.join("specifications", "#{spec.full_name}.gemspec") } + index + end + + def gems + source_index.gems.values + end + + def add_spec(spec) + destination = path.join('specifications') + destination.mkdir unless destination.exist? + + File.open(destination.join("#{spec.full_name}.gemspec"), 'w') do |f| + f.puts spec.to_ruby + end + end + + def download_path_for + @path.join("dirs") + end + + # Checks whether a gem is installed + def expand(options) + # raise NotImplementedError + end + + def cleanup(gems) + # raise NotImplementedError + end + end + end +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/repository/gem_repository.rb b/railties/lib/vendor/bundler/lib/bundler/repository/gem_repository.rb new file mode 100644 index 0000000000..90de49d83d --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/repository/gem_repository.rb @@ -0,0 +1,108 @@ +module Bundler + class Repository + class Gems + attr_reader :path, :bindir + + def initialize(path, bindir) + @path = path + @bindir = bindir + end + + # Returns the source index for all gems installed in the + # repository + def source_index + index = Gem::SourceIndex.from_gems_in(@path.join("specifications")) + index.each { |n, spec| spec.loaded_from = @path.join("specifications", "#{spec.full_name}.gemspec") } + index + end + + def gems + source_index.gems.values + end + + # Checks whether a gem is installed + def expand(options) + cached_gems.each do |name, version| + unless installed?(name, version) + install_cached_gem(name, version, options) + end + end + end + + def cleanup(gems) + glob = gems.map { |g| g.full_name }.join(',') + base = path.join("{cache,specifications,gems}") + + (Dir[base.join("*")] - Dir[base.join("{#{glob}}{.gemspec,.gem,}")]).each do |file| + if File.basename(file) =~ /\.gem$/ + name = File.basename(file, '.gem') + Bundler.logger.info "Deleting gem: #{name}" + end + FileUtils.rm_rf(file) + end + end + + def add_spec(spec) + raise NotImplementedError + end + + def download_path_for + path + end + + private + + def cache_path + @path.join("cache") + end + + def cache_files + Dir[cache_path.join("*.gem")] + end + + def cached_gems + cache_files.map do |f| + full_name = File.basename(f).gsub(/\.gem$/, '') + full_name.split(/-(?=[^-]+$)/) + end + end + + def spec_path + @path.join("specifications") + end + + def spec_files + Dir[spec_path.join("*.gemspec")] + end + + def gem_path + @path.join("gems") + end + + def gem_paths + Dir[gem_path.join("*")] + end + + def installed?(name, version) + spec_files.any? { |g| File.basename(g) == "#{name}-#{version}.gemspec" } && + gem_paths.any? { |g| File.basename(g) == "#{name}-#{version}" } + end + + def install_cached_gem(name, version, options = {}) + cached_gem = cache_path.join("#{name}-#{version}.gem") + # TODO: Add a warning if cached_gem is not a file + if cached_gem.file? + Bundler.logger.info "Installing #{name}-#{version}.gem" + installer = Gem::Installer.new(cached_gem.to_s, options.merge( + :install_dir => @path, + :ignore_dependencies => true, + :env_shebang => true, + :wrappers => true, + :bin_dir => @bindir + )) + installer.install + end + end + end + end +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver.rb b/railties/lib/vendor/bundler/lib/bundler/resolver.rb index 1ec89e53c4..2a6a6371c2 100644 --- a/railties/lib/vendor/bundler/lib/bundler/resolver.rb +++ b/railties/lib/vendor/bundler/lib/bundler/resolver.rb @@ -1,19 +1,189 @@ -require 'bundler/resolver/inspect' -require 'bundler/resolver/search' -require 'bundler/resolver/engine' -require 'bundler/resolver/stack' -require 'bundler/resolver/state' +# This is the latest iteration of the gem dependency resolving algorithm. As of now, +# it can resolve (as a success of failure) any set of gem dependencies we throw at it +# in a reasonable amount of time. The most iterations I've seen it take is about 150. +# The actual implementation of the algorithm is not as good as it could be yet, but that +# can come later. + +# Extending Gem classes to add necessary tracking information +module Gem + class Dependency + def required_by + @required_by ||= [] + end + end + class Specification + def required_by + @required_by ||= [] + end + end +end module Bundler - module Resolver - def self.resolve(deps, source_index = Gem.source_index, logger = nil) - unless logger - logger = Logger.new($stderr) - logger.datetime_format = "" - logger.level = ENV["GEM_RESOLVER_DEBUG"] ? Logger::DEBUG : Logger::ERROR + class GemNotFound < StandardError; end + class VersionConflict < StandardError; end + + class Resolver + + attr_reader :errors + + # Figures out the best possible configuration of gems that satisfies + # the list of passed dependencies and any child dependencies without + # causing any gem activation errors. + # + # ==== Parameters + # *dependencies<Gem::Dependency>:: The list of dependencies to resolve + # + # ==== Returns + # <GemBundle>,nil:: If the list of dependencies can be resolved, a + # collection of gemspecs is returned. Otherwise, nil is returned. + def self.resolve(requirements, sources) + Bundler.logger.info "Calculating dependencies..." + + resolver = new(sources) + result = catch(:success) do + resolver.resolve(requirements, {}) + output = resolver.errors.inject("") do |o, (conflict, (origin, requirement))| + o << " Conflict on: #{conflict.inspect}:\n" + o << " * #{conflict} (#{origin.version}) activated by #{origin.required_by.first}\n" + o << " * #{requirement} required by #{requirement.required_by.first}\n" + o << " All possible versions of origin requirements conflict." + end + raise VersionConflict, "No compatible versions could be found for required dependencies:\n #{output}" + nil + end + result && GemBundle.new(result.values) + end + + def initialize(sources) + @errors = {} + @stack = [] + @specs = Hash.new { |h,k| h[k] = {} } + @cache = {} + @index = {} + + sources.reverse_each do |source| + source.gems.values.each do |spec| + # TMP HAX FOR OPTZ + spec.source = source + next unless Gem::Platform.match(spec.platform) + @specs[spec.name][spec.version] = spec + end + end + end + + def resolve(reqs, activated) + # If the requirements are empty, then we are in a success state. Aka, all + # gem dependencies have been resolved. + throw :success, activated if reqs.empty? + + # Sort requirements so that the ones that are easiest to resolve are first. + # Easiest to resolve is defined by: Is this gem already activated? Otherwise, + # check the number of child dependencies this requirement has. + reqs = reqs.sort_by do |req| + activated[req.name] ? 0 : search(req).size + end + + activated = activated.dup + # Pull off the first requirement so that we can resolve it + current = reqs.shift + + # Check if the gem has already been activated, if it has, we will make sure + # that the currently activated gem satisfies the requirement. + if existing = activated[current.name] + if current.version_requirements.satisfied_by?(existing.version) + @errors.delete(existing.name) + # Since the current requirement is satisfied, we can continue resolving + # the remaining requirements. + resolve(reqs, activated) + else + @errors[existing.name] = [existing, current] + # Since the current requirement conflicts with an activated gem, we need + # to backtrack to the current requirement's parent and try another version + # of it (maybe the current requirement won't be present anymore). If the + # current requirement is a root level requirement, we need to jump back to + # where the conflicting gem was activated. + parent = current.required_by.last || existing.required_by.last + # We track the spot where the current gem was activated because we need + # to keep a list of every spot a failure happened. + throw parent.name, existing.required_by.last.name + end + else + # There are no activated gems for the current requirement, so we are going + # to find all gems that match the current requirement and try them in decending + # order. We also need to keep a set of all conflicts that happen while trying + # this gem. This is so that if no versions work, we can figure out the best + # place to backtrack to. + conflicts = Set.new + + # Fetch all gem versions matching the requirement + # + # TODO: Warn / error when no matching versions are found. + matching_versions = search(current) + + if matching_versions.empty? + if current.required_by.empty? + raise GemNotFound, "Could not find gem '#{current}' in any of the sources" + end + Bundler.logger.warn "Could not find gem '#{current}' (required by '#{current.required_by.last}') in any of the sources" + end + + matching_versions.reverse_each do |spec| + conflict = resolve_requirement(spec, current, reqs.dup, activated.dup) + conflicts << conflict if conflict + end + # If the current requirement is a root level gem and we have conflicts, we + # can figure out the best spot to backtrack to. + if current.required_by.empty? && !conflicts.empty? + # Check the current "catch" stack for the first one that is included in the + # conflicts set. That is where the parent of the conflicting gem was required. + # By jumping back to this spot, we can try other version of the parent of + # the conflicting gem, hopefully finding a combination that activates correctly. + @stack.reverse_each do |savepoint| + if conflicts.include?(savepoint) + throw savepoint + end + end + end + end + end + + def resolve_requirement(spec, requirement, reqs, activated) + # We are going to try activating the spec. We need to keep track of stack of + # requirements that got us to the point of activating this gem. + spec.required_by.replace requirement.required_by + spec.required_by << requirement + + activated[spec.name] = spec + + # Now, we have to loop through all child dependencies and add them to our + # array of requirements. + spec.dependencies.each do |dep| + next if dep.type == :development + dep.required_by << requirement + reqs << dep end - Engine.resolve(deps, source_index, logger) + # We create a savepoint and mark it by the name of the requirement that caused + # the gem to be activated. If the activated gem ever conflicts, we are able to + # jump back to this point and try another version of the gem. + length = @stack.length + @stack << requirement.name + retval = catch(requirement.name) do + resolve(reqs, activated) + end + # Since we're doing a lot of throw / catches. A push does not necessarily match + # up to a pop. So, we simply slice the stack back to what it was before the catch + # block. + @stack.slice!(length..-1) + retval + end + + def search(dependency) + @cache[dependency.hash] ||= begin + @specs[dependency.name].values.select do |spec| + dependency =~ spec + end.sort_by {|s| s.version } + end end end end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/builders.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/builders.rb deleted file mode 100644 index 2b7b48211c..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/builders.rb +++ /dev/null @@ -1,61 +0,0 @@ -module Bundler - module Resolver - module Builders - def build_index(&block) - index = Gem::SourceIndex.new - IndexBuilder.run(index, &block) if block_given? - index - end - - def build_spec(name, version, &block) - spec = Gem::Specification.new - spec.instance_variable_set(:@name, name) - spec.instance_variable_set(:@version, Gem::Version.new(version)) - DepBuilder.run(spec, &block) if block_given? - spec - end - - def build_dep(name, requirements, type = :runtime) - Gem::Dependency.new(name, requirements, type) - end - - class IndexBuilder - include Builders - - def self.run(index, &block) - new(index).run(&block) - end - - def initialize(index) - @index = index - end - - def run(&block) - instance_eval(&block) - end - - def add_spec(*args, &block) - @index.add_spec(build_spec(*args, &block)) - end - end - - class DepBuilder - def self.run(spec, &block) - new(spec).run(&block) - end - - def initialize(spec) - @spec = spec - end - - def run(&block) - instance_eval(&block) - end - - def runtime(name, requirements) - @spec.add_runtime_dependency(name, requirements) - end - end - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/engine.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/engine.rb deleted file mode 100644 index 475ba516ff..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/engine.rb +++ /dev/null @@ -1,38 +0,0 @@ -module Bundler - module Resolver - class ClosedSet < Set - end - - class Engine - include Search, Inspect - - def self.resolve(deps, source_index, logger) - new(deps, source_index, logger).resolve - end - - def initialize(deps, source_index, logger) - @deps, @source_index, @logger = deps, source_index, logger - logger.debug "searching for #{gem_resolver_inspect(@deps)}" - end - attr_reader :deps, :source_index, :logger, :solution - - def resolve - state = State.initial(self, [], Stack.new, Stack.new([[[], @deps.dup]])) - if solution = search(state) - logger.info "got the solution with #{solution.all_specs.size} specs" - solution.dump(Logger::INFO) - solution - end - end - - def open - @open ||= [] - end - - def closed - @closed ||= ClosedSet.new - end - end - end - -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/inspect.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/inspect.rb deleted file mode 100644 index 59640aa5f3..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/inspect.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Bundler - module Resolver - module Inspect - def gem_resolver_inspect(o) - case o - when Gem::Specification - "#<Spec: #{o.full_name}>" - when Array - '[' + o.map {|x| gem_resolver_inspect(x)}.join(", ") + ']' - when Set - gem_resolver_inspect(o.to_a) - when Hash - '{' + o.map {|k,v| "#{gem_resolver_inspect(k)} => #{gem_resolver_inspect(v)}"}.join(", ") + '}' - when Stack - o.gem_resolver_inspect - else - o.inspect - end - end - - module_function :gem_resolver_inspect - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/search.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/search.rb deleted file mode 100644 index 34102ff04c..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/search.rb +++ /dev/null @@ -1,71 +0,0 @@ -module Bundler - module Resolver - module Search - def search(initial, max_depth = (1.0 / 0.0)) - if initial.goal_met? - return initial - end - - open << initial - - while open.any? - current = open.pop - closed << current - - new = [] - current.each_possibility do |attempt| - unless closed.include?(attempt) - if attempt.goal_met? - return attempt - elsif attempt.depth < max_depth - new << attempt - end - end - end - new.reverse.each do |state| - open << state - end - end - - nil - end - - def open - raise "implement #open in #{self.class}" - end - - def closed - raise "implement #closed in #{self.class}" - end - - module Node - def self.included(base) - base.extend(ClassMethods) - end - - module ClassMethods - def initial(*data) - new(0, *data) - end - end - - def initialize(depth) - @depth = depth - end - attr_reader :depth - - def child(*data) - self.class.new(@depth + 1, *data) - end - - def each_possibility - raise "implement #each_possibility on #{self.class}" - end - - def goal_met? - raise "implement #goal_met? on #{self.class}" - end - end - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/stack.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/stack.rb deleted file mode 100644 index 6e1ac67e1f..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/stack.rb +++ /dev/null @@ -1,72 +0,0 @@ -module Bundler - module Resolver - class Stack - def initialize(initial = []) - @data = [] - initial.each do |(path,value)| - self[path] = value - end - end - - def last - @data.last - end - - def []=(path, value) - raise ArgumentError, "#{path.inspect} already has a value" if key?(path) - @data << [path.dup, value] - end - - def [](path) - if key?(path) - _, value = @data.find do |(k,v)| - k == path - end - value - else - raise "No value for #{path.inspect}" - end - end - - def key?(path) - @data.any? do |(k,v)| - k == path - end - end - - def each - @data.each do |(k,v)| - yield k, v - end - end - - def map - @data.map do |(k,v)| - yield k, v - end - end - - def each_value - @data.each do |(k,v)| - yield v - end - end - - def dup - self.class.new(@data.dup) - end - - def to_s - @data.to_s - end - - def inspect - @data.inspect - end - - def gem_resolver_inspect - Inspect.gem_resolver_inspect(@data) - end - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/resolver/state.rb b/railties/lib/vendor/bundler/lib/bundler/resolver/state.rb deleted file mode 100644 index f13ecbbee7..0000000000 --- a/railties/lib/vendor/bundler/lib/bundler/resolver/state.rb +++ /dev/null @@ -1,172 +0,0 @@ -module Bundler - module Resolver - class State - include Search::Node, Inspect - - def initialize(depth, engine, path, spec_stack, dep_stack) - super(depth) - @engine, @path, @spec_stack, @dep_stack = engine, path, spec_stack, dep_stack - end - attr_reader :path - - def logger - @engine.logger - end - - def goal_met? - logger.info "checking if goal is met" - dump - no_duplicates? - all_deps.all? do |dep| - dependency_satisfied?(dep) - end - end - - def no_duplicates? - names = [] - all_specs.each do |s| - if names.include?(s.name) - raise "somehow got duplicates for #{s.name}" - end - names << s.name - end - end - - def dependency_satisfied?(dep) - all_specs.any? do |spec| - spec.satisfies_requirement?(dep) - end - end - - def each_possibility(&block) - index, dep = remaining_deps.first - if dep - logger.warn "working on #{dep} for #{spec_name}" - handle_dep(index, dep, &block) - else - logger.warn "no dependencies left for #{spec_name}" - jump_to_parent(&block) - end - end - - def handle_dep(index, dep) - specs = @engine.source_index.search(dep) - - specs.reverse.each do |s| - logger.info "attempting with spec: #{s.full_name}" - new_path = @path + [index] - new_spec_stack = @spec_stack.dup - new_dep_stack = @dep_stack.dup - - new_spec_stack[new_path] = s - new_dep_stack[new_path] = s.runtime_dependencies.sort_by do |dep| - @engine.source_index.search(dep).size - end - yield child(@engine, new_path, new_spec_stack, new_dep_stack) - end - end - - def jump_to_parent - if @path.empty? - dump - logger.warn "at the end" - return - end - - logger.info "jumping to parent for #{spec_name}" - new_path = @path[0..-2] - new_spec_stack = @spec_stack.dup - new_dep_stack = @dep_stack.dup - - yield child(@engine, new_path, new_spec_stack, new_dep_stack) - end - - def remaining_deps - remaining_deps_for(@path) - end - - def remaining_deps_for(path) - no_duplicates? - remaining = [] - @dep_stack[path].each_with_index do |dep,i| - remaining << [i, dep] unless all_specs.find {|s| s.name == dep.name} - end - remaining - end - - def deps - @dep_stack[@path] - end - - def spec - @spec_stack[@path] - end - - def spec_name - @path.empty? ? "<top>" : spec.full_name - end - - def all_deps - all_deps = Set.new - @dep_stack.each_value do |deps| - all_deps.merge(deps) - end - all_deps.to_a - end - - def all_specs - @spec_stack.map do |path,spec| - spec - end - end - - def dump(level = Logger::DEBUG) - logger.add level, "v" * 80 - logger.add level, "path: #{@path.inspect}" - logger.add level, "deps: (#{deps.size})" - deps.map do |dep| - logger.add level, gem_resolver_inspect(dep) - end - logger.add level, "remaining_deps: (#{remaining_deps.size})" - remaining_deps.each do |dep| - logger.add level, gem_resolver_inspect(dep) - end - logger.add level, "dep_stack: " - @dep_stack.each do |path,deps| - logger.add level, "#{path.inspect} (#{deps.size})" - deps.each do |dep| - logger.add level, "-> #{gem_resolver_inspect(dep)}" - end - end - logger.add level, "spec_stack: " - @spec_stack.each do |path,spec| - logger.add level, "#{path.inspect}: #{gem_resolver_inspect(spec)}" - end - logger.add level, "^" * 80 - end - - def to_dot - io = StringIO.new - io.puts 'digraph deps {' - io.puts ' fontname = "Courier";' - io.puts ' mincross = 4.0;' - io.puts ' ratio = "auto";' - dump_to_dot(io, "<top>", []) - io.puts '}' - io.string - end - - def dump_to_dot(io, name, path) - @dep_stack[path].each_with_index do |dep,i| - new_path = path + [i] - spec_name = all_specs.find {|x| x.name == dep.name}.full_name - io.puts ' "%s" -> "%s";' % [name, dep.to_s] - io.puts ' "%s" -> "%s";' % [dep.to_s, spec_name] - if @spec_stack.key?(new_path) - dump_to_dot(io, spec_name, new_path) - end - end - end - end - end -end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/runtime.rb b/railties/lib/vendor/bundler/lib/bundler/runtime.rb index 2376deef28..27e0254966 100644 --- a/railties/lib/vendor/bundler/lib/bundler/runtime.rb +++ b/railties/lib/vendor/bundler/lib/bundler/runtime.rb @@ -1,39 +1,2 @@ -module Bundler - class ManifestBuilder - - attr_reader :sources - - def self.build(path, string) - builder = new(path) - builder.instance_eval(string) - builder.to_manifest - end - - def self.load(path, file) - string = File.read(file) - build(path, string) - end - - def initialize(path) - @path = path - @sources = %w(http://gems.rubyforge.org) - @dependencies = [] - end - - def to_manifest - Manifest.new(@sources, @dependencies, @path) - end - - def source(source) - @sources << source - end - - def gem(name, *args) - options = args.last.is_a?(Hash) ? args.pop : {} - version = args.last - - @dependencies << Dependency.new(name, options.merge(:version => version)) - end - - end -end
\ No newline at end of file +require File.join(File.dirname(__FILE__), "runtime", "dsl") +require File.join(File.dirname(__FILE__), "runtime", "dependency")
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/source.rb b/railties/lib/vendor/bundler/lib/bundler/source.rb new file mode 100644 index 0000000000..37828ca316 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/source.rb @@ -0,0 +1,150 @@ +module Bundler + # Represents a source of rubygems. Initially, this is only gem repositories, but + # eventually, this will be git, svn, HTTP + class Source + attr_accessor :tmp_path + end + + class GemSource < Source + attr_reader :uri + + def initialize(options) + @uri = options[:uri] + @uri = URI.parse(@uri) unless @uri.is_a?(URI) + raise ArgumentError, "The source must be an absolute URI" unless @uri.absolute? + end + + def gems + @specs ||= fetch_specs + end + + def ==(other) + uri == other.uri + end + + def to_s + @uri.to_s + end + + class RubygemsRetardation < StandardError; end + + def download(spec, repository) + Bundler.logger.info "Downloading #{spec.full_name}.gem" + + destination = repository.download_path_for(:gem) + + unless destination.writable? + raise RubygemsRetardation + end + + Gem::RemoteFetcher.fetcher.download(spec, uri, repository.download_path_for(:gem)) + end + + private + + def fetch_specs + Bundler.logger.info "Updating source: #{to_s}" + + deflated = Gem::RemoteFetcher.fetcher.fetch_path("#{uri}/Marshal.4.8.Z") + inflated = Gem.inflate deflated + + index = Marshal.load(inflated) + index.gems + rescue Gem::RemoteFetcher::FetchError => e + raise ArgumentError, "#{to_s} is not a valid source: #{e.message}" + end + end + + class DirectorySource < Source + def initialize(options) + @name = options[:name] + @version = options[:version] + @location = options[:location] + @require_paths = options[:require_paths] || %w(lib) + end + + def gems + @gems ||= begin + specs = {} + + # Find any gemspec files in the directory and load those specs + Dir[@location.join('**', '*.gemspec')].each do |file| + path = Pathname.new(file).relative_path_from(@location).dirname + spec = eval(File.read(file)) + spec.require_paths.map! { |p| path.join(p) } + specs[spec.full_name] = spec + end + + # If a gemspec for the dependency was not found, add it to the list + if specs.keys.grep(/^#{Regexp.escape(@name)}/).empty? + case + when @version.nil? + raise ArgumentError, "If you use :at, you must specify the gem" \ + "and version you wish to stand in for" + when !Gem::Version.correct?(@version) + raise ArgumentError, "If you use :at, you must specify a gem and" \ + "version. You specified #{@version} for the version" + end + + default = Gem::Specification.new do |s| + s.name = @name + s.version = Gem::Version.new(@version) if @version + end + specs[default.full_name] = default + end + + specs + end + end + + def ==(other) + # TMP HAX + other.is_a?(DirectorySource) + end + + def to_s + "#{@name} (#{@version}) Located at: '#{@location}'" + end + + def download(spec, repository) + spec.require_paths.map! { |p| File.join(@location, p) } + repository.add_spec(:directory, spec) + end + end + + class GitSource < DirectorySource + def initialize(options) + super + @uri = options[:uri] + @ref = options[:ref] + @branch = options[:branch] + end + + def gems + FileUtils.mkdir_p(tmp_path.join("gitz")) + + # TMP HAX to get the *.gemspec reading to work + @location = tmp_path.join("gitz", @name) + + Bundler.logger.info "Cloning git repository at: #{@uri}" + `git clone #{@uri} #{@location} --no-hardlinks` + + if @ref + Dir.chdir(@location) { `git checkout #{@ref}` } + elsif @branch && @branch != "master" + Dir.chdir(@location) { `git checkout origin/#{@branch}` } + end + super + end + + def download(spec, repository) + dest = repository.download_path_for(:directory).join(@name) + spec.require_paths.map! { |p| File.join(dest, p) } + repository.add_spec(:directory, spec) + if spec.name == @name + FileUtils.mkdir_p(dest.dirname) + FileUtils.mv(tmp_path.join("gitz", spec.name), dest) + end + end + end +end
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/templates/app_script.erb b/railties/lib/vendor/bundler/lib/bundler/templates/app_script.erb new file mode 100644 index 0000000000..3e47a53ca8 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/templates/app_script.erb @@ -0,0 +1,3 @@ +<%= shebang bin_file_name %> +require File.join(File.dirname(__FILE__), "<%= path.join("environment").relative_path_from(Pathname.new(bin_dir)) %>") +load File.join(File.dirname(__FILE__), "<%= path.join("gems", @spec.full_name, @spec.bindir, bin_file_name).relative_path_from(Pathname.new(bin_dir)) %>")
\ No newline at end of file diff --git a/railties/lib/vendor/bundler/lib/bundler/templates/environment.erb b/railties/lib/vendor/bundler/lib/bundler/templates/environment.erb new file mode 100644 index 0000000000..21f3de8854 --- /dev/null +++ b/railties/lib/vendor/bundler/lib/bundler/templates/environment.erb @@ -0,0 +1,127 @@ +# DO NOT MODIFY THIS FILE +module Bundler + dir = File.dirname(__FILE__) + +<% unless options[:system_gems] -%> + ENV["GEM_HOME"] = dir + ENV["GEM_PATH"] = dir +<% end -%> + ENV["PATH"] = "#{dir}/<%= bindir %>:#{ENV["PATH"]}" + ENV["RUBYOPT"] = "-r#{__FILE__} #{ENV["RUBYOPT"]}" + +<% load_paths.each do |load_path| -%> + $LOAD_PATH.unshift File.expand_path("#{dir}/<%= load_path %>") +<% end -%> + + @gemfile = "#{dir}/<%= filename %>" + +<% if options[:rubygems] -%> + require "rubygems" + + @bundled_specs = {} +<% spec_files.each do |name, path| -%> + @bundled_specs["<%= name %>"] = eval(File.read("#{dir}/<%= path %>")) + @bundled_specs["<%= name %>"].loaded_from = "#{dir}/<%= path %>" +<% end -%> + + def self.add_specs_to_loaded_specs + Gem.loaded_specs.merge! @bundled_specs + end + + def self.add_specs_to_index + @bundled_specs.each do |name, spec| + Gem.source_index.add_spec spec + end + end + + add_specs_to_loaded_specs + add_specs_to_index +<% end -%> + + def self.require_env(env = nil) + context = Class.new do + def initialize(env) @env = env && env.to_s ; end + def method_missing(*) ; end + def only(env) + old, @only = @only, _combine_onlys(env) + yield + @only = old + end + def except(env) + old, @except = @except, _combine_excepts(env) + yield + @except = old + end + def gem(name, *args) + opt = args.last || {} + only = _combine_onlys(opt[:only] || opt["only"]) + except = _combine_excepts(opt[:except] || opt["except"]) + files = opt[:require_as] || opt["require_as"] || name + + return unless !only || only.any? {|e| e == @env } + return if except && except.any? {|e| e == @env } + + files.each { |f| require f } + yield if block_given? + true + end + private + def _combine_onlys(only) + return @only unless only + only = [only].flatten.compact.uniq.map { |o| o.to_s } + only &= @only if @only + only + end + def _combine_excepts(except) + return @except unless except + except = [except].flatten.compact.uniq.map { |o| o.to_s } + except |= @except if @except + except + end + end + context.new(env && env.to_s).instance_eval(File.read(@gemfile)) + end +end + +<% if options[:rubygems] -%> +module Gem + def source_index.refresh! + super + Bundler.add_specs_to_index + end +end +<% else -%> +$" << "rubygems.rb" + +module Kernel + def gem(*) + # Silently ignore calls to gem, since, in theory, everything + # is activated correctly already. + end +end + +# Define all the Gem errors for gems that reference them. +module Gem + def self.ruby ; <%= Gem.ruby.inspect %> ; end + class LoadError < ::LoadError; end + class Exception < RuntimeError; end + class CommandLineError < Exception; end + class DependencyError < Exception; end + class DependencyRemovalException < Exception; end + class GemNotInHomeException < Exception ; end + class DocumentError < Exception; end + class EndOfYAMLException < Exception; end + class FilePermissionError < Exception; end + class FormatException < Exception; end + class GemNotFoundException < Exception; end + class InstallError < Exception; end + class InvalidSpecificationException < Exception; end + class OperationNotSupportedError < Exception; end + class RemoteError < Exception; end + class RemoteInstallationCancelled < Exception; end + class RemoteInstallationSkipped < Exception; end + class RemoteSourceException < Exception; end + class VerificationError < Exception; end + class SystemExitException < SystemExit; end +end +<% end -%>
\ No newline at end of file diff --git a/railties/rails.gemspec b/railties/rails.gemspec index b937667246..67893e4347 100644 --- a/railties/rails.gemspec +++ b/railties/rails.gemspec @@ -6,14 +6,14 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.default_executable = %q{rails} s.description = %q{ Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates. } s.email = %q{david@loudthinking.com} s.executables = ["rails"] - s.files = ["bin", "builtin", "CHANGELOG", "guides", "lib", "MIT-LICENSE", "pkg", "rails.gemspec", "Rakefile", "README", "bin/rails", "builtin/rails_info", "builtin/rails_info/rails", "builtin/rails_info/rails/info.rb", "builtin/rails_info/rails/info_controller.rb", "builtin/rails_info/rails/info_helper.rb", "builtin/rails_info/rails_info_controller.rb", "guides/files", "guides/files/javascripts", "guides/files/javascripts/code_highlighter.js", "guides/files/javascripts/guides.js", "guides/files/javascripts/highlighters.js", "guides/files/stylesheets", "guides/files/stylesheets/main.css", "guides/files/stylesheets/print.css", "guides/files/stylesheets/reset.css", "guides/files/stylesheets/style.css", "guides/files/stylesheets/syntax.css", "guides/images", "guides/images/belongs_to.png", "guides/images/book_icon.gif", "guides/images/bullet.gif", "guides/images/chapters_icon.gif", "guides/images/check_bullet.gif", "guides/images/credits_pic_blank.gif", "guides/images/csrf.png", "guides/images/customized_error_messages.png", "guides/images/error_messages.png", "guides/images/feature_tile.gif", "guides/images/footer_tile.gif", "guides/images/fxn.png", "guides/images/grey_bullet.gif", "guides/images/habtm.png", "guides/images/has_many.png", "guides/images/has_many_through.png", "guides/images/has_one.png", "guides/images/has_one_through.png", "guides/images/header_backdrop.png", "guides/images/header_tile.gif", "guides/images/i18n", "guides/images/i18n/demo_localized_pirate.png", "guides/images/i18n/demo_translated_en.png", "guides/images/i18n/demo_translated_pirate.png", "guides/images/i18n/demo_translation_missing.png", "guides/images/i18n/demo_untranslated.png", "guides/images/icons", "guides/images/icons/callouts", "guides/images/icons/callouts/1.png", "guides/images/icons/callouts/10.png", "guides/images/icons/callouts/11.png", "guides/images/icons/callouts/12.png", "guides/images/icons/callouts/13.png", "guides/images/icons/callouts/14.png", "guides/images/icons/callouts/15.png", "guides/images/icons/callouts/2.png", "guides/images/icons/callouts/3.png", "guides/images/icons/callouts/4.png", "guides/images/icons/callouts/5.png", "guides/images/icons/callouts/6.png", "guides/images/icons/callouts/7.png", "guides/images/icons/callouts/8.png", "guides/images/icons/callouts/9.png", "guides/images/icons/caution.png", "guides/images/icons/example.png", "guides/images/icons/home.png", "guides/images/icons/important.png", "guides/images/icons/next.png", "guides/images/icons/note.png", "guides/images/icons/prev.png", "guides/images/icons/README", "guides/images/icons/tip.png", "guides/images/icons/up.png", "guides/images/icons/warning.png", "guides/images/nav_arrow.gif", "guides/images/polymorphic.png", "guides/images/posts_index.png", "guides/images/rails_guides_logo.gif", "guides/images/rails_logo_remix.gif", "guides/images/rails_welcome.png", "guides/images/session_fixation.png", "guides/images/tab_grey.gif", "guides/images/tab_info.gif", "guides/images/tab_note.gif", "guides/images/tab_red.gif", "guides/images/tab_yellow.gif", "guides/images/tab_yellow.png", "guides/images/validation_error_messages.png", "guides/rails_guides", "guides/rails_guides/generator.rb", "guides/rails_guides/helpers.rb", "guides/rails_guides/indexer.rb", "guides/rails_guides/levenshtein.rb", "guides/rails_guides/textile_extensions.rb", "guides/rails_guides.rb", "guides/source", "guides/source/2_2_release_notes.textile", "guides/source/2_3_release_notes.textile", "guides/source/action_controller_overview.textile", "guides/source/action_mailer_basics.textile", "guides/source/action_view_overview.textile", "guides/source/active_record_basics.textile", "guides/source/active_record_querying.textile", "guides/source/active_support_overview.textile", "guides/source/activerecord_validations_callbacks.textile", "guides/source/ajax_on_rails.textile", "guides/source/association_basics.textile", "guides/source/caching_with_rails.textile", "guides/source/command_line.textile", "guides/source/configuring.textile", "guides/source/contribute.textile", "guides/source/contributing_to_rails.textile", "guides/source/credits.erb.textile", "guides/source/debugging_rails_applications.textile", "guides/source/form_helpers.textile", "guides/source/getting_started.textile", "guides/source/i18n.textile", "guides/source/index.erb.textile", "guides/source/layout.html.erb", "guides/source/layouts_and_rendering.textile", "guides/source/migrations.textile", "guides/source/nested_model_forms.textile", "guides/source/performance_testing.textile", "guides/source/plugins.textile", "guides/source/rails_application_templates.textile", "guides/source/rails_on_rack.textile", "guides/source/routing.textile", "guides/source/security.textile", "guides/source/testing.textile", "lib/code_statistics.rb", "lib/commands", "lib/commands/about.rb", "lib/commands/console.rb", "lib/commands/dbconsole.rb", "lib/commands/destroy.rb", "lib/commands/generate.rb", "lib/commands/ncgi", "lib/commands/ncgi/listener", "lib/commands/ncgi/tracker", "lib/commands/performance", "lib/commands/performance/benchmarker.rb", "lib/commands/performance/profiler.rb", "lib/commands/plugin.rb", "lib/commands/runner.rb", "lib/commands/server.rb", "lib/commands/update.rb", "lib/commands.rb", "lib/console_app.rb", "lib/console_sandbox.rb", "lib/console_with_helpers.rb", "lib/dispatcher.rb", "lib/fcgi_handler.rb", "lib/generators", "lib/generators/actions.rb", "lib/generators/active_model.rb", "lib/generators/active_record", "lib/generators/active_record/migration", "lib/generators/active_record/migration/migration_generator.rb", "lib/generators/active_record/migration/templates", "lib/generators/active_record/migration/templates/migration.rb", "lib/generators/active_record/model", "lib/generators/active_record/model/model_generator.rb", "lib/generators/active_record/model/templates", "lib/generators/active_record/model/templates/migration.rb", "lib/generators/active_record/model/templates/model.rb", "lib/generators/active_record/observer", "lib/generators/active_record/observer/observer_generator.rb", "lib/generators/active_record/observer/templates", "lib/generators/active_record/observer/templates/observer.rb", "lib/generators/active_record/session_migration", "lib/generators/active_record/session_migration/session_migration_generator.rb", "lib/generators/active_record/session_migration/templates", "lib/generators/active_record/session_migration/templates/migration.rb", "lib/generators/active_record.rb", "lib/generators/base.rb", "lib/generators/erb", "lib/generators/erb/controller", "lib/generators/erb/controller/controller_generator.rb", "lib/generators/erb/controller/templates", "lib/generators/erb/controller/templates/view.html.erb", "lib/generators/erb/mailer", "lib/generators/erb/mailer/mailer_generator.rb", "lib/generators/erb/mailer/templates", "lib/generators/erb/mailer/templates/view.erb", "lib/generators/erb/scaffold", "lib/generators/erb/scaffold/scaffold_generator.rb", "lib/generators/erb/scaffold/templates", "lib/generators/erb/scaffold/templates/_form.html.erb", "lib/generators/erb/scaffold/templates/edit.html.erb", "lib/generators/erb/scaffold/templates/index.html.erb", "lib/generators/erb/scaffold/templates/layout.html.erb", "lib/generators/erb/scaffold/templates/new.html.erb", "lib/generators/erb/scaffold/templates/show.html.erb", "lib/generators/erb.rb", "lib/generators/generated_attribute.rb", "lib/generators/migration.rb", "lib/generators/named_base.rb", "lib/generators/rails", "lib/generators/rails/app", "lib/generators/rails/app/app_generator.rb", "lib/generators/rails/app/templates", "lib/generators/rails/app/templates/app", "lib/generators/rails/app/templates/app/controllers", "lib/generators/rails/app/templates/app/controllers/application_controller.rb", "lib/generators/rails/app/templates/app/helpers", "lib/generators/rails/app/templates/app/helpers/application_helper.rb", "lib/generators/rails/app/templates/app/models", "lib/generators/rails/app/templates/app/views", "lib/generators/rails/app/templates/app/views/layouts", "lib/generators/rails/app/templates/config", "lib/generators/rails/app/templates/config/boot.rb", "lib/generators/rails/app/templates/config/databases", "lib/generators/rails/app/templates/config/databases/frontbase.yml", "lib/generators/rails/app/templates/config/databases/ibm_db.yml", "lib/generators/rails/app/templates/config/databases/mysql.yml", "lib/generators/rails/app/templates/config/databases/oracle.yml", "lib/generators/rails/app/templates/config/databases/postgresql.yml", "lib/generators/rails/app/templates/config/databases/sqlite3.yml", "lib/generators/rails/app/templates/config/environment.rb", "lib/generators/rails/app/templates/config/environments", "lib/generators/rails/app/templates/config/environments/development.rb", "lib/generators/rails/app/templates/config/environments/production.rb", "lib/generators/rails/app/templates/config/environments/test.rb", "lib/generators/rails/app/templates/config/initializers", "lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb", "lib/generators/rails/app/templates/config/initializers/inflections.rb", "lib/generators/rails/app/templates/config/initializers/mime_types.rb", "lib/generators/rails/app/templates/config/initializers/new_rails_defaults.rb", "lib/generators/rails/app/templates/config/initializers/session_store.rb.tt", "lib/generators/rails/app/templates/config/locales", "lib/generators/rails/app/templates/config/locales/en.yml", "lib/generators/rails/app/templates/config/routes.rb", "lib/generators/rails/app/templates/db", "lib/generators/rails/app/templates/db/seeds.rb", "lib/generators/rails/app/templates/dispatchers", "lib/generators/rails/app/templates/dispatchers/config.ru", "lib/generators/rails/app/templates/dispatchers/dispatch.fcgi", "lib/generators/rails/app/templates/dispatchers/dispatch.rb", "lib/generators/rails/app/templates/dispatchers/gateway.cgi", "lib/generators/rails/app/templates/doc", "lib/generators/rails/app/templates/doc/README_FOR_APP", "lib/generators/rails/app/templates/public", "lib/generators/rails/app/templates/public/404.html", "lib/generators/rails/app/templates/public/422.html", "lib/generators/rails/app/templates/public/500.html", "lib/generators/rails/app/templates/public/favicon.ico", "lib/generators/rails/app/templates/public/images", "lib/generators/rails/app/templates/public/images/rails.png", "lib/generators/rails/app/templates/public/index.html", "lib/generators/rails/app/templates/public/javascripts", "lib/generators/rails/app/templates/public/javascripts/application.js", "lib/generators/rails/app/templates/public/javascripts/controls.js", "lib/generators/rails/app/templates/public/javascripts/dragdrop.js", "lib/generators/rails/app/templates/public/javascripts/effects.js", "lib/generators/rails/app/templates/public/javascripts/prototype.js", "lib/generators/rails/app/templates/public/robots.txt", "lib/generators/rails/app/templates/public/stylesheets", "lib/generators/rails/app/templates/Rakefile", "lib/generators/rails/app/templates/README", "lib/generators/rails/app/templates/script", "lib/generators/rails/app/templates/script/about.tt", "lib/generators/rails/app/templates/script/console.tt", "lib/generators/rails/app/templates/script/dbconsole.tt", "lib/generators/rails/app/templates/script/destroy.tt", "lib/generators/rails/app/templates/script/generate.tt", "lib/generators/rails/app/templates/script/performance", "lib/generators/rails/app/templates/script/performance/benchmarker.tt", "lib/generators/rails/app/templates/script/performance/profiler.tt", "lib/generators/rails/app/templates/script/plugin.tt", "lib/generators/rails/app/templates/script/runner.tt", "lib/generators/rails/app/templates/script/server.tt", "lib/generators/rails/app/templates/test", "lib/generators/rails/app/templates/test/fixtures", "lib/generators/rails/app/templates/test/functional", "lib/generators/rails/app/templates/test/integration", "lib/generators/rails/app/templates/test/performance", "lib/generators/rails/app/templates/test/performance/browsing_test.rb", "lib/generators/rails/app/templates/test/test_helper.rb", "lib/generators/rails/app/templates/test/unit", "lib/generators/rails/app/USAGE", "lib/generators/rails/controller", "lib/generators/rails/controller/controller_generator.rb", "lib/generators/rails/controller/templates", "lib/generators/rails/controller/templates/controller.rb", "lib/generators/rails/controller/USAGE", "lib/generators/rails/generator", "lib/generators/rails/generator/generator_generator.rb", "lib/generators/rails/generator/templates", "lib/generators/rails/generator/templates/%file_name%_generator.rb.tt", "lib/generators/rails/generator/templates/templates", "lib/generators/rails/generator/templates/USAGE.tt", "lib/generators/rails/generator/USAGE", "lib/generators/rails/helper", "lib/generators/rails/helper/helper_generator.rb", "lib/generators/rails/helper/templates", "lib/generators/rails/helper/templates/helper.rb", "lib/generators/rails/helper/USAGE", "lib/generators/rails/integration_test", "lib/generators/rails/integration_test/integration_test_generator.rb", "lib/generators/rails/integration_test/USAGE", "lib/generators/rails/mailer", "lib/generators/rails/mailer/mailer_generator.rb", "lib/generators/rails/mailer/templates", "lib/generators/rails/mailer/templates/mailer.rb", "lib/generators/rails/mailer/USAGE", "lib/generators/rails/metal", "lib/generators/rails/metal/metal_generator.rb", "lib/generators/rails/metal/templates", "lib/generators/rails/metal/templates/metal.rb", "lib/generators/rails/metal/USAGE", "lib/generators/rails/migration", "lib/generators/rails/migration/migration_generator.rb", "lib/generators/rails/migration/USAGE", "lib/generators/rails/model", "lib/generators/rails/model/model_generator.rb", "lib/generators/rails/model/USAGE", "lib/generators/rails/model_subclass", "lib/generators/rails/model_subclass/model_subclass_generator.rb", "lib/generators/rails/observer", "lib/generators/rails/observer/observer_generator.rb", "lib/generators/rails/observer/USAGE", "lib/generators/rails/performance_test", "lib/generators/rails/performance_test/performance_test_generator.rb", "lib/generators/rails/performance_test/USAGE", "lib/generators/rails/plugin", "lib/generators/rails/plugin/plugin_generator.rb", "lib/generators/rails/plugin/templates", "lib/generators/rails/plugin/templates/init.rb", "lib/generators/rails/plugin/templates/install.rb", "lib/generators/rails/plugin/templates/lib", "lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt", "lib/generators/rails/plugin/templates/MIT-LICENSE", "lib/generators/rails/plugin/templates/Rakefile", "lib/generators/rails/plugin/templates/README", "lib/generators/rails/plugin/templates/tasks", "lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt", "lib/generators/rails/plugin/templates/uninstall.rb", "lib/generators/rails/plugin/USAGE", "lib/generators/rails/resource", "lib/generators/rails/resource/resource_generator.rb", "lib/generators/rails/resource/USAGE", "lib/generators/rails/scaffold", "lib/generators/rails/scaffold/scaffold_generator.rb", "lib/generators/rails/scaffold/USAGE", "lib/generators/rails/scaffold_controller", "lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb", "lib/generators/rails/scaffold_controller/templates", "lib/generators/rails/scaffold_controller/templates/controller.rb", "lib/generators/rails/scaffold_controller/USAGE", "lib/generators/rails/session_migration", "lib/generators/rails/session_migration/session_migration_generator.rb", "lib/generators/rails/session_migration/USAGE", "lib/generators/rails/stylesheets", "lib/generators/rails/stylesheets/stylesheets_generator.rb", "lib/generators/rails/stylesheets/templates", "lib/generators/rails/stylesheets/templates/scaffold.css", "lib/generators/rails/stylesheets/USAGE", "lib/generators/resource_helpers.rb", "lib/generators/test_unit", "lib/generators/test_unit/controller", "lib/generators/test_unit/controller/controller_generator.rb", "lib/generators/test_unit/controller/templates", "lib/generators/test_unit/controller/templates/functional_test.rb", "lib/generators/test_unit/helper", "lib/generators/test_unit/helper/helper_generator.rb", "lib/generators/test_unit/helper/templates", "lib/generators/test_unit/helper/templates/helper_test.rb", "lib/generators/test_unit/integration", "lib/generators/test_unit/integration/integration_generator.rb", "lib/generators/test_unit/integration/templates", "lib/generators/test_unit/integration/templates/integration_test.rb", "lib/generators/test_unit/mailer", "lib/generators/test_unit/mailer/mailer_generator.rb", "lib/generators/test_unit/mailer/templates", "lib/generators/test_unit/mailer/templates/fixture", "lib/generators/test_unit/mailer/templates/unit_test.rb", "lib/generators/test_unit/model", "lib/generators/test_unit/model/model_generator.rb", "lib/generators/test_unit/model/templates", "lib/generators/test_unit/model/templates/fixtures.yml", "lib/generators/test_unit/model/templates/unit_test.rb", "lib/generators/test_unit/observer", "lib/generators/test_unit/observer/observer_generator.rb", "lib/generators/test_unit/observer/templates", "lib/generators/test_unit/observer/templates/unit_test.rb", "lib/generators/test_unit/performance", "lib/generators/test_unit/performance/performance_generator.rb", "lib/generators/test_unit/performance/templates", "lib/generators/test_unit/performance/templates/performance_test.rb", "lib/generators/test_unit/plugin", "lib/generators/test_unit/plugin/plugin_generator.rb", "lib/generators/test_unit/plugin/templates", "lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt", "lib/generators/test_unit/plugin/templates/test_helper.rb", "lib/generators/test_unit/scaffold", "lib/generators/test_unit/scaffold/scaffold_generator.rb", "lib/generators/test_unit/scaffold/templates", "lib/generators/test_unit/scaffold/templates/functional_test.rb", "lib/generators/test_unit.rb", "lib/generators.rb", "lib/initializer.rb", "lib/initializer_old.rb", "lib/performance_test_help.rb", "lib/rails", "lib/rails/backtrace_cleaner.rb", "lib/rails/configuration.rb", "lib/rails/core.rb", "lib/rails/gem_builder.rb", "lib/rails/gem_dependency.rb", "lib/rails/paths.rb", "lib/rails/plugin", "lib/rails/plugin/loader.rb", "lib/rails/plugin/locator.rb", "lib/rails/plugin.rb", "lib/rails/rack", "lib/rails/rack/debugger.rb", "lib/rails/rack/log_tailer.rb", "lib/rails/rack/metal.rb", "lib/rails/rack/static.rb", "lib/rails/rack.rb", "lib/rails/vendor_gem_source_index.rb", "lib/rails/version.rb", "lib/railties_path.rb", "lib/ruby_version_check.rb", "lib/rubyprof_ext.rb", "lib/source_annotation_extractor.rb", "lib/tasks", "lib/tasks/annotations.rake", "lib/tasks/databases.rake", "lib/tasks/documentation.rake", "lib/tasks/framework.rake", "lib/tasks/gems.rake", "lib/tasks/log.rake", "lib/tasks/middleware.rake", "lib/tasks/misc.rake", "lib/tasks/rails.rb", "lib/tasks/routes.rake", "lib/tasks/statistics.rake", "lib/tasks/testing.rake", "lib/tasks/tmp.rake", "lib/test_help.rb", "lib/vendor", "lib/vendor/bundler", "lib/vendor/bundler/bin", "lib/vendor/bundler/bin/gem_bundler", "lib/vendor/bundler/lib", "lib/vendor/bundler/lib/bundler", "lib/vendor/bundler/lib/bundler/cli.rb", "lib/vendor/bundler/lib/bundler/dependency.rb", "lib/vendor/bundler/lib/bundler/finder.rb", "lib/vendor/bundler/lib/bundler/gem_bundle.rb", "lib/vendor/bundler/lib/bundler/gem_specification.rb", "lib/vendor/bundler/lib/bundler/installer.rb", "lib/vendor/bundler/lib/bundler/manifest.rb", "lib/vendor/bundler/lib/bundler/resolver", "lib/vendor/bundler/lib/bundler/resolver/builders.rb", "lib/vendor/bundler/lib/bundler/resolver/engine.rb", "lib/vendor/bundler/lib/bundler/resolver/inspect.rb", "lib/vendor/bundler/lib/bundler/resolver/search.rb", "lib/vendor/bundler/lib/bundler/resolver/stack.rb", "lib/vendor/bundler/lib/bundler/resolver/state.rb", "lib/vendor/bundler/lib/bundler/resolver.rb", "lib/vendor/bundler/lib/bundler/runtime.rb", "lib/vendor/bundler/lib/bundler.rb", "lib/vendor/bundler/LICENSE", "lib/vendor/bundler/Rakefile", "lib/vendor/thor-0.11.6", "lib/vendor/thor-0.11.6/bin", "lib/vendor/thor-0.11.6/bin/rake2thor", "lib/vendor/thor-0.11.6/bin/thor", "lib/vendor/thor-0.11.6/CHANGELOG.rdoc", "lib/vendor/thor-0.11.6/lib", "lib/vendor/thor-0.11.6/lib/thor", "lib/vendor/thor-0.11.6/lib/thor/actions", "lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions.rb", "lib/vendor/thor-0.11.6/lib/thor/base.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext", "lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb", "lib/vendor/thor-0.11.6/lib/thor/error.rb", "lib/vendor/thor-0.11.6/lib/thor/group.rb", "lib/vendor/thor-0.11.6/lib/thor/invocation.rb", "lib/vendor/thor-0.11.6/lib/thor/parser", "lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/option.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/options.rb", "lib/vendor/thor-0.11.6/lib/thor/parser.rb", "lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb", "lib/vendor/thor-0.11.6/lib/thor/runner.rb", "lib/vendor/thor-0.11.6/lib/thor/shell", "lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb", "lib/vendor/thor-0.11.6/lib/thor/shell/color.rb", "lib/vendor/thor-0.11.6/lib/thor/shell.rb", "lib/vendor/thor-0.11.6/lib/thor/task.rb", "lib/vendor/thor-0.11.6/lib/thor/util.rb", "lib/vendor/thor-0.11.6/lib/thor.rb", "lib/vendor/thor-0.11.6/LICENSE", "lib/vendor/thor-0.11.6/README.rdoc", "lib/webrick_server.rb"] + s.files = ["bin", "builtin", "CHANGELOG", "guides", "lib", "MIT-LICENSE", "pkg", "rails.gemspec", "Rakefile", "README", "bin/rails", "builtin/rails_info", "builtin/rails_info/rails", "builtin/rails_info/rails/info.rb", "builtin/rails_info/rails/info_controller.rb", "builtin/rails_info/rails/info_helper.rb", "builtin/rails_info/rails_info_controller.rb", "guides/files", "guides/files/javascripts", "guides/files/javascripts/code_highlighter.js", "guides/files/javascripts/guides.js", "guides/files/javascripts/highlighters.js", "guides/files/stylesheets", "guides/files/stylesheets/main.css", "guides/files/stylesheets/print.css", "guides/files/stylesheets/reset.css", "guides/files/stylesheets/style.css", "guides/files/stylesheets/syntax.css", "guides/images", "guides/images/belongs_to.png", "guides/images/book_icon.gif", "guides/images/bullet.gif", "guides/images/chapters_icon.gif", "guides/images/check_bullet.gif", "guides/images/credits_pic_blank.gif", "guides/images/csrf.png", "guides/images/customized_error_messages.png", "guides/images/error_messages.png", "guides/images/feature_tile.gif", "guides/images/footer_tile.gif", "guides/images/fxn.png", "guides/images/grey_bullet.gif", "guides/images/habtm.png", "guides/images/has_many.png", "guides/images/has_many_through.png", "guides/images/has_one.png", "guides/images/has_one_through.png", "guides/images/header_backdrop.png", "guides/images/header_tile.gif", "guides/images/i18n", "guides/images/i18n/demo_localized_pirate.png", "guides/images/i18n/demo_translated_en.png", "guides/images/i18n/demo_translated_pirate.png", "guides/images/i18n/demo_translation_missing.png", "guides/images/i18n/demo_untranslated.png", "guides/images/icons", "guides/images/icons/callouts", "guides/images/icons/callouts/1.png", "guides/images/icons/callouts/10.png", "guides/images/icons/callouts/11.png", "guides/images/icons/callouts/12.png", "guides/images/icons/callouts/13.png", "guides/images/icons/callouts/14.png", "guides/images/icons/callouts/15.png", "guides/images/icons/callouts/2.png", "guides/images/icons/callouts/3.png", "guides/images/icons/callouts/4.png", "guides/images/icons/callouts/5.png", "guides/images/icons/callouts/6.png", "guides/images/icons/callouts/7.png", "guides/images/icons/callouts/8.png", "guides/images/icons/callouts/9.png", "guides/images/icons/caution.png", "guides/images/icons/example.png", "guides/images/icons/home.png", "guides/images/icons/important.png", "guides/images/icons/next.png", "guides/images/icons/note.png", "guides/images/icons/prev.png", "guides/images/icons/README", "guides/images/icons/tip.png", "guides/images/icons/up.png", "guides/images/icons/warning.png", "guides/images/nav_arrow.gif", "guides/images/polymorphic.png", "guides/images/posts_index.png", "guides/images/rails_guides_logo.gif", "guides/images/rails_logo_remix.gif", "guides/images/rails_welcome.png", "guides/images/session_fixation.png", "guides/images/tab_grey.gif", "guides/images/tab_info.gif", "guides/images/tab_note.gif", "guides/images/tab_red.gif", "guides/images/tab_yellow.gif", "guides/images/tab_yellow.png", "guides/images/validation_error_messages.png", "guides/rails_guides", "guides/rails_guides/generator.rb", "guides/rails_guides/helpers.rb", "guides/rails_guides/indexer.rb", "guides/rails_guides/levenshtein.rb", "guides/rails_guides/textile_extensions.rb", "guides/rails_guides.rb", "guides/source", "guides/source/2_2_release_notes.textile", "guides/source/2_3_release_notes.textile", "guides/source/action_controller_overview.textile", "guides/source/action_mailer_basics.textile", "guides/source/action_view_overview.textile", "guides/source/active_record_basics.textile", "guides/source/active_record_querying.textile", "guides/source/active_support_overview.textile", "guides/source/activerecord_validations_callbacks.textile", "guides/source/ajax_on_rails.textile", "guides/source/association_basics.textile", "guides/source/caching_with_rails.textile", "guides/source/command_line.textile", "guides/source/configuring.textile", "guides/source/contribute.textile", "guides/source/contributing_to_rails.textile", "guides/source/credits.erb.textile", "guides/source/debugging_rails_applications.textile", "guides/source/form_helpers.textile", "guides/source/getting_started.textile", "guides/source/i18n.textile", "guides/source/index.erb.textile", "guides/source/layout.html.erb", "guides/source/layouts_and_rendering.textile", "guides/source/migrations.textile", "guides/source/nested_model_forms.textile", "guides/source/performance_testing.textile", "guides/source/plugins.textile", "guides/source/rails_application_templates.textile", "guides/source/rails_on_rack.textile", "guides/source/routing.textile", "guides/source/security.textile", "guides/source/testing.textile", "lib/code_statistics.rb", "lib/commands", "lib/commands/about.rb", "lib/commands/console.rb", "lib/commands/dbconsole.rb", "lib/commands/destroy.rb", "lib/commands/generate.rb", "lib/commands/ncgi", "lib/commands/ncgi/listener", "lib/commands/ncgi/tracker", "lib/commands/performance", "lib/commands/performance/benchmarker.rb", "lib/commands/performance/profiler.rb", "lib/commands/plugin.rb", "lib/commands/runner.rb", "lib/commands/server.rb", "lib/commands/update.rb", "lib/commands.rb", "lib/console_app.rb", "lib/console_sandbox.rb", "lib/console_with_helpers.rb", "lib/dispatcher.rb", "lib/fcgi_handler.rb", "lib/generators", "lib/generators/actions.rb", "lib/generators/active_model.rb", "lib/generators/active_record", "lib/generators/active_record/migration", "lib/generators/active_record/migration/migration_generator.rb", "lib/generators/active_record/migration/templates", "lib/generators/active_record/migration/templates/migration.rb", "lib/generators/active_record/model", "lib/generators/active_record/model/model_generator.rb", "lib/generators/active_record/model/templates", "lib/generators/active_record/model/templates/migration.rb", "lib/generators/active_record/model/templates/model.rb", "lib/generators/active_record/observer", "lib/generators/active_record/observer/observer_generator.rb", "lib/generators/active_record/observer/templates", "lib/generators/active_record/observer/templates/observer.rb", "lib/generators/active_record/session_migration", "lib/generators/active_record/session_migration/session_migration_generator.rb", "lib/generators/active_record/session_migration/templates", "lib/generators/active_record/session_migration/templates/migration.rb", "lib/generators/active_record.rb", "lib/generators/base.rb", "lib/generators/erb", "lib/generators/erb/controller", "lib/generators/erb/controller/controller_generator.rb", "lib/generators/erb/controller/templates", "lib/generators/erb/controller/templates/view.html.erb", "lib/generators/erb/mailer", "lib/generators/erb/mailer/mailer_generator.rb", "lib/generators/erb/mailer/templates", "lib/generators/erb/mailer/templates/view.erb", "lib/generators/erb/scaffold", "lib/generators/erb/scaffold/scaffold_generator.rb", "lib/generators/erb/scaffold/templates", "lib/generators/erb/scaffold/templates/_form.html.erb", "lib/generators/erb/scaffold/templates/edit.html.erb", "lib/generators/erb/scaffold/templates/index.html.erb", "lib/generators/erb/scaffold/templates/layout.html.erb", "lib/generators/erb/scaffold/templates/new.html.erb", "lib/generators/erb/scaffold/templates/show.html.erb", "lib/generators/erb.rb", "lib/generators/generated_attribute.rb", "lib/generators/migration.rb", "lib/generators/named_base.rb", "lib/generators/rails", "lib/generators/rails/app", "lib/generators/rails/app/app_generator.rb", "lib/generators/rails/app/templates", "lib/generators/rails/app/templates/app", "lib/generators/rails/app/templates/app/controllers", "lib/generators/rails/app/templates/app/controllers/application_controller.rb", "lib/generators/rails/app/templates/app/helpers", "lib/generators/rails/app/templates/app/helpers/application_helper.rb", "lib/generators/rails/app/templates/app/models", "lib/generators/rails/app/templates/app/views", "lib/generators/rails/app/templates/app/views/layouts", "lib/generators/rails/app/templates/config", "lib/generators/rails/app/templates/config/boot.rb", "lib/generators/rails/app/templates/config/databases", "lib/generators/rails/app/templates/config/databases/frontbase.yml", "lib/generators/rails/app/templates/config/databases/ibm_db.yml", "lib/generators/rails/app/templates/config/databases/mysql.yml", "lib/generators/rails/app/templates/config/databases/oracle.yml", "lib/generators/rails/app/templates/config/databases/postgresql.yml", "lib/generators/rails/app/templates/config/databases/sqlite3.yml", "lib/generators/rails/app/templates/config/environment.rb", "lib/generators/rails/app/templates/config/environments", "lib/generators/rails/app/templates/config/environments/development.rb", "lib/generators/rails/app/templates/config/environments/production.rb", "lib/generators/rails/app/templates/config/environments/test.rb", "lib/generators/rails/app/templates/config/initializers", "lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb", "lib/generators/rails/app/templates/config/initializers/inflections.rb", "lib/generators/rails/app/templates/config/initializers/mime_types.rb", "lib/generators/rails/app/templates/config/initializers/new_rails_defaults.rb", "lib/generators/rails/app/templates/config/initializers/session_store.rb.tt", "lib/generators/rails/app/templates/config/locales", "lib/generators/rails/app/templates/config/locales/en.yml", "lib/generators/rails/app/templates/config/routes.rb", "lib/generators/rails/app/templates/db", "lib/generators/rails/app/templates/db/seeds.rb", "lib/generators/rails/app/templates/dispatchers", "lib/generators/rails/app/templates/dispatchers/config.ru", "lib/generators/rails/app/templates/dispatchers/dispatch.fcgi", "lib/generators/rails/app/templates/dispatchers/dispatch.rb", "lib/generators/rails/app/templates/dispatchers/gateway.cgi", "lib/generators/rails/app/templates/doc", "lib/generators/rails/app/templates/doc/README_FOR_APP", "lib/generators/rails/app/templates/public", "lib/generators/rails/app/templates/public/404.html", "lib/generators/rails/app/templates/public/422.html", "lib/generators/rails/app/templates/public/500.html", "lib/generators/rails/app/templates/public/favicon.ico", "lib/generators/rails/app/templates/public/images", "lib/generators/rails/app/templates/public/images/rails.png", "lib/generators/rails/app/templates/public/index.html", "lib/generators/rails/app/templates/public/javascripts", "lib/generators/rails/app/templates/public/javascripts/application.js", "lib/generators/rails/app/templates/public/javascripts/controls.js", "lib/generators/rails/app/templates/public/javascripts/dragdrop.js", "lib/generators/rails/app/templates/public/javascripts/effects.js", "lib/generators/rails/app/templates/public/javascripts/prototype.js", "lib/generators/rails/app/templates/public/robots.txt", "lib/generators/rails/app/templates/public/stylesheets", "lib/generators/rails/app/templates/Rakefile", "lib/generators/rails/app/templates/README", "lib/generators/rails/app/templates/script", "lib/generators/rails/app/templates/script/about.tt", "lib/generators/rails/app/templates/script/console.tt", "lib/generators/rails/app/templates/script/dbconsole.tt", "lib/generators/rails/app/templates/script/destroy.tt", "lib/generators/rails/app/templates/script/generate.tt", "lib/generators/rails/app/templates/script/performance", "lib/generators/rails/app/templates/script/performance/benchmarker.tt", "lib/generators/rails/app/templates/script/performance/profiler.tt", "lib/generators/rails/app/templates/script/plugin.tt", "lib/generators/rails/app/templates/script/runner.tt", "lib/generators/rails/app/templates/script/server.tt", "lib/generators/rails/app/templates/test", "lib/generators/rails/app/templates/test/fixtures", "lib/generators/rails/app/templates/test/functional", "lib/generators/rails/app/templates/test/integration", "lib/generators/rails/app/templates/test/performance", "lib/generators/rails/app/templates/test/performance/browsing_test.rb", "lib/generators/rails/app/templates/test/test_helper.rb", "lib/generators/rails/app/templates/test/unit", "lib/generators/rails/app/USAGE", "lib/generators/rails/controller", "lib/generators/rails/controller/controller_generator.rb", "lib/generators/rails/controller/templates", "lib/generators/rails/controller/templates/controller.rb", "lib/generators/rails/controller/USAGE", "lib/generators/rails/generator", "lib/generators/rails/generator/generator_generator.rb", "lib/generators/rails/generator/templates", "lib/generators/rails/generator/templates/%file_name%_generator.rb.tt", "lib/generators/rails/generator/templates/templates", "lib/generators/rails/generator/templates/USAGE.tt", "lib/generators/rails/generator/USAGE", "lib/generators/rails/helper", "lib/generators/rails/helper/helper_generator.rb", "lib/generators/rails/helper/templates", "lib/generators/rails/helper/templates/helper.rb", "lib/generators/rails/helper/USAGE", "lib/generators/rails/integration_test", "lib/generators/rails/integration_test/integration_test_generator.rb", "lib/generators/rails/integration_test/USAGE", "lib/generators/rails/mailer", "lib/generators/rails/mailer/mailer_generator.rb", "lib/generators/rails/mailer/templates", "lib/generators/rails/mailer/templates/mailer.rb", "lib/generators/rails/mailer/USAGE", "lib/generators/rails/metal", "lib/generators/rails/metal/metal_generator.rb", "lib/generators/rails/metal/templates", "lib/generators/rails/metal/templates/metal.rb", "lib/generators/rails/metal/USAGE", "lib/generators/rails/migration", "lib/generators/rails/migration/migration_generator.rb", "lib/generators/rails/migration/USAGE", "lib/generators/rails/model", "lib/generators/rails/model/model_generator.rb", "lib/generators/rails/model/USAGE", "lib/generators/rails/model_subclass", "lib/generators/rails/model_subclass/model_subclass_generator.rb", "lib/generators/rails/observer", "lib/generators/rails/observer/observer_generator.rb", "lib/generators/rails/observer/USAGE", "lib/generators/rails/performance_test", "lib/generators/rails/performance_test/performance_test_generator.rb", "lib/generators/rails/performance_test/USAGE", "lib/generators/rails/plugin", "lib/generators/rails/plugin/plugin_generator.rb", "lib/generators/rails/plugin/templates", "lib/generators/rails/plugin/templates/init.rb", "lib/generators/rails/plugin/templates/install.rb", "lib/generators/rails/plugin/templates/lib", "lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt", "lib/generators/rails/plugin/templates/MIT-LICENSE", "lib/generators/rails/plugin/templates/Rakefile", "lib/generators/rails/plugin/templates/README", "lib/generators/rails/plugin/templates/tasks", "lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt", "lib/generators/rails/plugin/templates/uninstall.rb", "lib/generators/rails/plugin/USAGE", "lib/generators/rails/resource", "lib/generators/rails/resource/resource_generator.rb", "lib/generators/rails/resource/USAGE", "lib/generators/rails/scaffold", "lib/generators/rails/scaffold/scaffold_generator.rb", "lib/generators/rails/scaffold/USAGE", "lib/generators/rails/scaffold_controller", "lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb", "lib/generators/rails/scaffold_controller/templates", "lib/generators/rails/scaffold_controller/templates/controller.rb", "lib/generators/rails/scaffold_controller/USAGE", "lib/generators/rails/session_migration", "lib/generators/rails/session_migration/session_migration_generator.rb", "lib/generators/rails/session_migration/USAGE", "lib/generators/rails/stylesheets", "lib/generators/rails/stylesheets/stylesheets_generator.rb", "lib/generators/rails/stylesheets/templates", "lib/generators/rails/stylesheets/templates/scaffold.css", "lib/generators/rails/stylesheets/USAGE", "lib/generators/resource_helpers.rb", "lib/generators/test_unit", "lib/generators/test_unit/controller", "lib/generators/test_unit/controller/controller_generator.rb", "lib/generators/test_unit/controller/templates", "lib/generators/test_unit/controller/templates/functional_test.rb", "lib/generators/test_unit/helper", "lib/generators/test_unit/helper/helper_generator.rb", "lib/generators/test_unit/helper/templates", "lib/generators/test_unit/helper/templates/helper_test.rb", "lib/generators/test_unit/integration", "lib/generators/test_unit/integration/integration_generator.rb", "lib/generators/test_unit/integration/templates", "lib/generators/test_unit/integration/templates/integration_test.rb", "lib/generators/test_unit/mailer", "lib/generators/test_unit/mailer/mailer_generator.rb", "lib/generators/test_unit/mailer/templates", "lib/generators/test_unit/mailer/templates/fixture", "lib/generators/test_unit/mailer/templates/unit_test.rb", "lib/generators/test_unit/model", "lib/generators/test_unit/model/model_generator.rb", "lib/generators/test_unit/model/templates", "lib/generators/test_unit/model/templates/fixtures.yml", "lib/generators/test_unit/model/templates/unit_test.rb", "lib/generators/test_unit/observer", "lib/generators/test_unit/observer/observer_generator.rb", "lib/generators/test_unit/observer/templates", "lib/generators/test_unit/observer/templates/unit_test.rb", "lib/generators/test_unit/performance", "lib/generators/test_unit/performance/performance_generator.rb", "lib/generators/test_unit/performance/templates", "lib/generators/test_unit/performance/templates/performance_test.rb", "lib/generators/test_unit/plugin", "lib/generators/test_unit/plugin/plugin_generator.rb", "lib/generators/test_unit/plugin/templates", "lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt", "lib/generators/test_unit/plugin/templates/test_helper.rb", "lib/generators/test_unit/scaffold", "lib/generators/test_unit/scaffold/scaffold_generator.rb", "lib/generators/test_unit/scaffold/templates", "lib/generators/test_unit/scaffold/templates/functional_test.rb", "lib/generators/test_unit.rb", "lib/generators.rb", "lib/initializer.rb", "lib/initializer_old.rb", "lib/performance_test_help.rb", "lib/rails", "lib/rails/backtrace_cleaner.rb", "lib/rails/configuration.rb", "lib/rails/core.rb", "lib/rails/gem_builder.rb", "lib/rails/gem_dependency.rb", "lib/rails/paths.rb", "lib/rails/plugin", "lib/rails/plugin/loader.rb", "lib/rails/plugin/locator.rb", "lib/rails/plugin.rb", "lib/rails/rack", "lib/rails/rack/debugger.rb", "lib/rails/rack/log_tailer.rb", "lib/rails/rack/metal.rb", "lib/rails/rack/static.rb", "lib/rails/rack.rb", "lib/rails/vendor_gem_source_index.rb", "lib/rails/version.rb", "lib/railties_path.rb", "lib/ruby_version_check.rb", "lib/rubyprof_ext.rb", "lib/source_annotation_extractor.rb", "lib/tasks", "lib/tasks/annotations.rake", "lib/tasks/databases.rake", "lib/tasks/documentation.rake", "lib/tasks/framework.rake", "lib/tasks/gems.rake", "lib/tasks/log.rake", "lib/tasks/middleware.rake", "lib/tasks/misc.rake", "lib/tasks/rails.rb", "lib/tasks/routes.rake", "lib/tasks/statistics.rake", "lib/tasks/testing.rake", "lib/tasks/tmp.rake", "lib/test_help.rb", "lib/vendor", "lib/vendor/bundler", "lib/vendor/bundler/bin", "lib/vendor/bundler/bin/gem_bundler", "lib/vendor/bundler/lib", "lib/vendor/bundler/lib/bundler", "lib/vendor/bundler/lib/bundler/cli.rb", "lib/vendor/bundler/lib/bundler/dependency.rb", "lib/vendor/bundler/lib/bundler/finder.rb", "lib/vendor/bundler/lib/bundler/gem_bundle.rb", "lib/vendor/bundler/lib/bundler/gem_specification.rb", "lib/vendor/bundler/lib/bundler/installer.rb", "lib/vendor/bundler/lib/bundler/manifest.rb", "lib/vendor/bundler/lib/bundler/resolver", "lib/vendor/bundler/lib/bundler/resolver/builders.rb", "lib/vendor/bundler/lib/bundler/resolver/engine.rb", "lib/vendor/bundler/lib/bundler/resolver/inspect.rb", "lib/vendor/bundler/lib/bundler/resolver/search.rb", "lib/vendor/bundler/lib/bundler/resolver/stack.rb", "lib/vendor/bundler/lib/bundler/resolver/state.rb", "lib/vendor/bundler/lib/bundler/resolver.rb", "lib/vendor/bundler/lib/bundler/runtime.rb", "lib/vendor/bundler/lib/bundler.rb", "lib/vendor/bundler/LICENSE", "lib/vendor/bundler/Rakefile", "lib/vendor/thor-0.11.5", "lib/vendor/thor-0.11.5/lib", "lib/vendor/thor-0.11.6", "lib/vendor/thor-0.11.6/bin", "lib/vendor/thor-0.11.6/bin/rake2thor", "lib/vendor/thor-0.11.6/bin/thor", "lib/vendor/thor-0.11.6/CHANGELOG.rdoc", "lib/vendor/thor-0.11.6/lib", "lib/vendor/thor-0.11.6/lib/thor", "lib/vendor/thor-0.11.6/lib/thor/actions", "lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions.rb", "lib/vendor/thor-0.11.6/lib/thor/base.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext", "lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb", "lib/vendor/thor-0.11.6/lib/thor/error.rb", "lib/vendor/thor-0.11.6/lib/thor/group.rb", "lib/vendor/thor-0.11.6/lib/thor/invocation.rb", "lib/vendor/thor-0.11.6/lib/thor/parser", "lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/option.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/options.rb", "lib/vendor/thor-0.11.6/lib/thor/parser.rb", "lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb", "lib/vendor/thor-0.11.6/lib/thor/runner.rb", "lib/vendor/thor-0.11.6/lib/thor/shell", "lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb", "lib/vendor/thor-0.11.6/lib/thor/shell/color.rb", "lib/vendor/thor-0.11.6/lib/thor/shell.rb", "lib/vendor/thor-0.11.6/lib/thor/task.rb", "lib/vendor/thor-0.11.6/lib/thor/util.rb", "lib/vendor/thor-0.11.6/lib/thor.rb", "lib/vendor/thor-0.11.6/LICENSE", "lib/vendor/thor-0.11.6/README.rdoc", "lib/webrick_server.rb", "lib/generators/rails/app/templates/app/models/.empty_directory", "lib/generators/rails/app/templates/app/views/layouts/.empty_directory", "lib/generators/rails/app/templates/public/stylesheets/.empty_directory", "lib/generators/rails/app/templates/test/fixtures/.empty_directory", "lib/generators/rails/app/templates/test/functional/.empty_directory", "lib/generators/rails/app/templates/test/integration/.empty_directory", "lib/generators/rails/app/templates/test/unit/.empty_directory", "lib/generators/rails/generator/templates/templates/.empty_directory"] s.homepage = %q{http://www.rubyonrails.org} s.rdoc_options = ["--exclude", "."] s.require_paths = ["lib"] |