factorylabs-castronaut 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +67 -0
- data/Rakefile +78 -0
- data/bin/castronaut +75 -0
- data/config/castronaut.example.yml +41 -0
- data/config/castronaut.sample.yml +40 -0
- data/config/castronaut.yml +40 -0
- data/config/nginx_vhost.conf +17 -0
- data/config/thin_config.yml +13 -0
- data/lib/castronaut.rb +50 -0
- data/lib/castronaut/adapters.rb +13 -0
- data/lib/castronaut/adapters/development/adapter.rb +13 -0
- data/lib/castronaut/adapters/development/user.rb +25 -0
- data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
- data/lib/castronaut/adapters/ldap/user.rb +40 -0
- data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
- data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
- data/lib/castronaut/application.rb +1 -0
- data/lib/castronaut/application/application.rb +70 -0
- data/lib/castronaut/application/public/javascripts/application.js +3 -0
- data/lib/castronaut/application/public/javascripts/jquery.js +32 -0
- data/lib/castronaut/application/public/stylesheets/screen.css +122 -0
- data/lib/castronaut/application/views/layout.erb +27 -0
- data/lib/castronaut/application/views/login.erb +31 -0
- data/lib/castronaut/application/views/logout.erb +13 -0
- data/lib/castronaut/application/views/proxy_validate.erb +21 -0
- data/lib/castronaut/application/views/service_validate.erb +14 -0
- data/lib/castronaut/authentication_result.rb +24 -0
- data/lib/castronaut/configuration.rb +110 -0
- data/lib/castronaut/db/001_create_cas_database.rb +47 -0
- data/lib/castronaut/models/consumeable.rb +18 -0
- data/lib/castronaut/models/dispenser.rb +14 -0
- data/lib/castronaut/models/login_ticket.rb +53 -0
- data/lib/castronaut/models/proxy_granting_ticket.rb +70 -0
- data/lib/castronaut/models/proxy_ticket.rb +43 -0
- data/lib/castronaut/models/service_ticket.rb +91 -0
- data/lib/castronaut/models/ticket_granting_ticket.rb +52 -0
- data/lib/castronaut/presenters/login.rb +84 -0
- data/lib/castronaut/presenters/logout.rb +56 -0
- data/lib/castronaut/presenters/process_login.rb +149 -0
- data/lib/castronaut/presenters/proxy_validate.rb +67 -0
- data/lib/castronaut/presenters/service_validate.rb +68 -0
- data/lib/castronaut/support/sample.rb +21 -0
- data/lib/castronaut/ticket_result.rb +27 -0
- data/lib/castronaut/utilities/random_string.rb +24 -0
- data/spec/app/controllers/application_spec.rb +86 -0
- data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/development/user_spec.rb +55 -0
- data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
- data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
- data/spec/castronaut/adapters_spec.rb +13 -0
- data/spec/castronaut/authentication_result_spec.rb +20 -0
- data/spec/castronaut/configuration_spec.rb +172 -0
- data/spec/castronaut/models/consumeable_spec.rb +39 -0
- data/spec/castronaut/models/dispenser_spec.rb +30 -0
- data/spec/castronaut/models/login_ticket_spec.rb +107 -0
- data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
- data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
- data/spec/castronaut/models/service_ticket_spec.rb +269 -0
- data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
- data/spec/castronaut/presenters/login_spec.rb +152 -0
- data/spec/castronaut/presenters/logout_spec.rb +85 -0
- data/spec/castronaut/presenters/process_login_spec.rb +300 -0
- data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
- data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
- data/spec/castronaut/ticket_result_spec.rb +42 -0
- data/spec/castronaut/utilities/random_string_spec.rb +14 -0
- data/spec/castronaut_spec.rb +26 -0
- data/spec/spec_controller_helper.rb +17 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/spec_rails_mocks.rb +132 -0
- data/vendor/activerecord/CHANGELOG +5786 -0
- data/vendor/activerecord/README +351 -0
- data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
- data/vendor/activerecord/Rakefile +247 -0
- data/vendor/activerecord/examples/associations.png +0 -0
- data/vendor/activerecord/install.rb +30 -0
- data/vendor/activerecord/lib/active_record.rb +81 -0
- data/vendor/activerecord/lib/active_record/aggregations.rb +261 -0
- data/vendor/activerecord/lib/active_record/association_preload.rb +374 -0
- data/vendor/activerecord/lib/active_record/associations.rb +2227 -0
- data/vendor/activerecord/lib/active_record/associations/association_collection.rb +453 -0
- data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +272 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
- data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +256 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +115 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +31 -0
- data/vendor/activerecord/lib/active_record/attribute_methods.rb +387 -0
- data/vendor/activerecord/lib/active_record/base.rb +2967 -0
- data/vendor/activerecord/lib/active_record/calculations.rb +299 -0
- data/vendor/activerecord/lib/active_record/callbacks.rb +331 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
- data/vendor/activerecord/lib/active_record/dirty.rb +183 -0
- data/vendor/activerecord/lib/active_record/dynamic_finder_match.rb +41 -0
- data/vendor/activerecord/lib/active_record/fixtures.rb +998 -0
- data/vendor/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
- data/vendor/activerecord/lib/active_record/locale/en.yml +54 -0
- data/vendor/activerecord/lib/active_record/locking/optimistic.rb +148 -0
- data/vendor/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/vendor/activerecord/lib/active_record/migration.rb +560 -0
- data/vendor/activerecord/lib/active_record/named_scope.rb +181 -0
- data/vendor/activerecord/lib/active_record/observer.rb +197 -0
- data/vendor/activerecord/lib/active_record/query_cache.rb +21 -0
- data/vendor/activerecord/lib/active_record/reflection.rb +307 -0
- data/vendor/activerecord/lib/active_record/schema.rb +51 -0
- data/vendor/activerecord/lib/active_record/schema_dumper.rb +177 -0
- data/vendor/activerecord/lib/active_record/serialization.rb +98 -0
- data/vendor/activerecord/lib/active_record/serializers/json_serializer.rb +80 -0
- data/vendor/activerecord/lib/active_record/serializers/xml_serializer.rb +338 -0
- data/vendor/activerecord/lib/active_record/test_case.rb +60 -0
- data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
- data/vendor/activerecord/lib/active_record/transactions.rb +185 -0
- data/vendor/activerecord/lib/active_record/validations.rb +1061 -0
- data/vendor/activerecord/lib/active_record/version.rb +9 -0
- data/vendor/activerecord/lib/activerecord.rb +1 -0
- data/vendor/activerecord/test/assets/example.log +1 -0
- data/vendor/activerecord/test/assets/flowers.jpg +0 -0
- data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
- data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +100 -0
- data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
- data/vendor/activerecord/test/cases/adapter_test.rb +133 -0
- data/vendor/activerecord/test/cases/aggregations_test.rb +167 -0
- data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
- data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +441 -0
- data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
- data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +101 -0
- data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
- data/vendor/activerecord/test/cases/associations/eager_test.rb +692 -0
- data/vendor/activerecord/test/cases/associations/extension_test.rb +62 -0
- data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +773 -0
- data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1101 -0
- data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +247 -0
- data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +362 -0
- data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
- data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
- data/vendor/activerecord/test/cases/associations_test.rb +262 -0
- data/vendor/activerecord/test/cases/attribute_methods_test.rb +293 -0
- data/vendor/activerecord/test/cases/base_test.rb +2087 -0
- data/vendor/activerecord/test/cases/binary_test.rb +30 -0
- data/vendor/activerecord/test/cases/calculations_test.rb +328 -0
- data/vendor/activerecord/test/cases/callbacks_observers_test.rb +38 -0
- data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
- data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
- data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
- data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
- data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
- data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
- data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
- data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
- data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
- data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
- data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
- data/vendor/activerecord/test/cases/defaults_test.rb +100 -0
- data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
- data/vendor/activerecord/test/cases/dirty_test.rb +270 -0
- data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
- data/vendor/activerecord/test/cases/finder_test.rb +1048 -0
- data/vendor/activerecord/test/cases/fixtures_test.rb +655 -0
- data/vendor/activerecord/test/cases/helper.rb +62 -0
- data/vendor/activerecord/test/cases/i18n_test.rb +41 -0
- data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
- data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
- data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
- data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
- data/vendor/activerecord/test/cases/locking_test.rb +304 -0
- data/vendor/activerecord/test/cases/method_scoping_test.rb +569 -0
- data/vendor/activerecord/test/cases/migration_test.rb +1479 -0
- data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
- data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
- data/vendor/activerecord/test/cases/modules_test.rb +39 -0
- data/vendor/activerecord/test/cases/multiple_db_test.rb +85 -0
- data/vendor/activerecord/test/cases/named_scope_test.rb +280 -0
- data/vendor/activerecord/test/cases/pk_test.rb +101 -0
- data/vendor/activerecord/test/cases/pooled_connections_test.rb +103 -0
- data/vendor/activerecord/test/cases/query_cache_test.rb +127 -0
- data/vendor/activerecord/test/cases/readonly_test.rb +107 -0
- data/vendor/activerecord/test/cases/reflection_test.rb +184 -0
- data/vendor/activerecord/test/cases/reload_models_test.rb +20 -0
- data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
- data/vendor/activerecord/test/cases/sanitize_test.rb +25 -0
- data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
- data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
- data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
- data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
- data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
- data/vendor/activerecord/test/cases/transactions_test.rb +357 -0
- data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
- data/vendor/activerecord/test/cases/validations_i18n_test.rb +921 -0
- data/vendor/activerecord/test/cases/validations_test.rb +1552 -0
- data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
- data/vendor/activerecord/test/config.rb +5 -0
- data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
- data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_mysql/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -0
- data/vendor/activerecord/test/fixtures/accounts.yml +28 -0
- data/vendor/activerecord/test/fixtures/all/developers.yml +0 -0
- data/vendor/activerecord/test/fixtures/all/people.csv +0 -0
- data/vendor/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/vendor/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/vendor/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/vendor/activerecord/test/fixtures/authors.yml +9 -0
- data/vendor/activerecord/test/fixtures/binaries.yml +132 -0
- data/vendor/activerecord/test/fixtures/books.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories.yml +14 -0
- data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/vendor/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories_posts.yml +23 -0
- data/vendor/activerecord/test/fixtures/categorizations.yml +17 -0
- data/vendor/activerecord/test/fixtures/clubs.yml +6 -0
- data/vendor/activerecord/test/fixtures/comments.yml +59 -0
- data/vendor/activerecord/test/fixtures/companies.yml +56 -0
- data/vendor/activerecord/test/fixtures/computers.yml +4 -0
- data/vendor/activerecord/test/fixtures/courses.yml +7 -0
- data/vendor/activerecord/test/fixtures/customers.yml +26 -0
- data/vendor/activerecord/test/fixtures/developers.yml +21 -0
- data/vendor/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/vendor/activerecord/test/fixtures/edges.yml +6 -0
- data/vendor/activerecord/test/fixtures/entrants.yml +14 -0
- data/vendor/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/vendor/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/vendor/activerecord/test/fixtures/items.yml +4 -0
- data/vendor/activerecord/test/fixtures/jobs.yml +7 -0
- data/vendor/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/vendor/activerecord/test/fixtures/mateys.yml +4 -0
- data/vendor/activerecord/test/fixtures/members.yml +4 -0
- data/vendor/activerecord/test/fixtures/memberships.yml +20 -0
- data/vendor/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/vendor/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/vendor/activerecord/test/fixtures/mixins.yml +29 -0
- data/vendor/activerecord/test/fixtures/movies.yml +7 -0
- data/vendor/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/vendor/activerecord/test/fixtures/organizations.yml +5 -0
- data/vendor/activerecord/test/fixtures/owners.yml +7 -0
- data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
- data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/vendor/activerecord/test/fixtures/people.yml +6 -0
- data/vendor/activerecord/test/fixtures/pets.yml +14 -0
- data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
- data/vendor/activerecord/test/fixtures/posts.yml +49 -0
- data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/vendor/activerecord/test/fixtures/projects.yml +7 -0
- data/vendor/activerecord/test/fixtures/readers.yml +9 -0
- data/vendor/activerecord/test/fixtures/references.yml +17 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/vendor/activerecord/test/fixtures/ships.yml +5 -0
- data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
- data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
- data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
- data/vendor/activerecord/test/fixtures/tags.yml +7 -0
- data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
- data/vendor/activerecord/test/fixtures/topics.yml +42 -0
- data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
- data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
- data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/vendor/activerecord/test/migrations/broken/100_migration_that_raises_exception.rb +10 -0
- data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/models/author.rb +140 -0
- data/vendor/activerecord/test/models/auto_id.rb +4 -0
- data/vendor/activerecord/test/models/binary.rb +2 -0
- data/vendor/activerecord/test/models/book.rb +4 -0
- data/vendor/activerecord/test/models/categorization.rb +5 -0
- data/vendor/activerecord/test/models/category.rb +33 -0
- data/vendor/activerecord/test/models/citation.rb +6 -0
- data/vendor/activerecord/test/models/club.rb +13 -0
- data/vendor/activerecord/test/models/column_name.rb +3 -0
- data/vendor/activerecord/test/models/comment.rb +25 -0
- data/vendor/activerecord/test/models/company.rb +156 -0
- data/vendor/activerecord/test/models/company_in_module.rb +61 -0
- data/vendor/activerecord/test/models/computer.rb +3 -0
- data/vendor/activerecord/test/models/contact.rb +16 -0
- data/vendor/activerecord/test/models/course.rb +3 -0
- data/vendor/activerecord/test/models/customer.rb +73 -0
- data/vendor/activerecord/test/models/default.rb +2 -0
- data/vendor/activerecord/test/models/developer.rb +79 -0
- data/vendor/activerecord/test/models/edge.rb +5 -0
- data/vendor/activerecord/test/models/entrant.rb +3 -0
- data/vendor/activerecord/test/models/guid.rb +2 -0
- data/vendor/activerecord/test/models/item.rb +7 -0
- data/vendor/activerecord/test/models/job.rb +5 -0
- data/vendor/activerecord/test/models/joke.rb +3 -0
- data/vendor/activerecord/test/models/keyboard.rb +3 -0
- data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
- data/vendor/activerecord/test/models/matey.rb +4 -0
- data/vendor/activerecord/test/models/member.rb +11 -0
- data/vendor/activerecord/test/models/member_detail.rb +4 -0
- data/vendor/activerecord/test/models/membership.rb +9 -0
- data/vendor/activerecord/test/models/minimalistic.rb +2 -0
- data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/vendor/activerecord/test/models/movie.rb +5 -0
- data/vendor/activerecord/test/models/order.rb +4 -0
- data/vendor/activerecord/test/models/organization.rb +4 -0
- data/vendor/activerecord/test/models/owner.rb +4 -0
- data/vendor/activerecord/test/models/parrot.rb +14 -0
- data/vendor/activerecord/test/models/person.rb +10 -0
- data/vendor/activerecord/test/models/pet.rb +4 -0
- data/vendor/activerecord/test/models/pirate.rb +9 -0
- data/vendor/activerecord/test/models/post.rb +88 -0
- data/vendor/activerecord/test/models/price_estimate.rb +3 -0
- data/vendor/activerecord/test/models/project.rb +29 -0
- data/vendor/activerecord/test/models/reader.rb +4 -0
- data/vendor/activerecord/test/models/reference.rb +4 -0
- data/vendor/activerecord/test/models/reply.rb +39 -0
- data/vendor/activerecord/test/models/ship.rb +3 -0
- data/vendor/activerecord/test/models/sponsor.rb +4 -0
- data/vendor/activerecord/test/models/subject.rb +4 -0
- data/vendor/activerecord/test/models/subscriber.rb +8 -0
- data/vendor/activerecord/test/models/subscription.rb +4 -0
- data/vendor/activerecord/test/models/tag.rb +7 -0
- data/vendor/activerecord/test/models/tagging.rb +10 -0
- data/vendor/activerecord/test/models/task.rb +3 -0
- data/vendor/activerecord/test/models/topic.rb +69 -0
- data/vendor/activerecord/test/models/treasure.rb +6 -0
- data/vendor/activerecord/test/models/vertex.rb +9 -0
- data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
- data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
- data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
- data/vendor/activerecord/test/schema/schema.rb +440 -0
- data/vendor/activerecord/test/schema/schema2.rb +6 -0
- data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
- data/vendor/activesupport/CHANGELOG +1257 -0
- data/vendor/activesupport/README +43 -0
- data/vendor/activesupport/lib/active_support.rb +61 -0
- data/vendor/activesupport/lib/active_support/base64.rb +33 -0
- data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
- data/vendor/activesupport/lib/active_support/buffered_logger.rb +122 -0
- data/vendor/activesupport/lib/active_support/cache.rb +223 -0
- data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
- data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
- data/vendor/activesupport/lib/active_support/cache/file_store.rb +72 -0
- data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +127 -0
- data/vendor/activesupport/lib/active_support/cache/memory_store.rb +52 -0
- data/vendor/activesupport/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/vendor/activesupport/lib/active_support/callbacks.rb +280 -0
- data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +53 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +183 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +106 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +16 -0
- data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
- data/vendor/activesupport/lib/active_support/core_ext/blank.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
- data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +230 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +126 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
- data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +43 -0
- data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
- data/vendor/activesupport/lib/active_support/core_ext/file.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/float.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/time.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +33 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/time.rb +45 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
- data/vendor/activesupport/lib/active_support/core_ext/logger.rb +143 -0
- data/vendor/activesupport/lib/active_support/core_ext/module.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +95 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/object.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +80 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
- data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
- data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +36 -0
- data/vendor/activesupport/lib/active_support/core_ext/string.rb +22 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +167 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +303 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
- data/vendor/activesupport/lib/active_support/dependencies.rb +621 -0
- data/vendor/activesupport/lib/active_support/deprecation.rb +243 -0
- data/vendor/activesupport/lib/active_support/duration.rb +96 -0
- data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
- data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
- data/vendor/activesupport/lib/active_support/inflector.rb +397 -0
- data/vendor/activesupport/lib/active_support/json.rb +23 -0
- data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
- data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
- data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
- data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
- data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
- data/vendor/activesupport/lib/active_support/locale/en.yml +32 -0
- data/vendor/activesupport/lib/active_support/memoizable.rb +82 -0
- data/vendor/activesupport/lib/active_support/multibyte.rb +33 -0
- data/vendor/activesupport/lib/active_support/multibyte/chars.rb +679 -0
- data/vendor/activesupport/lib/active_support/multibyte/exceptions.rb +8 -0
- data/vendor/activesupport/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/vendor/activesupport/lib/active_support/option_merger.rb +17 -0
- data/vendor/activesupport/lib/active_support/ordered_hash.rb +58 -0
- data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
- data/vendor/activesupport/lib/active_support/rescuable.rb +108 -0
- data/vendor/activesupport/lib/active_support/secure_random.rb +197 -0
- data/vendor/activesupport/lib/active_support/string_inquirer.rb +21 -0
- data/vendor/activesupport/lib/active_support/test_case.rb +24 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test.rb +6 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
- data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
- data/vendor/activesupport/lib/active_support/testing/performance.rb +452 -0
- data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +120 -0
- data/vendor/activesupport/lib/active_support/time_with_zone.rb +328 -0
- data/vendor/activesupport/lib/active_support/values/time_zone.rb +403 -0
- data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/activesupport/lib/active_support/vendor.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
- data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/vendor/activesupport/lib/active_support/version.rb +9 -0
- data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
- data/vendor/activesupport/lib/activesupport.rb +1 -0
- data/vendor/isaac/LICENSE +26 -0
- data/vendor/isaac/README +78 -0
- data/vendor/isaac/TODO +3 -0
- data/vendor/isaac/VERSIONS +3 -0
- data/vendor/isaac/crypt/ISAAC.rb +171 -0
- data/vendor/isaac/isaac.gemspec +39 -0
- data/vendor/isaac/setup.rb +596 -0
- data/vendor/isaac/test/TC_ISAAC.rb +76 -0
- data/vendor/json/CHANGES +93 -0
- data/vendor/json/GPL +340 -0
- data/vendor/json/README +78 -0
- data/vendor/json/RUBY +58 -0
- data/vendor/json/Rakefile +309 -0
- data/vendor/json/TODO +1 -0
- data/vendor/json/VERSION +1 -0
- data/vendor/json/benchmarks/benchmark.txt +133 -0
- data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/json/bin/edit_json.rb +10 -0
- data/vendor/json/bin/prettify_json.rb +76 -0
- data/vendor/json/data/example.json +1 -0
- data/vendor/json/data/index.html +38 -0
- data/vendor/json/data/prototype.js +4184 -0
- data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/generator/generator.c +875 -0
- data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json/install.rb +26 -0
- data/vendor/json/lib/json.rb +235 -0
- data/vendor/json/lib/json/Array.xpm +21 -0
- data/vendor/json/lib/json/FalseClass.xpm +21 -0
- data/vendor/json/lib/json/Hash.xpm +21 -0
- data/vendor/json/lib/json/Key.xpm +73 -0
- data/vendor/json/lib/json/NilClass.xpm +21 -0
- data/vendor/json/lib/json/Numeric.xpm +28 -0
- data/vendor/json/lib/json/String.xpm +96 -0
- data/vendor/json/lib/json/TrueClass.xpm +21 -0
- data/vendor/json/lib/json/add/core.rb +135 -0
- data/vendor/json/lib/json/add/rails.rb +58 -0
- data/vendor/json/lib/json/common.rb +354 -0
- data/vendor/json/lib/json/editor.rb +1362 -0
- data/vendor/json/lib/json/ext.rb +13 -0
- data/vendor/json/lib/json/json.xpm +1499 -0
- data/vendor/json/lib/json/pure.rb +75 -0
- data/vendor/json/lib/json/pure/generator.rb +394 -0
- data/vendor/json/lib/json/pure/parser.rb +259 -0
- data/vendor/json/lib/json/version.rb +9 -0
- data/vendor/json/tests/fixtures/fail1.json +1 -0
- data/vendor/json/tests/fixtures/fail10.json +1 -0
- data/vendor/json/tests/fixtures/fail11.json +1 -0
- data/vendor/json/tests/fixtures/fail12.json +1 -0
- data/vendor/json/tests/fixtures/fail13.json +1 -0
- data/vendor/json/tests/fixtures/fail14.json +1 -0
- data/vendor/json/tests/fixtures/fail18.json +1 -0
- data/vendor/json/tests/fixtures/fail19.json +1 -0
- data/vendor/json/tests/fixtures/fail2.json +1 -0
- data/vendor/json/tests/fixtures/fail20.json +1 -0
- data/vendor/json/tests/fixtures/fail21.json +1 -0
- data/vendor/json/tests/fixtures/fail22.json +1 -0
- data/vendor/json/tests/fixtures/fail23.json +1 -0
- data/vendor/json/tests/fixtures/fail24.json +1 -0
- data/vendor/json/tests/fixtures/fail25.json +1 -0
- data/vendor/json/tests/fixtures/fail27.json +2 -0
- data/vendor/json/tests/fixtures/fail28.json +2 -0
- data/vendor/json/tests/fixtures/fail3.json +1 -0
- data/vendor/json/tests/fixtures/fail4.json +1 -0
- data/vendor/json/tests/fixtures/fail5.json +1 -0
- data/vendor/json/tests/fixtures/fail6.json +1 -0
- data/vendor/json/tests/fixtures/fail7.json +1 -0
- data/vendor/json/tests/fixtures/fail8.json +1 -0
- data/vendor/json/tests/fixtures/fail9.json +1 -0
- data/vendor/json/tests/fixtures/pass1.json +56 -0
- data/vendor/json/tests/fixtures/pass15.json +1 -0
- data/vendor/json/tests/fixtures/pass16.json +1 -0
- data/vendor/json/tests/fixtures/pass17.json +1 -0
- data/vendor/json/tests/fixtures/pass2.json +1 -0
- data/vendor/json/tests/fixtures/pass26.json +1 -0
- data/vendor/json/tests/fixtures/pass3.json +6 -0
- data/vendor/json/tests/runner.rb +25 -0
- data/vendor/json/tests/test_json.rb +293 -0
- data/vendor/json/tests/test_json_addition.rb +161 -0
- data/vendor/json/tests/test_json_fixtures.rb +30 -0
- data/vendor/json/tests/test_json_generate.rb +100 -0
- data/vendor/json/tests/test_json_rails.rb +118 -0
- data/vendor/json/tests/test_json_unicode.rb +61 -0
- data/vendor/json/tools/fuzz.rb +140 -0
- data/vendor/json/tools/server.rb +62 -0
- metadata +841 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# Deprecates the use of the former message interpolation syntax in activerecord
|
2
|
+
# as in "must have %d characters". The new syntax uses explicit variable names
|
3
|
+
# as in "{{value}} must have {{count}} characters".
|
4
|
+
|
5
|
+
require 'i18n/backend/simple'
|
6
|
+
module I18n
|
7
|
+
module Backend
|
8
|
+
class Simple
|
9
|
+
DEPRECATED_INTERPOLATORS = { '%d' => '{{count}}', '%s' => '{{value}}' }
|
10
|
+
|
11
|
+
protected
|
12
|
+
def interpolate_with_deprecated_syntax(locale, string, values = {})
|
13
|
+
return string unless string.is_a?(String)
|
14
|
+
|
15
|
+
string = string.gsub(/%d|%s/) do |s|
|
16
|
+
instead = DEPRECATED_INTERPOLATORS[s]
|
17
|
+
ActiveSupport::Deprecation.warn "using #{s} in messages is deprecated; use #{instead} instead."
|
18
|
+
instead
|
19
|
+
end
|
20
|
+
|
21
|
+
interpolate_without_deprecated_syntax(locale, string, values)
|
22
|
+
end
|
23
|
+
alias_method_chain :interpolate, :deprecated_syntax
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
en:
|
2
|
+
activerecord:
|
3
|
+
errors:
|
4
|
+
# The values :model, :attribute and :value are always available for interpolation
|
5
|
+
# The value :count is available when applicable. Can be used for pluralization.
|
6
|
+
messages:
|
7
|
+
inclusion: "is not included in the list"
|
8
|
+
exclusion: "is reserved"
|
9
|
+
invalid: "is invalid"
|
10
|
+
confirmation: "doesn't match confirmation"
|
11
|
+
accepted: "must be accepted"
|
12
|
+
empty: "can't be empty"
|
13
|
+
blank: "can't be blank"
|
14
|
+
too_long: "is too long (maximum is {{count}} characters)"
|
15
|
+
too_short: "is too short (minimum is {{count}} characters)"
|
16
|
+
wrong_length: "is the wrong length (should be {{count}} characters)"
|
17
|
+
taken: "has already been taken"
|
18
|
+
not_a_number: "is not a number"
|
19
|
+
greater_than: "must be greater than {{count}}"
|
20
|
+
greater_than_or_equal_to: "must be greater than or equal to {{count}}"
|
21
|
+
equal_to: "must be equal to {{count}}"
|
22
|
+
less_than: "must be less than {{count}}"
|
23
|
+
less_than_or_equal_to: "must be less than or equal to {{count}}"
|
24
|
+
odd: "must be odd"
|
25
|
+
even: "must be even"
|
26
|
+
# Append your own errors here or at the model/attributes scope.
|
27
|
+
|
28
|
+
# You can define own errors for models or model attributes.
|
29
|
+
# The values :model, :attribute and :value are always available for interpolation.
|
30
|
+
#
|
31
|
+
# For example,
|
32
|
+
# models:
|
33
|
+
# user:
|
34
|
+
# blank: "This is a custom blank message for {{model}}: {{attribute}}"
|
35
|
+
# attributes:
|
36
|
+
# login:
|
37
|
+
# blank: "This is a custom blank message for User login"
|
38
|
+
# Will define custom blank validation message for User model and
|
39
|
+
# custom blank validation message for login attribute of User model.
|
40
|
+
models:
|
41
|
+
|
42
|
+
# Translate model names. Used in Model.human_name().
|
43
|
+
#models:
|
44
|
+
# For example,
|
45
|
+
# user: "Dude"
|
46
|
+
# will translate User model name to "Dude"
|
47
|
+
|
48
|
+
# Translate model attribute names. Used in Model.human_attribute_name(attribute).
|
49
|
+
#attributes:
|
50
|
+
# For example,
|
51
|
+
# user:
|
52
|
+
# login: "Handle"
|
53
|
+
# will translate User attribute "login" as "Handle"
|
54
|
+
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Locking
|
3
|
+
# == What is Optimistic Locking
|
4
|
+
#
|
5
|
+
# Optimistic locking allows multiple users to access the same record for edits, and assumes a minimum of
|
6
|
+
# conflicts with the data. It does this by checking whether another process has made changes to a record since
|
7
|
+
# it was opened, an ActiveRecord::StaleObjectError is thrown if that has occurred and the update is ignored.
|
8
|
+
#
|
9
|
+
# Check out ActiveRecord::Locking::Pessimistic for an alternative.
|
10
|
+
#
|
11
|
+
# == Usage
|
12
|
+
#
|
13
|
+
# Active Records support optimistic locking if the field <tt>lock_version</tt> is present. Each update to the
|
14
|
+
# record increments the lock_version column and the locking facilities ensure that records instantiated twice
|
15
|
+
# will let the last one saved raise a StaleObjectError if the first was also updated. Example:
|
16
|
+
#
|
17
|
+
# p1 = Person.find(1)
|
18
|
+
# p2 = Person.find(1)
|
19
|
+
#
|
20
|
+
# p1.first_name = "Michael"
|
21
|
+
# p1.save
|
22
|
+
#
|
23
|
+
# p2.first_name = "should fail"
|
24
|
+
# p2.save # Raises a ActiveRecord::StaleObjectError
|
25
|
+
#
|
26
|
+
# You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging,
|
27
|
+
# or otherwise apply the business logic needed to resolve the conflict.
|
28
|
+
#
|
29
|
+
# You must ensure that your database schema defaults the lock_version column to 0.
|
30
|
+
#
|
31
|
+
# This behavior can be turned off by setting <tt>ActiveRecord::Base.lock_optimistically = false</tt>.
|
32
|
+
# To override the name of the lock_version column, invoke the <tt>set_locking_column</tt> method.
|
33
|
+
# This method uses the same syntax as <tt>set_table_name</tt>
|
34
|
+
module Optimistic
|
35
|
+
def self.included(base) #:nodoc:
|
36
|
+
base.extend ClassMethods
|
37
|
+
|
38
|
+
base.cattr_accessor :lock_optimistically, :instance_writer => false
|
39
|
+
base.lock_optimistically = true
|
40
|
+
|
41
|
+
base.alias_method_chain :update, :lock
|
42
|
+
base.alias_method_chain :attributes_from_column_definition, :lock
|
43
|
+
|
44
|
+
class << base
|
45
|
+
alias_method :locking_column=, :set_locking_column
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def locking_enabled? #:nodoc:
|
50
|
+
self.class.locking_enabled?
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def attributes_from_column_definition_with_lock
|
55
|
+
result = attributes_from_column_definition_without_lock
|
56
|
+
|
57
|
+
# If the locking column has no default value set,
|
58
|
+
# start the lock version at zero. Note we can't use
|
59
|
+
# locking_enabled? at this point as @attributes may
|
60
|
+
# not have been initialized yet
|
61
|
+
|
62
|
+
if lock_optimistically && result.include?(self.class.locking_column)
|
63
|
+
result[self.class.locking_column] ||= 0
|
64
|
+
end
|
65
|
+
|
66
|
+
return result
|
67
|
+
end
|
68
|
+
|
69
|
+
def update_with_lock(attribute_names = @attributes.keys) #:nodoc:
|
70
|
+
return update_without_lock(attribute_names) unless locking_enabled?
|
71
|
+
return 0 if attribute_names.empty?
|
72
|
+
|
73
|
+
lock_col = self.class.locking_column
|
74
|
+
previous_value = send(lock_col).to_i
|
75
|
+
send(lock_col + '=', previous_value + 1)
|
76
|
+
|
77
|
+
attribute_names += [lock_col]
|
78
|
+
attribute_names.uniq!
|
79
|
+
|
80
|
+
begin
|
81
|
+
affected_rows = connection.update(<<-end_sql, "#{self.class.name} Update with optimistic locking")
|
82
|
+
UPDATE #{self.class.quoted_table_name}
|
83
|
+
SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false, false, attribute_names))}
|
84
|
+
WHERE #{self.class.primary_key} = #{quote_value(id)}
|
85
|
+
AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)}
|
86
|
+
end_sql
|
87
|
+
|
88
|
+
unless affected_rows == 1
|
89
|
+
raise ActiveRecord::StaleObjectError, "Attempted to update a stale object"
|
90
|
+
end
|
91
|
+
|
92
|
+
affected_rows
|
93
|
+
|
94
|
+
# If something went wrong, revert the version.
|
95
|
+
rescue Exception
|
96
|
+
send(lock_col + '=', previous_value)
|
97
|
+
raise
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
module ClassMethods
|
102
|
+
DEFAULT_LOCKING_COLUMN = 'lock_version'
|
103
|
+
|
104
|
+
def self.extended(base)
|
105
|
+
class <<base
|
106
|
+
alias_method_chain :update_counters, :lock
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Is optimistic locking enabled for this table? Returns true if the
|
111
|
+
# +lock_optimistically+ flag is set to true (which it is, by default)
|
112
|
+
# and the table includes the +locking_column+ column (defaults to
|
113
|
+
# +lock_version+).
|
114
|
+
def locking_enabled?
|
115
|
+
lock_optimistically && columns_hash[locking_column]
|
116
|
+
end
|
117
|
+
|
118
|
+
# Set the column to use for optimistic locking. Defaults to +lock_version+.
|
119
|
+
def set_locking_column(value = nil, &block)
|
120
|
+
define_attr_method :locking_column, value, &block
|
121
|
+
value
|
122
|
+
end
|
123
|
+
|
124
|
+
# The version column used for optimistic locking. Defaults to +lock_version+.
|
125
|
+
def locking_column
|
126
|
+
reset_locking_column
|
127
|
+
end
|
128
|
+
|
129
|
+
# Quote the column name used for optimistic locking.
|
130
|
+
def quoted_locking_column
|
131
|
+
connection.quote_column_name(locking_column)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Reset the column used for optimistic locking back to the +lock_version+ default.
|
135
|
+
def reset_locking_column
|
136
|
+
set_locking_column DEFAULT_LOCKING_COLUMN
|
137
|
+
end
|
138
|
+
|
139
|
+
# Make sure the lock version column gets updated when counters are
|
140
|
+
# updated.
|
141
|
+
def update_counters_with_lock(id, counters)
|
142
|
+
counters = counters.merge(locking_column => 1) if locking_enabled?
|
143
|
+
update_counters_without_lock(id, counters)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (c) 2006 Shugo Maeda <shugo@ruby-lang.org>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject
|
9
|
+
# to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
18
|
+
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
19
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
module ActiveRecord
|
24
|
+
module Locking
|
25
|
+
# Locking::Pessimistic provides support for row-level locking using
|
26
|
+
# SELECT ... FOR UPDATE and other lock types.
|
27
|
+
#
|
28
|
+
# Pass <tt>:lock => true</tt> to ActiveRecord::Base.find to obtain an exclusive
|
29
|
+
# lock on the selected rows:
|
30
|
+
# # select * from accounts where id=1 for update
|
31
|
+
# Account.find(1, :lock => true)
|
32
|
+
#
|
33
|
+
# Pass <tt>:lock => 'some locking clause'</tt> to give a database-specific locking clause
|
34
|
+
# of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'.
|
35
|
+
#
|
36
|
+
# Example:
|
37
|
+
# Account.transaction do
|
38
|
+
# # select * from accounts where name = 'shugo' limit 1 for update
|
39
|
+
# shugo = Account.find(:first, :conditions => "name = 'shugo'", :lock => true)
|
40
|
+
# yuko = Account.find(:first, :conditions => "name = 'yuko'", :lock => true)
|
41
|
+
# shugo.balance -= 100
|
42
|
+
# shugo.save!
|
43
|
+
# yuko.balance += 100
|
44
|
+
# yuko.save!
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# You can also use ActiveRecord::Base#lock! method to lock one record by id.
|
48
|
+
# This may be better if you don't need to lock every row. Example:
|
49
|
+
# Account.transaction do
|
50
|
+
# # select * from accounts where ...
|
51
|
+
# accounts = Account.find(:all, :conditions => ...)
|
52
|
+
# account1 = accounts.detect { |account| ... }
|
53
|
+
# account2 = accounts.detect { |account| ... }
|
54
|
+
# # select * from accounts where id=? for update
|
55
|
+
# account1.lock!
|
56
|
+
# account2.lock!
|
57
|
+
# account1.balance -= 100
|
58
|
+
# account1.save!
|
59
|
+
# account2.balance += 100
|
60
|
+
# account2.save!
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# Database-specific information on row locking:
|
64
|
+
# MySQL: http://dev.mysql.com/doc/refman/5.1/en/innodb-locking-reads.html
|
65
|
+
# PostgreSQL: http://www.postgresql.org/docs/8.1/interactive/sql-select.html#SQL-FOR-UPDATE-SHARE
|
66
|
+
module Pessimistic
|
67
|
+
# Obtain a row lock on this record. Reloads the record to obtain the requested
|
68
|
+
# lock. Pass an SQL locking clause to append the end of the SELECT statement
|
69
|
+
# or pass true for "FOR UPDATE" (the default, an exclusive row lock). Returns
|
70
|
+
# the locked record.
|
71
|
+
def lock!(lock = true)
|
72
|
+
reload(:lock => lock) unless new_record?
|
73
|
+
self
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,560 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class IrreversibleMigration < ActiveRecordError#:nodoc:
|
3
|
+
end
|
4
|
+
|
5
|
+
class DuplicateMigrationVersionError < ActiveRecordError#:nodoc:
|
6
|
+
def initialize(version)
|
7
|
+
super("Multiple migrations have the version number #{version}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class DuplicateMigrationNameError < ActiveRecordError#:nodoc:
|
12
|
+
def initialize(name)
|
13
|
+
super("Multiple migrations have the name #{name}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class UnknownMigrationVersionError < ActiveRecordError #:nodoc:
|
18
|
+
def initialize(version)
|
19
|
+
super("No migration with version number #{version}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class IllegalMigrationNameError < ActiveRecordError#:nodoc:
|
24
|
+
def initialize(name)
|
25
|
+
super("Illegal name for migration file: #{name}\n\t(only lower case letters, numbers, and '_' allowed)")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Migrations can manage the evolution of a schema used by several physical databases. It's a solution
|
30
|
+
# to the common problem of adding a field to make a new feature work in your local database, but being unsure of how to
|
31
|
+
# push that change to other developers and to the production server. With migrations, you can describe the transformations
|
32
|
+
# in self-contained classes that can be checked into version control systems and executed against another database that
|
33
|
+
# might be one, two, or five versions behind.
|
34
|
+
#
|
35
|
+
# Example of a simple migration:
|
36
|
+
#
|
37
|
+
# class AddSsl < ActiveRecord::Migration
|
38
|
+
# def self.up
|
39
|
+
# add_column :accounts, :ssl_enabled, :boolean, :default => 1
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# def self.down
|
43
|
+
# remove_column :accounts, :ssl_enabled
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# This migration will add a boolean flag to the accounts table and remove it if you're backing out of the migration.
|
48
|
+
# It shows how all migrations have two class methods +up+ and +down+ that describes the transformations required to implement
|
49
|
+
# or remove the migration. These methods can consist of both the migration specific methods like add_column and remove_column,
|
50
|
+
# but may also contain regular Ruby code for generating data needed for the transformations.
|
51
|
+
#
|
52
|
+
# Example of a more complex migration that also needs to initialize data:
|
53
|
+
#
|
54
|
+
# class AddSystemSettings < ActiveRecord::Migration
|
55
|
+
# def self.up
|
56
|
+
# create_table :system_settings do |t|
|
57
|
+
# t.string :name
|
58
|
+
# t.string :label
|
59
|
+
# t.text :value
|
60
|
+
# t.string :type
|
61
|
+
# t.integer :position
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# def self.down
|
68
|
+
# drop_table :system_settings
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# This migration first adds the system_settings table, then creates the very first row in it using the Active Record model
|
73
|
+
# that relies on the table. It also uses the more advanced create_table syntax where you can specify a complete table schema
|
74
|
+
# in one block call.
|
75
|
+
#
|
76
|
+
# == Available transformations
|
77
|
+
#
|
78
|
+
# * <tt>create_table(name, options)</tt> Creates a table called +name+ and makes the table object available to a block
|
79
|
+
# that can then add columns to it, following the same format as add_column. See example above. The options hash is for
|
80
|
+
# fragments like "DEFAULT CHARSET=UTF-8" that are appended to the create table definition.
|
81
|
+
# * <tt>drop_table(name)</tt>: Drops the table called +name+.
|
82
|
+
# * <tt>rename_table(old_name, new_name)</tt>: Renames the table called +old_name+ to +new_name+.
|
83
|
+
# * <tt>add_column(table_name, column_name, type, options)</tt>: Adds a new column to the table called +table_name+
|
84
|
+
# named +column_name+ specified to be one of the following types:
|
85
|
+
# <tt>:string</tt>, <tt>:text</tt>, <tt>:integer</tt>, <tt>:float</tt>, <tt>:decimal</tt>, <tt>:datetime</tt>, <tt>:timestamp</tt>, <tt>:time</tt>,
|
86
|
+
# <tt>:date</tt>, <tt>:binary</tt>, <tt>:boolean</tt>. A default value can be specified by passing an
|
87
|
+
# +options+ hash like <tt>{ :default => 11 }</tt>. Other options include <tt>:limit</tt> and <tt>:null</tt> (e.g. <tt>{ :limit => 50, :null => false }</tt>)
|
88
|
+
# -- see ActiveRecord::ConnectionAdapters::TableDefinition#column for details.
|
89
|
+
# * <tt>rename_column(table_name, column_name, new_column_name)</tt>: Renames a column but keeps the type and content.
|
90
|
+
# * <tt>change_column(table_name, column_name, type, options)</tt>: Changes the column to a different type using the same
|
91
|
+
# parameters as add_column.
|
92
|
+
# * <tt>remove_column(table_name, column_name)</tt>: Removes the column named +column_name+ from the table called +table_name+.
|
93
|
+
# * <tt>add_index(table_name, column_names, options)</tt>: Adds a new index with the name of the column. Other options include
|
94
|
+
# <tt>:name</tt> and <tt>:unique</tt> (e.g. <tt>{ :name => "users_name_index", :unique => true }</tt>).
|
95
|
+
# * <tt>remove_index(table_name, index_name)</tt>: Removes the index specified by +index_name+.
|
96
|
+
#
|
97
|
+
# == Irreversible transformations
|
98
|
+
#
|
99
|
+
# Some transformations are destructive in a manner that cannot be reversed. Migrations of that kind should raise
|
100
|
+
# an <tt>ActiveRecord::IrreversibleMigration</tt> exception in their +down+ method.
|
101
|
+
#
|
102
|
+
# == Running migrations from within Rails
|
103
|
+
#
|
104
|
+
# The Rails package has several tools to help create and apply migrations.
|
105
|
+
#
|
106
|
+
# To generate a new migration, you can use
|
107
|
+
# script/generate migration MyNewMigration
|
108
|
+
#
|
109
|
+
# where MyNewMigration is the name of your migration. The generator will
|
110
|
+
# create an empty migration file <tt>nnn_my_new_migration.rb</tt> in the <tt>db/migrate/</tt>
|
111
|
+
# directory where <tt>nnn</tt> is the next largest migration number.
|
112
|
+
#
|
113
|
+
# You may then edit the <tt>self.up</tt> and <tt>self.down</tt> methods of
|
114
|
+
# MyNewMigration.
|
115
|
+
#
|
116
|
+
# There is a special syntactic shortcut to generate migrations that add fields to a table.
|
117
|
+
# script/generate migration add_fieldname_to_tablename fieldname:string
|
118
|
+
#
|
119
|
+
# This will generate the file <tt>nnn_add_fieldname_to_tablename</tt>, which will look like this:
|
120
|
+
# class AddFieldnameToTablename < ActiveRecord::Migration
|
121
|
+
# def self.up
|
122
|
+
# add_column :tablenames, :fieldname, :string
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# def self.down
|
126
|
+
# remove_column :tablenames, :fieldname
|
127
|
+
# end
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# To run migrations against the currently configured database, use
|
131
|
+
# <tt>rake db:migrate</tt>. This will update the database by running all of the
|
132
|
+
# pending migrations, creating the <tt>schema_migrations</tt> table
|
133
|
+
# (see "About the schema_migrations table" section below) if missing.
|
134
|
+
#
|
135
|
+
# To roll the database back to a previous migration version, use
|
136
|
+
# <tt>rake db:migrate VERSION=X</tt> where <tt>X</tt> is the version to which
|
137
|
+
# you wish to downgrade. If any of the migrations throw an
|
138
|
+
# <tt>ActiveRecord::IrreversibleMigration</tt> exception, that step will fail and you'll
|
139
|
+
# have some manual work to do.
|
140
|
+
#
|
141
|
+
# == Database support
|
142
|
+
#
|
143
|
+
# Migrations are currently supported in MySQL, PostgreSQL, SQLite,
|
144
|
+
# SQL Server, Sybase, and Oracle (all supported databases except DB2).
|
145
|
+
#
|
146
|
+
# == More examples
|
147
|
+
#
|
148
|
+
# Not all migrations change the schema. Some just fix the data:
|
149
|
+
#
|
150
|
+
# class RemoveEmptyTags < ActiveRecord::Migration
|
151
|
+
# def self.up
|
152
|
+
# Tag.find(:all).each { |tag| tag.destroy if tag.pages.empty? }
|
153
|
+
# end
|
154
|
+
#
|
155
|
+
# def self.down
|
156
|
+
# # not much we can do to restore deleted data
|
157
|
+
# raise ActiveRecord::IrreversibleMigration, "Can't recover the deleted tags"
|
158
|
+
# end
|
159
|
+
# end
|
160
|
+
#
|
161
|
+
# Others remove columns when they migrate up instead of down:
|
162
|
+
#
|
163
|
+
# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration
|
164
|
+
# def self.up
|
165
|
+
# remove_column :items, :incomplete_items_count
|
166
|
+
# remove_column :items, :completed_items_count
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# def self.down
|
170
|
+
# add_column :items, :incomplete_items_count
|
171
|
+
# add_column :items, :completed_items_count
|
172
|
+
# end
|
173
|
+
# end
|
174
|
+
#
|
175
|
+
# And sometimes you need to do something in SQL not abstracted directly by migrations:
|
176
|
+
#
|
177
|
+
# class MakeJoinUnique < ActiveRecord::Migration
|
178
|
+
# def self.up
|
179
|
+
# execute "ALTER TABLE `pages_linked_pages` ADD UNIQUE `page_id_linked_page_id` (`page_id`,`linked_page_id`)"
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# def self.down
|
183
|
+
# execute "ALTER TABLE `pages_linked_pages` DROP INDEX `page_id_linked_page_id`"
|
184
|
+
# end
|
185
|
+
# end
|
186
|
+
#
|
187
|
+
# == Using a model after changing its table
|
188
|
+
#
|
189
|
+
# Sometimes you'll want to add a column in a migration and populate it immediately after. In that case, you'll need
|
190
|
+
# to make a call to Base#reset_column_information in order to ensure that the model has the latest column data from
|
191
|
+
# after the new column was added. Example:
|
192
|
+
#
|
193
|
+
# class AddPeopleSalary < ActiveRecord::Migration
|
194
|
+
# def self.up
|
195
|
+
# add_column :people, :salary, :integer
|
196
|
+
# Person.reset_column_information
|
197
|
+
# Person.find(:all).each do |p|
|
198
|
+
# p.update_attribute :salary, SalaryCalculator.compute(p)
|
199
|
+
# end
|
200
|
+
# end
|
201
|
+
# end
|
202
|
+
#
|
203
|
+
# == Controlling verbosity
|
204
|
+
#
|
205
|
+
# By default, migrations will describe the actions they are taking, writing
|
206
|
+
# them to the console as they happen, along with benchmarks describing how
|
207
|
+
# long each step took.
|
208
|
+
#
|
209
|
+
# You can quiet them down by setting ActiveRecord::Migration.verbose = false.
|
210
|
+
#
|
211
|
+
# You can also insert your own messages and benchmarks by using the +say_with_time+
|
212
|
+
# method:
|
213
|
+
#
|
214
|
+
# def self.up
|
215
|
+
# ...
|
216
|
+
# say_with_time "Updating salaries..." do
|
217
|
+
# Person.find(:all).each do |p|
|
218
|
+
# p.update_attribute :salary, SalaryCalculator.compute(p)
|
219
|
+
# end
|
220
|
+
# end
|
221
|
+
# ...
|
222
|
+
# end
|
223
|
+
#
|
224
|
+
# The phrase "Updating salaries..." would then be printed, along with the
|
225
|
+
# benchmark for the block when the block completes.
|
226
|
+
#
|
227
|
+
# == About the schema_migrations table
|
228
|
+
#
|
229
|
+
# Rails versions 2.0 and prior used to create a table called
|
230
|
+
# <tt>schema_info</tt> when using migrations. This table contained the
|
231
|
+
# version of the schema as of the last applied migration.
|
232
|
+
#
|
233
|
+
# Starting with Rails 2.1, the <tt>schema_info</tt> table is
|
234
|
+
# (automatically) replaced by the <tt>schema_migrations</tt> table, which
|
235
|
+
# contains the version numbers of all the migrations applied.
|
236
|
+
#
|
237
|
+
# As a result, it is now possible to add migration files that are numbered
|
238
|
+
# lower than the current schema version: when migrating up, those
|
239
|
+
# never-applied "interleaved" migrations will be automatically applied, and
|
240
|
+
# when migrating down, never-applied "interleaved" migrations will be skipped.
|
241
|
+
#
|
242
|
+
# == Timestamped Migrations
|
243
|
+
#
|
244
|
+
# By default, Rails generates migrations that look like:
|
245
|
+
#
|
246
|
+
# 20080717013526_your_migration_name.rb
|
247
|
+
#
|
248
|
+
# The prefix is a generation timestamp (in UTC).
|
249
|
+
#
|
250
|
+
# If you'd prefer to use numeric prefixes, you can turn timestamped migrations
|
251
|
+
# off by setting:
|
252
|
+
#
|
253
|
+
# config.active_record.timestamped_migrations = false
|
254
|
+
#
|
255
|
+
# In environment.rb.
|
256
|
+
#
|
257
|
+
class Migration
|
258
|
+
@@verbose = true
|
259
|
+
cattr_accessor :verbose
|
260
|
+
|
261
|
+
class << self
|
262
|
+
def up_with_benchmarks #:nodoc:
|
263
|
+
migrate(:up)
|
264
|
+
end
|
265
|
+
|
266
|
+
def down_with_benchmarks #:nodoc:
|
267
|
+
migrate(:down)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Execute this migration in the named direction
|
271
|
+
def migrate(direction)
|
272
|
+
return unless respond_to?(direction)
|
273
|
+
|
274
|
+
case direction
|
275
|
+
when :up then announce "migrating"
|
276
|
+
when :down then announce "reverting"
|
277
|
+
end
|
278
|
+
|
279
|
+
result = nil
|
280
|
+
time = Benchmark.measure { result = send("#{direction}_without_benchmarks") }
|
281
|
+
|
282
|
+
case direction
|
283
|
+
when :up then announce "migrated (%.4fs)" % time.real; write
|
284
|
+
when :down then announce "reverted (%.4fs)" % time.real; write
|
285
|
+
end
|
286
|
+
|
287
|
+
result
|
288
|
+
end
|
289
|
+
|
290
|
+
# Because the method added may do an alias_method, it can be invoked
|
291
|
+
# recursively. We use @ignore_new_methods as a guard to indicate whether
|
292
|
+
# it is safe for the call to proceed.
|
293
|
+
def singleton_method_added(sym) #:nodoc:
|
294
|
+
return if defined?(@ignore_new_methods) && @ignore_new_methods
|
295
|
+
|
296
|
+
begin
|
297
|
+
@ignore_new_methods = true
|
298
|
+
|
299
|
+
case sym
|
300
|
+
when :up, :down
|
301
|
+
klass = (class << self; self; end)
|
302
|
+
klass.send(:alias_method_chain, sym, "benchmarks")
|
303
|
+
end
|
304
|
+
ensure
|
305
|
+
@ignore_new_methods = false
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
def write(text="")
|
310
|
+
puts(text) if verbose
|
311
|
+
end
|
312
|
+
|
313
|
+
def announce(message)
|
314
|
+
text = "#{@version} #{name}: #{message}"
|
315
|
+
length = [0, 75 - text.length].max
|
316
|
+
write "== %s %s" % [text, "=" * length]
|
317
|
+
end
|
318
|
+
|
319
|
+
def say(message, subitem=false)
|
320
|
+
write "#{subitem ? " ->" : "--"} #{message}"
|
321
|
+
end
|
322
|
+
|
323
|
+
def say_with_time(message)
|
324
|
+
say(message)
|
325
|
+
result = nil
|
326
|
+
time = Benchmark.measure { result = yield }
|
327
|
+
say "%.4fs" % time.real, :subitem
|
328
|
+
say("#{result} rows", :subitem) if result.is_a?(Integer)
|
329
|
+
result
|
330
|
+
end
|
331
|
+
|
332
|
+
def suppress_messages
|
333
|
+
save, self.verbose = verbose, false
|
334
|
+
yield
|
335
|
+
ensure
|
336
|
+
self.verbose = save
|
337
|
+
end
|
338
|
+
|
339
|
+
def method_missing(method, *arguments, &block)
|
340
|
+
arg_list = arguments.map(&:inspect) * ', '
|
341
|
+
|
342
|
+
say_with_time "#{method}(#{arg_list})" do
|
343
|
+
unless arguments.empty? || method == :execute
|
344
|
+
arguments[0] = Migrator.proper_table_name(arguments.first)
|
345
|
+
end
|
346
|
+
ActiveRecord::Base.connection.send(method, *arguments, &block)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
# MigrationProxy is used to defer loading of the actual migration classes
|
353
|
+
# until they are needed
|
354
|
+
class MigrationProxy
|
355
|
+
|
356
|
+
attr_accessor :name, :version, :filename
|
357
|
+
|
358
|
+
delegate :migrate, :announce, :write, :to=>:migration
|
359
|
+
|
360
|
+
private
|
361
|
+
|
362
|
+
def migration
|
363
|
+
@migration ||= load_migration
|
364
|
+
end
|
365
|
+
|
366
|
+
def load_migration
|
367
|
+
load(filename)
|
368
|
+
name.constantize
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|
372
|
+
|
373
|
+
class Migrator#:nodoc:
|
374
|
+
class << self
|
375
|
+
def migrate(migrations_path, target_version = nil)
|
376
|
+
case
|
377
|
+
when target_version.nil? then up(migrations_path, target_version)
|
378
|
+
when current_version > target_version then down(migrations_path, target_version)
|
379
|
+
else up(migrations_path, target_version)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
def rollback(migrations_path, steps=1)
|
384
|
+
migrator = self.new(:down, migrations_path)
|
385
|
+
start_index = migrator.migrations.index(migrator.current_migration)
|
386
|
+
|
387
|
+
return unless start_index
|
388
|
+
|
389
|
+
finish = migrator.migrations[start_index + steps]
|
390
|
+
down(migrations_path, finish ? finish.version : 0)
|
391
|
+
end
|
392
|
+
|
393
|
+
def up(migrations_path, target_version = nil)
|
394
|
+
self.new(:up, migrations_path, target_version).migrate
|
395
|
+
end
|
396
|
+
|
397
|
+
def down(migrations_path, target_version = nil)
|
398
|
+
self.new(:down, migrations_path, target_version).migrate
|
399
|
+
end
|
400
|
+
|
401
|
+
def run(direction, migrations_path, target_version)
|
402
|
+
self.new(direction, migrations_path, target_version).run
|
403
|
+
end
|
404
|
+
|
405
|
+
def schema_migrations_table_name
|
406
|
+
Base.table_name_prefix + 'schema_migrations' + Base.table_name_suffix
|
407
|
+
end
|
408
|
+
|
409
|
+
def get_all_versions
|
410
|
+
Base.connection.select_values("SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).sort
|
411
|
+
end
|
412
|
+
|
413
|
+
def current_version
|
414
|
+
sm_table = schema_migrations_table_name
|
415
|
+
if Base.connection.table_exists?(sm_table)
|
416
|
+
get_all_versions.max || 0
|
417
|
+
else
|
418
|
+
0
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
def proper_table_name(name)
|
423
|
+
# Use the Active Record objects own table_name, or pre/suffix from ActiveRecord::Base if name is a symbol/string
|
424
|
+
name.table_name rescue "#{ActiveRecord::Base.table_name_prefix}#{name}#{ActiveRecord::Base.table_name_suffix}"
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
def initialize(direction, migrations_path, target_version = nil)
|
429
|
+
raise StandardError.new("This database does not yet support migrations") unless Base.connection.supports_migrations?
|
430
|
+
Base.connection.initialize_schema_migrations_table
|
431
|
+
@direction, @migrations_path, @target_version = direction, migrations_path, target_version
|
432
|
+
end
|
433
|
+
|
434
|
+
def current_version
|
435
|
+
migrated.last || 0
|
436
|
+
end
|
437
|
+
|
438
|
+
def current_migration
|
439
|
+
migrations.detect { |m| m.version == current_version }
|
440
|
+
end
|
441
|
+
|
442
|
+
def run
|
443
|
+
target = migrations.detect { |m| m.version == @target_version }
|
444
|
+
raise UnknownMigrationVersionError.new(@target_version) if target.nil?
|
445
|
+
unless (up? && migrated.include?(target.version.to_i)) || (down? && !migrated.include?(target.version.to_i))
|
446
|
+
target.migrate(@direction)
|
447
|
+
record_version_state_after_migrating(target.version)
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
451
|
+
def migrate
|
452
|
+
current = migrations.detect { |m| m.version == current_version }
|
453
|
+
target = migrations.detect { |m| m.version == @target_version }
|
454
|
+
|
455
|
+
if target.nil? && !@target_version.nil? && @target_version > 0
|
456
|
+
raise UnknownMigrationVersionError.new(@target_version)
|
457
|
+
end
|
458
|
+
|
459
|
+
start = up? ? 0 : (migrations.index(current) || 0)
|
460
|
+
finish = migrations.index(target) || migrations.size - 1
|
461
|
+
runnable = migrations[start..finish]
|
462
|
+
|
463
|
+
# skip the last migration if we're headed down, but not ALL the way down
|
464
|
+
runnable.pop if down? && !target.nil?
|
465
|
+
|
466
|
+
runnable.each do |migration|
|
467
|
+
Base.logger.info "Migrating to #{migration.name} (#{migration.version})"
|
468
|
+
|
469
|
+
# On our way up, we skip migrating the ones we've already migrated
|
470
|
+
next if up? && migrated.include?(migration.version.to_i)
|
471
|
+
|
472
|
+
# On our way down, we skip reverting the ones we've never migrated
|
473
|
+
if down? && !migrated.include?(migration.version.to_i)
|
474
|
+
migration.announce 'never migrated, skipping'; migration.write
|
475
|
+
next
|
476
|
+
end
|
477
|
+
|
478
|
+
begin
|
479
|
+
ddl_transaction do
|
480
|
+
migration.migrate(@direction)
|
481
|
+
record_version_state_after_migrating(migration.version)
|
482
|
+
end
|
483
|
+
rescue => e
|
484
|
+
canceled_msg = Base.connection.supports_ddl_transactions? ? "this and " : ""
|
485
|
+
raise StandardError, "An error has occurred, #{canceled_msg}all later migrations canceled:\n\n#{e}", e.backtrace
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
def migrations
|
491
|
+
@migrations ||= begin
|
492
|
+
files = Dir["#{@migrations_path}/[0-9]*_*.rb"]
|
493
|
+
|
494
|
+
migrations = files.inject([]) do |klasses, file|
|
495
|
+
version, name = file.scan(/([0-9]+)_([_a-z0-9]*).rb/).first
|
496
|
+
|
497
|
+
raise IllegalMigrationNameError.new(file) unless version
|
498
|
+
version = version.to_i
|
499
|
+
|
500
|
+
if klasses.detect { |m| m.version == version }
|
501
|
+
raise DuplicateMigrationVersionError.new(version)
|
502
|
+
end
|
503
|
+
|
504
|
+
if klasses.detect { |m| m.name == name.camelize }
|
505
|
+
raise DuplicateMigrationNameError.new(name.camelize)
|
506
|
+
end
|
507
|
+
|
508
|
+
klasses << returning(MigrationProxy.new) do |migration|
|
509
|
+
migration.name = name.camelize
|
510
|
+
migration.version = version
|
511
|
+
migration.filename = file
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
migrations = migrations.sort_by(&:version)
|
516
|
+
down? ? migrations.reverse : migrations
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
def pending_migrations
|
521
|
+
already_migrated = migrated
|
522
|
+
migrations.reject { |m| already_migrated.include?(m.version.to_i) }
|
523
|
+
end
|
524
|
+
|
525
|
+
def migrated
|
526
|
+
@migrated_versions ||= self.class.get_all_versions
|
527
|
+
end
|
528
|
+
|
529
|
+
private
|
530
|
+
def record_version_state_after_migrating(version)
|
531
|
+
sm_table = self.class.schema_migrations_table_name
|
532
|
+
|
533
|
+
@migrated_versions ||= []
|
534
|
+
if down?
|
535
|
+
@migrated_versions.delete(version.to_i)
|
536
|
+
Base.connection.update("DELETE FROM #{sm_table} WHERE version = '#{version}'")
|
537
|
+
else
|
538
|
+
@migrated_versions.push(version.to_i).sort!
|
539
|
+
Base.connection.insert("INSERT INTO #{sm_table} (version) VALUES ('#{version}')")
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
def up?
|
544
|
+
@direction == :up
|
545
|
+
end
|
546
|
+
|
547
|
+
def down?
|
548
|
+
@direction == :down
|
549
|
+
end
|
550
|
+
|
551
|
+
# Wrap the migration in a transaction only if supported by the adapter.
|
552
|
+
def ddl_transaction(&block)
|
553
|
+
if Base.connection.supports_ddl_transactions?
|
554
|
+
Base.transaction { block.call }
|
555
|
+
else
|
556
|
+
block.call
|
557
|
+
end
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|