nbudin-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 +73 -0
- data/app/config.rb +17 -0
- data/app/config.ru +24 -0
- data/app/controllers/application.rb +42 -0
- data/app/public/javascripts/application.js +3 -0
- data/app/public/javascripts/jquery.js +32 -0
- data/app/public/stylesheets/screen.css +122 -0
- data/app/views/layout.erb +27 -0
- data/app/views/login.erb +31 -0
- data/app/views/logout.erb +13 -0
- data/app/views/proxy_validate.erb +22 -0
- data/app/views/service_validate.erb +15 -0
- data/bin/castronaut +71 -0
- data/castronaut.rb +7 -0
- data/config/castronaut.example.yml +41 -0
- data/config/castronaut.sample.yml +40 -0
- data/config/nginx_vhost.conf +17 -0
- data/config/thin_config.yml +13 -0
- data/lib/castronaut.rb +35 -0
- data/lib/castronaut/adapters.rb +22 -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 +39 -0
- data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
- data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
- data/lib/castronaut/authentication_result.rb +24 -0
- data/lib/castronaut/configuration.rb +108 -0
- data/lib/castronaut/db/001_create_cas_database.rb +47 -0
- data/lib/castronaut/extra_attributes.rb +8 -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 +68 -0
- data/lib/castronaut/presenters/service_validate.rb +69 -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
- data/vendor/rack/AUTHORS +8 -0
- data/vendor/rack/COPYING +18 -0
- data/vendor/rack/KNOWN-ISSUES +18 -0
- data/vendor/rack/RDOX +324 -0
- data/vendor/rack/README +306 -0
- data/vendor/rack/Rakefile +188 -0
- data/vendor/rack/SPEC +129 -0
- data/vendor/rack/bin/rackup +172 -0
- data/vendor/rack/contrib/rack_logo.svg +111 -0
- data/vendor/rack/example/lobster.ru +4 -0
- data/vendor/rack/example/protectedlobster.rb +14 -0
- data/vendor/rack/example/protectedlobster.ru +8 -0
- data/vendor/rack/lib/rack.rb +86 -0
- data/vendor/rack/lib/rack/adapter/camping.rb +22 -0
- data/vendor/rack/lib/rack/auth/abstract/handler.rb +28 -0
- data/vendor/rack/lib/rack/auth/abstract/request.rb +37 -0
- data/vendor/rack/lib/rack/auth/basic.rb +58 -0
- data/vendor/rack/lib/rack/auth/digest/md5.rb +124 -0
- data/vendor/rack/lib/rack/auth/digest/nonce.rb +51 -0
- data/vendor/rack/lib/rack/auth/digest/params.rb +55 -0
- data/vendor/rack/lib/rack/auth/digest/request.rb +40 -0
- data/vendor/rack/lib/rack/auth/openid.rb +438 -0
- data/vendor/rack/lib/rack/builder.rb +67 -0
- data/vendor/rack/lib/rack/cascade.rb +36 -0
- data/vendor/rack/lib/rack/commonlogger.rb +61 -0
- data/vendor/rack/lib/rack/conditionalget.rb +43 -0
- data/vendor/rack/lib/rack/content_length.rb +25 -0
- data/vendor/rack/lib/rack/deflater.rb +87 -0
- data/vendor/rack/lib/rack/directory.rb +150 -0
- data/vendor/rack/lib/rack/file.rb +85 -0
- data/vendor/rack/lib/rack/handler.rb +48 -0
- data/vendor/rack/lib/rack/handler/cgi.rb +57 -0
- data/vendor/rack/lib/rack/handler/evented_mongrel.rb +8 -0
- data/vendor/rack/lib/rack/handler/fastcgi.rb +86 -0
- data/vendor/rack/lib/rack/handler/lsws.rb +52 -0
- data/vendor/rack/lib/rack/handler/mongrel.rb +82 -0
- data/vendor/rack/lib/rack/handler/scgi.rb +57 -0
- data/vendor/rack/lib/rack/handler/swiftiplied_mongrel.rb +8 -0
- data/vendor/rack/lib/rack/handler/thin.rb +15 -0
- data/vendor/rack/lib/rack/handler/webrick.rb +61 -0
- data/vendor/rack/lib/rack/head.rb +19 -0
- data/vendor/rack/lib/rack/lint.rb +465 -0
- data/vendor/rack/lib/rack/lobster.rb +65 -0
- data/vendor/rack/lib/rack/methodoverride.rb +27 -0
- data/vendor/rack/lib/rack/mime.rb +204 -0
- data/vendor/rack/lib/rack/mock.rb +160 -0
- data/vendor/rack/lib/rack/recursive.rb +57 -0
- data/vendor/rack/lib/rack/reloader.rb +64 -0
- data/vendor/rack/lib/rack/request.rb +218 -0
- data/vendor/rack/lib/rack/response.rb +171 -0
- data/vendor/rack/lib/rack/session/abstract/id.rb +153 -0
- data/vendor/rack/lib/rack/session/cookie.rb +89 -0
- data/vendor/rack/lib/rack/session/memcache.rb +97 -0
- data/vendor/rack/lib/rack/session/pool.rb +73 -0
- data/vendor/rack/lib/rack/showexceptions.rb +348 -0
- data/vendor/rack/lib/rack/showstatus.rb +106 -0
- data/vendor/rack/lib/rack/static.rb +38 -0
- data/vendor/rack/lib/rack/urlmap.rb +48 -0
- data/vendor/rack/lib/rack/utils.rb +347 -0
- data/vendor/rack/test/cgi/lighttpd.conf +20 -0
- data/vendor/rack/test/cgi/test +9 -0
- data/vendor/rack/test/cgi/test.fcgi +8 -0
- data/vendor/rack/test/cgi/test.ru +7 -0
- data/vendor/rack/test/spec_rack_auth_basic.rb +69 -0
- data/vendor/rack/test/spec_rack_auth_digest.rb +169 -0
- data/vendor/rack/test/spec_rack_auth_openid.rb +137 -0
- data/vendor/rack/test/spec_rack_builder.rb +84 -0
- data/vendor/rack/test/spec_rack_camping.rb +51 -0
- data/vendor/rack/test/spec_rack_cascade.rb +50 -0
- data/vendor/rack/test/spec_rack_cgi.rb +89 -0
- data/vendor/rack/test/spec_rack_commonlogger.rb +32 -0
- data/vendor/rack/test/spec_rack_conditionalget.rb +41 -0
- data/vendor/rack/test/spec_rack_content_length.rb +43 -0
- data/vendor/rack/test/spec_rack_deflater.rb +105 -0
- data/vendor/rack/test/spec_rack_directory.rb +61 -0
- data/vendor/rack/test/spec_rack_fastcgi.rb +89 -0
- data/vendor/rack/test/spec_rack_file.rb +64 -0
- data/vendor/rack/test/spec_rack_handler.rb +24 -0
- data/vendor/rack/test/spec_rack_head.rb +30 -0
- data/vendor/rack/test/spec_rack_lint.rb +380 -0
- data/vendor/rack/test/spec_rack_lobster.rb +45 -0
- data/vendor/rack/test/spec_rack_methodoverride.rb +60 -0
- data/vendor/rack/test/spec_rack_mock.rb +152 -0
- data/vendor/rack/test/spec_rack_mongrel.rb +189 -0
- data/vendor/rack/test/spec_rack_recursive.rb +77 -0
- data/vendor/rack/test/spec_rack_request.rb +446 -0
- data/vendor/rack/test/spec_rack_response.rb +174 -0
- data/vendor/rack/test/spec_rack_session_cookie.rb +82 -0
- data/vendor/rack/test/spec_rack_session_memcache.rb +132 -0
- data/vendor/rack/test/spec_rack_session_pool.rb +84 -0
- data/vendor/rack/test/spec_rack_showexceptions.rb +21 -0
- data/vendor/rack/test/spec_rack_showstatus.rb +72 -0
- data/vendor/rack/test/spec_rack_static.rb +37 -0
- data/vendor/rack/test/spec_rack_thin.rb +90 -0
- data/vendor/rack/test/spec_rack_urlmap.rb +175 -0
- data/vendor/rack/test/spec_rack_utils.rb +176 -0
- data/vendor/rack/test/spec_rack_webrick.rb +123 -0
- data/vendor/rack/test/testrequest.rb +57 -0
- data/vendor/sinatra/AUTHORS +40 -0
- data/vendor/sinatra/CHANGES +189 -0
- data/vendor/sinatra/LICENSE +22 -0
- data/vendor/sinatra/README.rdoc +552 -0
- data/vendor/sinatra/Rakefile +186 -0
- data/vendor/sinatra/compat/app_test.rb +300 -0
- data/vendor/sinatra/compat/application_test.rb +334 -0
- data/vendor/sinatra/compat/builder_test.rb +101 -0
- data/vendor/sinatra/compat/custom_error_test.rb +62 -0
- data/vendor/sinatra/compat/erb_test.rb +136 -0
- data/vendor/sinatra/compat/events_test.rb +78 -0
- data/vendor/sinatra/compat/filter_test.rb +30 -0
- data/vendor/sinatra/compat/haml_test.rb +233 -0
- data/vendor/sinatra/compat/helper.rb +30 -0
- data/vendor/sinatra/compat/mapped_error_test.rb +72 -0
- data/vendor/sinatra/compat/pipeline_test.rb +71 -0
- data/vendor/sinatra/compat/public/foo.xml +1 -0
- data/vendor/sinatra/compat/sass_test.rb +57 -0
- data/vendor/sinatra/compat/sessions_test.rb +39 -0
- data/vendor/sinatra/compat/streaming_test.rb +121 -0
- data/vendor/sinatra/compat/sym_params_test.rb +19 -0
- data/vendor/sinatra/compat/template_test.rb +30 -0
- data/vendor/sinatra/compat/use_in_file_templates_test.rb +47 -0
- data/vendor/sinatra/compat/views/foo.builder +1 -0
- data/vendor/sinatra/compat/views/foo.erb +1 -0
- data/vendor/sinatra/compat/views/foo.haml +1 -0
- data/vendor/sinatra/compat/views/foo.sass +2 -0
- data/vendor/sinatra/compat/views/foo_layout.erb +2 -0
- data/vendor/sinatra/compat/views/foo_layout.haml +2 -0
- data/vendor/sinatra/compat/views/layout_test/foo.builder +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.erb +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.haml +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.sass +2 -0
- data/vendor/sinatra/compat/views/layout_test/layout.builder +3 -0
- data/vendor/sinatra/compat/views/layout_test/layout.erb +1 -0
- data/vendor/sinatra/compat/views/layout_test/layout.haml +1 -0
- data/vendor/sinatra/compat/views/layout_test/layout.sass +2 -0
- data/vendor/sinatra/compat/views/no_layout/no_layout.builder +1 -0
- data/vendor/sinatra/compat/views/no_layout/no_layout.haml +1 -0
- data/vendor/sinatra/lib/sinatra.rb +8 -0
- data/vendor/sinatra/lib/sinatra/base.rb +843 -0
- data/vendor/sinatra/lib/sinatra/compat.rb +239 -0
- data/vendor/sinatra/lib/sinatra/images/404.png +0 -0
- data/vendor/sinatra/lib/sinatra/images/500.png +0 -0
- data/vendor/sinatra/lib/sinatra/main.rb +48 -0
- data/vendor/sinatra/lib/sinatra/test.rb +114 -0
- data/vendor/sinatra/lib/sinatra/test/bacon.rb +17 -0
- data/vendor/sinatra/lib/sinatra/test/rspec.rb +9 -0
- data/vendor/sinatra/lib/sinatra/test/spec.rb +9 -0
- data/vendor/sinatra/lib/sinatra/test/unit.rb +11 -0
- data/vendor/sinatra/sinatra.gemspec +110 -0
- data/vendor/sinatra/test/base_test.rb +68 -0
- data/vendor/sinatra/test/builder_test.rb +64 -0
- data/vendor/sinatra/test/data/reload_app_file.rb +3 -0
- data/vendor/sinatra/test/erb_test.rb +50 -0
- data/vendor/sinatra/test/filter_test.rb +75 -0
- data/vendor/sinatra/test/haml_test.rb +68 -0
- data/vendor/sinatra/test/helper.rb +25 -0
- data/vendor/sinatra/test/helpers_test.rb +361 -0
- data/vendor/sinatra/test/mapped_error_test.rb +160 -0
- data/vendor/sinatra/test/middleware_test.rb +58 -0
- data/vendor/sinatra/test/options_test.rb +97 -0
- data/vendor/sinatra/test/reload_test.rb +61 -0
- data/vendor/sinatra/test/request_test.rb +18 -0
- data/vendor/sinatra/test/result_test.rb +88 -0
- data/vendor/sinatra/test/routing_test.rb +391 -0
- data/vendor/sinatra/test/sass_test.rb +36 -0
- data/vendor/sinatra/test/sinatra_test.rb +13 -0
- data/vendor/sinatra/test/static_test.rb +57 -0
- data/vendor/sinatra/test/templates_test.rb +88 -0
- data/vendor/sinatra/test/views/hello.builder +1 -0
- data/vendor/sinatra/test/views/hello.erb +1 -0
- data/vendor/sinatra/test/views/hello.haml +1 -0
- data/vendor/sinatra/test/views/hello.sass +2 -0
- data/vendor/sinatra/test/views/hello.test +1 -0
- data/vendor/sinatra/test/views/layout2.builder +3 -0
- data/vendor/sinatra/test/views/layout2.erb +2 -0
- data/vendor/sinatra/test/views/layout2.haml +2 -0
- data/vendor/sinatra/test/views/layout2.test +1 -0
- metadata +1058 -0
data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters # :nodoc:
|
3
|
+
module DatabaseStatements
|
4
|
+
# Returns an array of record hashes with the column names as keys and
|
5
|
+
# column values as values.
|
6
|
+
def select_all(sql, name = nil)
|
7
|
+
select(sql, name)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns a record hash with the column names as keys and column values
|
11
|
+
# as values.
|
12
|
+
def select_one(sql, name = nil)
|
13
|
+
result = select_all(sql, name)
|
14
|
+
result.first if result
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns a single value from a record
|
18
|
+
def select_value(sql, name = nil)
|
19
|
+
if result = select_one(sql, name)
|
20
|
+
result.values.first
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns an array of the values of the first column in a select:
|
25
|
+
# select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
|
26
|
+
def select_values(sql, name = nil)
|
27
|
+
result = select_rows(sql, name)
|
28
|
+
result.map { |v| v[0] }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns an array of arrays containing the field values.
|
32
|
+
# Order is the same as that returned by +columns+.
|
33
|
+
def select_rows(sql, name = nil)
|
34
|
+
raise NotImplementedError, "select_rows is an abstract method"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Executes the SQL statement in the context of this connection.
|
38
|
+
def execute(sql, name = nil)
|
39
|
+
raise NotImplementedError, "execute is an abstract method"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns the last auto-generated ID from the affected table.
|
43
|
+
def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
44
|
+
insert_sql(sql, name, pk, id_value, sequence_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Executes the update statement and returns the number of rows affected.
|
48
|
+
def update(sql, name = nil)
|
49
|
+
update_sql(sql, name)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Executes the delete statement and returns the number of rows affected.
|
53
|
+
def delete(sql, name = nil)
|
54
|
+
delete_sql(sql, name)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Wrap a block in a transaction. Returns result of block.
|
58
|
+
def transaction(start_db_transaction = true)
|
59
|
+
transaction_open = false
|
60
|
+
begin
|
61
|
+
if block_given?
|
62
|
+
if start_db_transaction
|
63
|
+
begin_db_transaction
|
64
|
+
transaction_open = true
|
65
|
+
end
|
66
|
+
yield
|
67
|
+
end
|
68
|
+
rescue Exception => database_transaction_rollback
|
69
|
+
if transaction_open
|
70
|
+
transaction_open = false
|
71
|
+
rollback_db_transaction
|
72
|
+
end
|
73
|
+
raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback
|
74
|
+
end
|
75
|
+
ensure
|
76
|
+
if transaction_open
|
77
|
+
begin
|
78
|
+
commit_db_transaction
|
79
|
+
rescue Exception => database_transaction_rollback
|
80
|
+
rollback_db_transaction
|
81
|
+
raise
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Begins the transaction (and turns off auto-committing).
|
87
|
+
def begin_db_transaction() end
|
88
|
+
|
89
|
+
# Commits the transaction (and turns on auto-committing).
|
90
|
+
def commit_db_transaction() end
|
91
|
+
|
92
|
+
# Rolls back the transaction (and turns on auto-committing). Must be
|
93
|
+
# done if the transaction block raises an exception or returns false.
|
94
|
+
def rollback_db_transaction() end
|
95
|
+
|
96
|
+
# Alias for <tt>add_limit_offset!</tt>.
|
97
|
+
def add_limit!(sql, options)
|
98
|
+
add_limit_offset!(sql, options) if options
|
99
|
+
end
|
100
|
+
|
101
|
+
# Appends +LIMIT+ and +OFFSET+ options to an SQL statement, or some SQL
|
102
|
+
# fragment that has the same semantics as LIMIT and OFFSET.
|
103
|
+
#
|
104
|
+
# +options+ must be a Hash which contains a +:limit+ option (required)
|
105
|
+
# and an +:offset+ option (optional).
|
106
|
+
#
|
107
|
+
# This method *modifies* the +sql+ parameter.
|
108
|
+
#
|
109
|
+
# ===== Examples
|
110
|
+
# add_limit_offset!('SELECT * FROM suppliers', {:limit => 10, :offset => 50})
|
111
|
+
# generates
|
112
|
+
# SELECT * FROM suppliers LIMIT 10 OFFSET 50
|
113
|
+
def add_limit_offset!(sql, options)
|
114
|
+
if limit = options[:limit]
|
115
|
+
sql << " LIMIT #{sanitize_limit(limit)}"
|
116
|
+
if offset = options[:offset]
|
117
|
+
sql << " OFFSET #{offset.to_i}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
sql
|
121
|
+
end
|
122
|
+
|
123
|
+
# Appends a locking clause to an SQL statement.
|
124
|
+
# This method *modifies* the +sql+ parameter.
|
125
|
+
# # SELECT * FROM suppliers FOR UPDATE
|
126
|
+
# add_lock! 'SELECT * FROM suppliers', :lock => true
|
127
|
+
# add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'
|
128
|
+
def add_lock!(sql, options)
|
129
|
+
case lock = options[:lock]
|
130
|
+
when true; sql << ' FOR UPDATE'
|
131
|
+
when String; sql << " #{lock}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def default_sequence_name(table, column)
|
136
|
+
nil
|
137
|
+
end
|
138
|
+
|
139
|
+
# Set the sequence to the max value of the table's column.
|
140
|
+
def reset_sequence!(table, column, sequence = nil)
|
141
|
+
# Do nothing by default. Implement for PostgreSQL, Oracle, ...
|
142
|
+
end
|
143
|
+
|
144
|
+
# Inserts the given fixture into the table. Overridden in adapters that require
|
145
|
+
# something beyond a simple insert (eg. Oracle).
|
146
|
+
def insert_fixture(fixture, table_name)
|
147
|
+
execute "INSERT INTO #{quote_table_name(table_name)} (#{fixture.key_list}) VALUES (#{fixture.value_list})", 'Fixture Insert'
|
148
|
+
end
|
149
|
+
|
150
|
+
def empty_insert_statement(table_name)
|
151
|
+
"INSERT INTO #{quote_table_name(table_name)} VALUES(DEFAULT)"
|
152
|
+
end
|
153
|
+
|
154
|
+
def case_sensitive_equality_operator
|
155
|
+
"="
|
156
|
+
end
|
157
|
+
|
158
|
+
def limited_update_conditions(where_sql, quoted_table_name, quoted_primary_key)
|
159
|
+
"WHERE #{quoted_primary_key} IN (SELECT #{quoted_primary_key} FROM #{quoted_table_name} #{where_sql})"
|
160
|
+
end
|
161
|
+
|
162
|
+
protected
|
163
|
+
# Returns an array of record hashes with the column names as keys and
|
164
|
+
# column values as values.
|
165
|
+
def select(sql, name = nil)
|
166
|
+
raise NotImplementedError, "select is an abstract method"
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the last auto-generated ID from the affected table.
|
170
|
+
def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
171
|
+
execute(sql, name)
|
172
|
+
id_value
|
173
|
+
end
|
174
|
+
|
175
|
+
# Executes the update statement and returns the number of rows affected.
|
176
|
+
def update_sql(sql, name = nil)
|
177
|
+
execute(sql, name)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Executes the delete statement and returns the number of rows affected.
|
181
|
+
def delete_sql(sql, name = nil)
|
182
|
+
update_sql(sql, name)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Sanitizes the given LIMIT parameter in order to prevent SQL injection.
|
186
|
+
#
|
187
|
+
# +limit+ may be anything that can evaluate to a string via #to_s. It
|
188
|
+
# should look like an integer, or a comma-delimited list of integers.
|
189
|
+
#
|
190
|
+
# Returns the sanitized limit parameter, either as an integer, or as a
|
191
|
+
# string which contains a comma-delimited list of integers.
|
192
|
+
def sanitize_limit(limit)
|
193
|
+
if limit.to_s =~ /,/
|
194
|
+
limit.to_s.split(',').map{ |i| i.to_i }.join(',')
|
195
|
+
else
|
196
|
+
limit.to_i
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters # :nodoc:
|
3
|
+
module QueryCache
|
4
|
+
class << self
|
5
|
+
def included(base)
|
6
|
+
base.class_eval do
|
7
|
+
alias_method_chain :columns, :query_cache
|
8
|
+
alias_method_chain :select_all, :query_cache
|
9
|
+
end
|
10
|
+
|
11
|
+
dirties_query_cache base, :insert, :update, :delete
|
12
|
+
end
|
13
|
+
|
14
|
+
def dirties_query_cache(base, *method_names)
|
15
|
+
method_names.each do |method_name|
|
16
|
+
base.class_eval <<-end_code, __FILE__, __LINE__
|
17
|
+
def #{method_name}_with_query_dirty(*args)
|
18
|
+
clear_query_cache if @query_cache_enabled
|
19
|
+
#{method_name}_without_query_dirty(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method_chain :#{method_name}, :query_dirty
|
23
|
+
end_code
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_reader :query_cache, :query_cache_enabled
|
29
|
+
|
30
|
+
# Enable the query cache within the block.
|
31
|
+
def cache
|
32
|
+
old, @query_cache_enabled = @query_cache_enabled, true
|
33
|
+
@query_cache ||= {}
|
34
|
+
yield
|
35
|
+
ensure
|
36
|
+
clear_query_cache
|
37
|
+
@query_cache_enabled = old
|
38
|
+
end
|
39
|
+
|
40
|
+
# Disable the query cache within the block.
|
41
|
+
def uncached
|
42
|
+
old, @query_cache_enabled = @query_cache_enabled, false
|
43
|
+
yield
|
44
|
+
ensure
|
45
|
+
@query_cache_enabled = old
|
46
|
+
end
|
47
|
+
|
48
|
+
# Clears the query cache.
|
49
|
+
#
|
50
|
+
# One reason you may wish to call this method explicitly is between queries
|
51
|
+
# that ask the database to randomize results. Otherwise the cache would see
|
52
|
+
# the same SQL query and repeatedly return the same result each time, silently
|
53
|
+
# undermining the randomness you were expecting.
|
54
|
+
def clear_query_cache
|
55
|
+
@query_cache.clear if @query_cache
|
56
|
+
end
|
57
|
+
|
58
|
+
def select_all_with_query_cache(*args)
|
59
|
+
if @query_cache_enabled
|
60
|
+
cache_sql(args.first) { select_all_without_query_cache(*args) }
|
61
|
+
else
|
62
|
+
select_all_without_query_cache(*args)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def columns_with_query_cache(*args)
|
67
|
+
if @query_cache_enabled
|
68
|
+
@query_cache["SHOW FIELDS FROM #{args.first}"] ||= columns_without_query_cache(*args)
|
69
|
+
else
|
70
|
+
columns_without_query_cache(*args)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
def cache_sql(sql)
|
76
|
+
result =
|
77
|
+
if @query_cache.has_key?(sql)
|
78
|
+
log_info(sql, "CACHE", 0.0)
|
79
|
+
@query_cache[sql]
|
80
|
+
else
|
81
|
+
@query_cache[sql] = yield
|
82
|
+
end
|
83
|
+
|
84
|
+
if Array === result
|
85
|
+
result.collect { |row| row.dup }
|
86
|
+
else
|
87
|
+
result.duplicable? ? result.dup : result
|
88
|
+
end
|
89
|
+
rescue TypeError
|
90
|
+
result
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters # :nodoc:
|
3
|
+
module Quoting
|
4
|
+
# Quotes the column value to help prevent
|
5
|
+
# {SQL injection attacks}[http://en.wikipedia.org/wiki/SQL_injection].
|
6
|
+
def quote(value, column = nil)
|
7
|
+
# records are quoted as their primary key
|
8
|
+
return value.quoted_id if value.respond_to?(:quoted_id)
|
9
|
+
|
10
|
+
case value
|
11
|
+
when String, ActiveSupport::Multibyte::Chars
|
12
|
+
value = value.to_s
|
13
|
+
if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
|
14
|
+
"#{quoted_string_prefix}'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
|
15
|
+
elsif column && [:integer, :float].include?(column.type)
|
16
|
+
value = column.type == :integer ? value.to_i : value.to_f
|
17
|
+
value.to_s
|
18
|
+
else
|
19
|
+
"#{quoted_string_prefix}'#{quote_string(value)}'" # ' (for ruby-mode)
|
20
|
+
end
|
21
|
+
when NilClass then "NULL"
|
22
|
+
when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
|
23
|
+
when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
|
24
|
+
when Float, Fixnum, Bignum then value.to_s
|
25
|
+
# BigDecimals need to be output in a non-normalized form and quoted.
|
26
|
+
when BigDecimal then value.to_s('F')
|
27
|
+
else
|
28
|
+
if value.acts_like?(:date) || value.acts_like?(:time)
|
29
|
+
"'#{quoted_date(value)}'"
|
30
|
+
else
|
31
|
+
"#{quoted_string_prefix}'#{quote_string(value.to_yaml)}'"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Quotes a string, escaping any ' (single quote) and \ (backslash)
|
37
|
+
# characters.
|
38
|
+
def quote_string(s)
|
39
|
+
s.gsub(/\\/, '\&\&').gsub(/'/, "''") # ' (for ruby-mode)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Quotes the column name. Defaults to no quoting.
|
43
|
+
def quote_column_name(column_name)
|
44
|
+
column_name
|
45
|
+
end
|
46
|
+
|
47
|
+
# Quotes the table name. Defaults to column name quoting.
|
48
|
+
def quote_table_name(table_name)
|
49
|
+
quote_column_name(table_name)
|
50
|
+
end
|
51
|
+
|
52
|
+
def quoted_true
|
53
|
+
"'t'"
|
54
|
+
end
|
55
|
+
|
56
|
+
def quoted_false
|
57
|
+
"'f'"
|
58
|
+
end
|
59
|
+
|
60
|
+
def quoted_date(value)
|
61
|
+
value.to_s(:db)
|
62
|
+
end
|
63
|
+
|
64
|
+
def quoted_string_prefix
|
65
|
+
''
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,705 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'set'
|
3
|
+
require 'bigdecimal'
|
4
|
+
require 'bigdecimal/util'
|
5
|
+
|
6
|
+
module ActiveRecord
|
7
|
+
module ConnectionAdapters #:nodoc:
|
8
|
+
# An abstract definition of a column in a table.
|
9
|
+
class Column
|
10
|
+
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set
|
11
|
+
|
12
|
+
module Format
|
13
|
+
ISO_DATE = /\A(\d{4})-(\d\d)-(\d\d)\z/
|
14
|
+
ISO_DATETIME = /\A(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)(\.\d+)?\z/
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :name, :default, :type, :limit, :null, :sql_type, :precision, :scale
|
18
|
+
attr_accessor :primary
|
19
|
+
|
20
|
+
# Instantiates a new column in the table.
|
21
|
+
#
|
22
|
+
# +name+ is the column's name, such as <tt>supplier_id</tt> in <tt>supplier_id int(11)</tt>.
|
23
|
+
# +default+ is the type-casted default value, such as +new+ in <tt>sales_stage varchar(20) default 'new'</tt>.
|
24
|
+
# +sql_type+ is only used to extract the column's length, if necessary. For example +60+ in <tt>company_name varchar(60)</tt>.
|
25
|
+
# +null+ determines if this column allows +NULL+ values.
|
26
|
+
def initialize(name, default, sql_type = nil, null = true)
|
27
|
+
@name, @sql_type, @null = name, sql_type, null
|
28
|
+
@limit, @precision, @scale = extract_limit(sql_type), extract_precision(sql_type), extract_scale(sql_type)
|
29
|
+
@type = simplified_type(sql_type)
|
30
|
+
@default = extract_default(default)
|
31
|
+
|
32
|
+
@primary = nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def text?
|
36
|
+
type == :string || type == :text
|
37
|
+
end
|
38
|
+
|
39
|
+
def number?
|
40
|
+
type == :integer || type == :float || type == :decimal
|
41
|
+
end
|
42
|
+
|
43
|
+
def has_default?
|
44
|
+
!default.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns the Ruby class that corresponds to the abstract data type.
|
48
|
+
def klass
|
49
|
+
case type
|
50
|
+
when :integer then Fixnum
|
51
|
+
when :float then Float
|
52
|
+
when :decimal then BigDecimal
|
53
|
+
when :datetime then Time
|
54
|
+
when :date then Date
|
55
|
+
when :timestamp then Time
|
56
|
+
when :time then Time
|
57
|
+
when :text, :string then String
|
58
|
+
when :binary then String
|
59
|
+
when :boolean then Object
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Casts value (which is a String) to an appropriate instance.
|
64
|
+
def type_cast(value)
|
65
|
+
return nil if value.nil?
|
66
|
+
case type
|
67
|
+
when :string then value
|
68
|
+
when :text then value
|
69
|
+
when :integer then value.to_i rescue value ? 1 : 0
|
70
|
+
when :float then value.to_f
|
71
|
+
when :decimal then self.class.value_to_decimal(value)
|
72
|
+
when :datetime then self.class.string_to_time(value)
|
73
|
+
when :timestamp then self.class.string_to_time(value)
|
74
|
+
when :time then self.class.string_to_dummy_time(value)
|
75
|
+
when :date then self.class.string_to_date(value)
|
76
|
+
when :binary then self.class.binary_to_string(value)
|
77
|
+
when :boolean then self.class.value_to_boolean(value)
|
78
|
+
else value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def type_cast_code(var_name)
|
83
|
+
case type
|
84
|
+
when :string then nil
|
85
|
+
when :text then nil
|
86
|
+
when :integer then "(#{var_name}.to_i rescue #{var_name} ? 1 : 0)"
|
87
|
+
when :float then "#{var_name}.to_f"
|
88
|
+
when :decimal then "#{self.class.name}.value_to_decimal(#{var_name})"
|
89
|
+
when :datetime then "#{self.class.name}.string_to_time(#{var_name})"
|
90
|
+
when :timestamp then "#{self.class.name}.string_to_time(#{var_name})"
|
91
|
+
when :time then "#{self.class.name}.string_to_dummy_time(#{var_name})"
|
92
|
+
when :date then "#{self.class.name}.string_to_date(#{var_name})"
|
93
|
+
when :binary then "#{self.class.name}.binary_to_string(#{var_name})"
|
94
|
+
when :boolean then "#{self.class.name}.value_to_boolean(#{var_name})"
|
95
|
+
else nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Returns the human name of the column name.
|
100
|
+
#
|
101
|
+
# ===== Examples
|
102
|
+
# Column.new('sales_stage', ...).human_name # => 'Sales stage'
|
103
|
+
def human_name
|
104
|
+
Base.human_attribute_name(@name)
|
105
|
+
end
|
106
|
+
|
107
|
+
def extract_default(default)
|
108
|
+
type_cast(default)
|
109
|
+
end
|
110
|
+
|
111
|
+
class << self
|
112
|
+
# Used to convert from Strings to BLOBs
|
113
|
+
def string_to_binary(value)
|
114
|
+
value
|
115
|
+
end
|
116
|
+
|
117
|
+
# Used to convert from BLOBs to Strings
|
118
|
+
def binary_to_string(value)
|
119
|
+
value
|
120
|
+
end
|
121
|
+
|
122
|
+
def string_to_date(string)
|
123
|
+
return string unless string.is_a?(String)
|
124
|
+
return nil if string.empty?
|
125
|
+
|
126
|
+
fast_string_to_date(string) || fallback_string_to_date(string)
|
127
|
+
end
|
128
|
+
|
129
|
+
def string_to_time(string)
|
130
|
+
return string unless string.is_a?(String)
|
131
|
+
return nil if string.empty?
|
132
|
+
|
133
|
+
fast_string_to_time(string) || fallback_string_to_time(string)
|
134
|
+
end
|
135
|
+
|
136
|
+
def string_to_dummy_time(string)
|
137
|
+
return string unless string.is_a?(String)
|
138
|
+
return nil if string.empty?
|
139
|
+
|
140
|
+
string_to_time "2000-01-01 #{string}"
|
141
|
+
end
|
142
|
+
|
143
|
+
# convert something to a boolean
|
144
|
+
def value_to_boolean(value)
|
145
|
+
if value.is_a?(String) && value.blank?
|
146
|
+
nil
|
147
|
+
else
|
148
|
+
TRUE_VALUES.include?(value)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# convert something to a BigDecimal
|
153
|
+
def value_to_decimal(value)
|
154
|
+
# Using .class is faster than .is_a? and
|
155
|
+
# subclasses of BigDecimal will be handled
|
156
|
+
# in the else clause
|
157
|
+
if value.class == BigDecimal
|
158
|
+
value
|
159
|
+
elsif value.respond_to?(:to_d)
|
160
|
+
value.to_d
|
161
|
+
else
|
162
|
+
value.to_s.to_d
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
protected
|
167
|
+
# '0.123456' -> 123456
|
168
|
+
# '1.123456' -> 123456
|
169
|
+
def microseconds(time)
|
170
|
+
((time[:sec_fraction].to_f % 1) * 1_000_000).to_i
|
171
|
+
end
|
172
|
+
|
173
|
+
def new_date(year, mon, mday)
|
174
|
+
if year && year != 0
|
175
|
+
Date.new(year, mon, mday) rescue nil
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def new_time(year, mon, mday, hour, min, sec, microsec)
|
180
|
+
# Treat 0000-00-00 00:00:00 as nil.
|
181
|
+
return nil if year.nil? || year == 0
|
182
|
+
|
183
|
+
Time.time_with_datetime_fallback(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil
|
184
|
+
end
|
185
|
+
|
186
|
+
def fast_string_to_date(string)
|
187
|
+
if string =~ Format::ISO_DATE
|
188
|
+
new_date $1.to_i, $2.to_i, $3.to_i
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Doesn't handle time zones.
|
193
|
+
def fast_string_to_time(string)
|
194
|
+
if string =~ Format::ISO_DATETIME
|
195
|
+
microsec = ($7.to_f * 1_000_000).to_i
|
196
|
+
new_time $1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, microsec
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def fallback_string_to_date(string)
|
201
|
+
new_date(*::Date._parse(string, false).values_at(:year, :mon, :mday))
|
202
|
+
end
|
203
|
+
|
204
|
+
def fallback_string_to_time(string)
|
205
|
+
time_hash = Date._parse(string)
|
206
|
+
time_hash[:sec_fraction] = microseconds(time_hash)
|
207
|
+
|
208
|
+
new_time(*time_hash.values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction))
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
private
|
213
|
+
def extract_limit(sql_type)
|
214
|
+
$1.to_i if sql_type =~ /\((.*)\)/
|
215
|
+
end
|
216
|
+
|
217
|
+
def extract_precision(sql_type)
|
218
|
+
$2.to_i if sql_type =~ /^(numeric|decimal|number)\((\d+)(,\d+)?\)/i
|
219
|
+
end
|
220
|
+
|
221
|
+
def extract_scale(sql_type)
|
222
|
+
case sql_type
|
223
|
+
when /^(numeric|decimal|number)\((\d+)\)/i then 0
|
224
|
+
when /^(numeric|decimal|number)\((\d+)(,(\d+))\)/i then $4.to_i
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def simplified_type(field_type)
|
229
|
+
case field_type
|
230
|
+
when /int/i
|
231
|
+
:integer
|
232
|
+
when /float|double/i
|
233
|
+
:float
|
234
|
+
when /decimal|numeric|number/i
|
235
|
+
extract_scale(field_type) == 0 ? :integer : :decimal
|
236
|
+
when /datetime/i
|
237
|
+
:datetime
|
238
|
+
when /timestamp/i
|
239
|
+
:timestamp
|
240
|
+
when /time/i
|
241
|
+
:time
|
242
|
+
when /date/i
|
243
|
+
:date
|
244
|
+
when /clob/i, /text/i
|
245
|
+
:text
|
246
|
+
when /blob/i, /binary/i
|
247
|
+
:binary
|
248
|
+
when /char/i, /string/i
|
249
|
+
:string
|
250
|
+
when /boolean/i
|
251
|
+
:boolean
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
class IndexDefinition < Struct.new(:table, :name, :unique, :columns) #:nodoc:
|
257
|
+
end
|
258
|
+
|
259
|
+
# Abstract representation of a column definition. Instances of this type
|
260
|
+
# are typically created by methods in TableDefinition, and added to the
|
261
|
+
# +columns+ attribute of said TableDefinition object, in order to be used
|
262
|
+
# for generating a number of table creation or table changing SQL statements.
|
263
|
+
class ColumnDefinition < Struct.new(:base, :name, :type, :limit, :precision, :scale, :default, :null) #:nodoc:
|
264
|
+
|
265
|
+
def sql_type
|
266
|
+
base.type_to_sql(type.to_sym, limit, precision, scale) rescue type
|
267
|
+
end
|
268
|
+
|
269
|
+
def to_sql
|
270
|
+
column_sql = "#{base.quote_column_name(name)} #{sql_type}"
|
271
|
+
column_options = {}
|
272
|
+
column_options[:null] = null unless null.nil?
|
273
|
+
column_options[:default] = default unless default.nil?
|
274
|
+
add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key
|
275
|
+
column_sql
|
276
|
+
end
|
277
|
+
alias to_s :to_sql
|
278
|
+
|
279
|
+
private
|
280
|
+
|
281
|
+
def add_column_options!(sql, options)
|
282
|
+
base.add_column_options!(sql, options.merge(:column => self))
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# Represents the schema of an SQL table in an abstract way. This class
|
287
|
+
# provides methods for manipulating the schema representation.
|
288
|
+
#
|
289
|
+
# Inside migration files, the +t+ object in +create_table+ and
|
290
|
+
# +change_table+ is actually of this type:
|
291
|
+
#
|
292
|
+
# class SomeMigration < ActiveRecord::Migration
|
293
|
+
# def self.up
|
294
|
+
# create_table :foo do |t|
|
295
|
+
# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
|
296
|
+
# end
|
297
|
+
# end
|
298
|
+
#
|
299
|
+
# def self.down
|
300
|
+
# ...
|
301
|
+
# end
|
302
|
+
# end
|
303
|
+
#
|
304
|
+
# The table definitions
|
305
|
+
# The Columns are stored as a ColumnDefinition in the +columns+ attribute.
|
306
|
+
class TableDefinition
|
307
|
+
# An array of ColumnDefinition objects, representing the column changes
|
308
|
+
# that have been defined.
|
309
|
+
attr_accessor :columns
|
310
|
+
|
311
|
+
def initialize(base)
|
312
|
+
@columns = []
|
313
|
+
@base = base
|
314
|
+
end
|
315
|
+
|
316
|
+
# Appends a primary key definition to the table definition.
|
317
|
+
# Can be called multiple times, but this is probably not a good idea.
|
318
|
+
def primary_key(name)
|
319
|
+
column(name, :primary_key)
|
320
|
+
end
|
321
|
+
|
322
|
+
# Returns a ColumnDefinition for the column with name +name+.
|
323
|
+
def [](name)
|
324
|
+
@columns.find {|column| column.name.to_s == name.to_s}
|
325
|
+
end
|
326
|
+
|
327
|
+
# Instantiates a new column for the table.
|
328
|
+
# The +type+ parameter is normally one of the migrations native types,
|
329
|
+
# which is one of the following:
|
330
|
+
# <tt>:primary_key</tt>, <tt>:string</tt>, <tt>:text</tt>,
|
331
|
+
# <tt>:integer</tt>, <tt>:float</tt>, <tt>:decimal</tt>,
|
332
|
+
# <tt>:datetime</tt>, <tt>:timestamp</tt>, <tt>:time</tt>,
|
333
|
+
# <tt>:date</tt>, <tt>:binary</tt>, <tt>:boolean</tt>.
|
334
|
+
#
|
335
|
+
# You may use a type not in this list as long as it is supported by your
|
336
|
+
# database (for example, "polygon" in MySQL), but this will not be database
|
337
|
+
# agnostic and should usually be avoided.
|
338
|
+
#
|
339
|
+
# Available options are (none of these exists by default):
|
340
|
+
# * <tt>:limit</tt> -
|
341
|
+
# Requests a maximum column length. This is number of characters for <tt>:string</tt> and <tt>:text</tt> columns and number of bytes for :binary and :integer columns.
|
342
|
+
# * <tt>:default</tt> -
|
343
|
+
# The column's default value. Use nil for NULL.
|
344
|
+
# * <tt>:null</tt> -
|
345
|
+
# Allows or disallows +NULL+ values in the column. This option could
|
346
|
+
# have been named <tt>:null_allowed</tt>.
|
347
|
+
# * <tt>:precision</tt> -
|
348
|
+
# Specifies the precision for a <tt>:decimal</tt> column.
|
349
|
+
# * <tt>:scale</tt> -
|
350
|
+
# Specifies the scale for a <tt>:decimal</tt> column.
|
351
|
+
#
|
352
|
+
# For clarity's sake: the precision is the number of significant digits,
|
353
|
+
# while the scale is the number of digits that can be stored following
|
354
|
+
# the decimal point. For example, the number 123.45 has a precision of 5
|
355
|
+
# and a scale of 2. A decimal with a precision of 5 and a scale of 2 can
|
356
|
+
# range from -999.99 to 999.99.
|
357
|
+
#
|
358
|
+
# Please be aware of different RDBMS implementations behavior with
|
359
|
+
# <tt>:decimal</tt> columns:
|
360
|
+
# * The SQL standard says the default scale should be 0, <tt>:scale</tt> <=
|
361
|
+
# <tt>:precision</tt>, and makes no comments about the requirements of
|
362
|
+
# <tt>:precision</tt>.
|
363
|
+
# * MySQL: <tt>:precision</tt> [1..63], <tt>:scale</tt> [0..30].
|
364
|
+
# Default is (10,0).
|
365
|
+
# * PostgreSQL: <tt>:precision</tt> [1..infinity],
|
366
|
+
# <tt>:scale</tt> [0..infinity]. No default.
|
367
|
+
# * SQLite2: Any <tt>:precision</tt> and <tt>:scale</tt> may be used.
|
368
|
+
# Internal storage as strings. No default.
|
369
|
+
# * SQLite3: No restrictions on <tt>:precision</tt> and <tt>:scale</tt>,
|
370
|
+
# but the maximum supported <tt>:precision</tt> is 16. No default.
|
371
|
+
# * Oracle: <tt>:precision</tt> [1..38], <tt>:scale</tt> [-84..127].
|
372
|
+
# Default is (38,0).
|
373
|
+
# * DB2: <tt>:precision</tt> [1..63], <tt>:scale</tt> [0..62].
|
374
|
+
# Default unknown.
|
375
|
+
# * Firebird: <tt>:precision</tt> [1..18], <tt>:scale</tt> [0..18].
|
376
|
+
# Default (9,0). Internal types NUMERIC and DECIMAL have different
|
377
|
+
# storage rules, decimal being better.
|
378
|
+
# * FrontBase?: <tt>:precision</tt> [1..38], <tt>:scale</tt> [0..38].
|
379
|
+
# Default (38,0). WARNING Max <tt>:precision</tt>/<tt>:scale</tt> for
|
380
|
+
# NUMERIC is 19, and DECIMAL is 38.
|
381
|
+
# * SqlServer?: <tt>:precision</tt> [1..38], <tt>:scale</tt> [0..38].
|
382
|
+
# Default (38,0).
|
383
|
+
# * Sybase: <tt>:precision</tt> [1..38], <tt>:scale</tt> [0..38].
|
384
|
+
# Default (38,0).
|
385
|
+
# * OpenBase?: Documentation unclear. Claims storage in <tt>double</tt>.
|
386
|
+
#
|
387
|
+
# This method returns <tt>self</tt>.
|
388
|
+
#
|
389
|
+
# == Examples
|
390
|
+
# # Assuming td is an instance of TableDefinition
|
391
|
+
# td.column(:granted, :boolean)
|
392
|
+
# # granted BOOLEAN
|
393
|
+
#
|
394
|
+
# td.column(:picture, :binary, :limit => 2.megabytes)
|
395
|
+
# # => picture BLOB(2097152)
|
396
|
+
#
|
397
|
+
# td.column(:sales_stage, :string, :limit => 20, :default => 'new', :null => false)
|
398
|
+
# # => sales_stage VARCHAR(20) DEFAULT 'new' NOT NULL
|
399
|
+
#
|
400
|
+
# td.column(:bill_gates_money, :decimal, :precision => 15, :scale => 2)
|
401
|
+
# # => bill_gates_money DECIMAL(15,2)
|
402
|
+
#
|
403
|
+
# td.column(:sensor_reading, :decimal, :precision => 30, :scale => 20)
|
404
|
+
# # => sensor_reading DECIMAL(30,20)
|
405
|
+
#
|
406
|
+
# # While <tt>:scale</tt> defaults to zero on most databases, it
|
407
|
+
# # probably wouldn't hurt to include it.
|
408
|
+
# td.column(:huge_integer, :decimal, :precision => 30)
|
409
|
+
# # => huge_integer DECIMAL(30)
|
410
|
+
#
|
411
|
+
# # Defines a column with a database-specific type.
|
412
|
+
# td.column(:foo, 'polygon')
|
413
|
+
# # => foo polygon
|
414
|
+
#
|
415
|
+
# == Short-hand examples
|
416
|
+
#
|
417
|
+
# Instead of calling +column+ directly, you can also work with the short-hand definitions for the default types.
|
418
|
+
# They use the type as the method name instead of as a parameter and allow for multiple columns to be defined
|
419
|
+
# in a single statement.
|
420
|
+
#
|
421
|
+
# What can be written like this with the regular calls to column:
|
422
|
+
#
|
423
|
+
# create_table "products", :force => true do |t|
|
424
|
+
# t.column "shop_id", :integer
|
425
|
+
# t.column "creator_id", :integer
|
426
|
+
# t.column "name", :string, :default => "Untitled"
|
427
|
+
# t.column "value", :string, :default => "Untitled"
|
428
|
+
# t.column "created_at", :datetime
|
429
|
+
# t.column "updated_at", :datetime
|
430
|
+
# end
|
431
|
+
#
|
432
|
+
# Can also be written as follows using the short-hand:
|
433
|
+
#
|
434
|
+
# create_table :products do |t|
|
435
|
+
# t.integer :shop_id, :creator_id
|
436
|
+
# t.string :name, :value, :default => "Untitled"
|
437
|
+
# t.timestamps
|
438
|
+
# end
|
439
|
+
#
|
440
|
+
# There's a short-hand method for each of the type values declared at the top. And then there's
|
441
|
+
# TableDefinition#timestamps that'll add created_at and +updated_at+ as datetimes.
|
442
|
+
#
|
443
|
+
# TableDefinition#references will add an appropriately-named _id column, plus a corresponding _type
|
444
|
+
# column if the <tt>:polymorphic</tt> option is supplied. If <tt>:polymorphic</tt> is a hash of options, these will be
|
445
|
+
# used when creating the <tt>_type</tt> column. So what can be written like this:
|
446
|
+
#
|
447
|
+
# create_table :taggings do |t|
|
448
|
+
# t.integer :tag_id, :tagger_id, :taggable_id
|
449
|
+
# t.string :tagger_type
|
450
|
+
# t.string :taggable_type, :default => 'Photo'
|
451
|
+
# end
|
452
|
+
#
|
453
|
+
# Can also be written as follows using references:
|
454
|
+
#
|
455
|
+
# create_table :taggings do |t|
|
456
|
+
# t.references :tag
|
457
|
+
# t.references :tagger, :polymorphic => true
|
458
|
+
# t.references :taggable, :polymorphic => { :default => 'Photo' }
|
459
|
+
# end
|
460
|
+
def column(name, type, options = {})
|
461
|
+
column = self[name] || ColumnDefinition.new(@base, name, type)
|
462
|
+
if options[:limit]
|
463
|
+
column.limit = options[:limit]
|
464
|
+
elsif native[type.to_sym].is_a?(Hash)
|
465
|
+
column.limit = native[type.to_sym][:limit]
|
466
|
+
end
|
467
|
+
column.precision = options[:precision]
|
468
|
+
column.scale = options[:scale]
|
469
|
+
column.default = options[:default]
|
470
|
+
column.null = options[:null]
|
471
|
+
@columns << column unless @columns.include? column
|
472
|
+
self
|
473
|
+
end
|
474
|
+
|
475
|
+
%w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
|
476
|
+
class_eval <<-EOV
|
477
|
+
def #{column_type}(*args)
|
478
|
+
options = args.extract_options!
|
479
|
+
column_names = args
|
480
|
+
|
481
|
+
column_names.each { |name| column(name, '#{column_type}', options) }
|
482
|
+
end
|
483
|
+
EOV
|
484
|
+
end
|
485
|
+
|
486
|
+
# Appends <tt>:datetime</tt> columns <tt>:created_at</tt> and
|
487
|
+
# <tt>:updated_at</tt> to the table.
|
488
|
+
def timestamps(*args)
|
489
|
+
options = args.extract_options!
|
490
|
+
column(:created_at, :datetime, options)
|
491
|
+
column(:updated_at, :datetime, options)
|
492
|
+
end
|
493
|
+
|
494
|
+
def references(*args)
|
495
|
+
options = args.extract_options!
|
496
|
+
polymorphic = options.delete(:polymorphic)
|
497
|
+
args.each do |col|
|
498
|
+
column("#{col}_id", :integer, options)
|
499
|
+
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) unless polymorphic.nil?
|
500
|
+
end
|
501
|
+
end
|
502
|
+
alias :belongs_to :references
|
503
|
+
|
504
|
+
# Returns a String whose contents are the column definitions
|
505
|
+
# concatenated together. This string can then be prepended and appended to
|
506
|
+
# to generate the final SQL to create the table.
|
507
|
+
def to_sql
|
508
|
+
@columns * ', '
|
509
|
+
end
|
510
|
+
|
511
|
+
private
|
512
|
+
def native
|
513
|
+
@base.native_database_types
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
# Represents a SQL table in an abstract way for updating a table.
|
518
|
+
# Also see TableDefinition and SchemaStatements#create_table
|
519
|
+
#
|
520
|
+
# Available transformations are:
|
521
|
+
#
|
522
|
+
# change_table :table do |t|
|
523
|
+
# t.column
|
524
|
+
# t.index
|
525
|
+
# t.timestamps
|
526
|
+
# t.change
|
527
|
+
# t.change_default
|
528
|
+
# t.rename
|
529
|
+
# t.references
|
530
|
+
# t.belongs_to
|
531
|
+
# t.string
|
532
|
+
# t.text
|
533
|
+
# t.integer
|
534
|
+
# t.float
|
535
|
+
# t.decimal
|
536
|
+
# t.datetime
|
537
|
+
# t.timestamp
|
538
|
+
# t.time
|
539
|
+
# t.date
|
540
|
+
# t.binary
|
541
|
+
# t.boolean
|
542
|
+
# t.remove
|
543
|
+
# t.remove_references
|
544
|
+
# t.remove_belongs_to
|
545
|
+
# t.remove_index
|
546
|
+
# t.remove_timestamps
|
547
|
+
# end
|
548
|
+
#
|
549
|
+
class Table
|
550
|
+
def initialize(table_name, base)
|
551
|
+
@table_name = table_name
|
552
|
+
@base = base
|
553
|
+
end
|
554
|
+
|
555
|
+
# Adds a new column to the named table.
|
556
|
+
# See TableDefinition#column for details of the options you can use.
|
557
|
+
# ===== Example
|
558
|
+
# ====== Creating a simple column
|
559
|
+
# t.column(:name, :string)
|
560
|
+
def column(column_name, type, options = {})
|
561
|
+
@base.add_column(@table_name, column_name, type, options)
|
562
|
+
end
|
563
|
+
|
564
|
+
# Adds a new index to the table. +column_name+ can be a single Symbol, or
|
565
|
+
# an Array of Symbols. See SchemaStatements#add_index
|
566
|
+
#
|
567
|
+
# ===== Examples
|
568
|
+
# ====== Creating a simple index
|
569
|
+
# t.index(:name)
|
570
|
+
# ====== Creating a unique index
|
571
|
+
# t.index([:branch_id, :party_id], :unique => true)
|
572
|
+
# ====== Creating a named index
|
573
|
+
# t.index([:branch_id, :party_id], :unique => true, :name => 'by_branch_party')
|
574
|
+
def index(column_name, options = {})
|
575
|
+
@base.add_index(@table_name, column_name, options)
|
576
|
+
end
|
577
|
+
|
578
|
+
# Adds timestamps (created_at and updated_at) columns to the table. See SchemaStatements#add_timestamps
|
579
|
+
# ===== Example
|
580
|
+
# t.timestamps
|
581
|
+
def timestamps
|
582
|
+
@base.add_timestamps(@table_name)
|
583
|
+
end
|
584
|
+
|
585
|
+
# Changes the column's definition according to the new options.
|
586
|
+
# See TableDefinition#column for details of the options you can use.
|
587
|
+
# ===== Examples
|
588
|
+
# t.change(:name, :string, :limit => 80)
|
589
|
+
# t.change(:description, :text)
|
590
|
+
def change(column_name, type, options = {})
|
591
|
+
@base.change_column(@table_name, column_name, type, options)
|
592
|
+
end
|
593
|
+
|
594
|
+
# Sets a new default value for a column. See SchemaStatements#change_column_default
|
595
|
+
# ===== Examples
|
596
|
+
# t.change_default(:qualification, 'new')
|
597
|
+
# t.change_default(:authorized, 1)
|
598
|
+
def change_default(column_name, default)
|
599
|
+
@base.change_column_default(@table_name, column_name, default)
|
600
|
+
end
|
601
|
+
|
602
|
+
# Removes the column(s) from the table definition.
|
603
|
+
# ===== Examples
|
604
|
+
# t.remove(:qualification)
|
605
|
+
# t.remove(:qualification, :experience)
|
606
|
+
def remove(*column_names)
|
607
|
+
@base.remove_column(@table_name, column_names)
|
608
|
+
end
|
609
|
+
|
610
|
+
# Removes the given index from the table.
|
611
|
+
#
|
612
|
+
# ===== Examples
|
613
|
+
# ====== Remove the suppliers_name_index in the suppliers table
|
614
|
+
# t.remove_index :name
|
615
|
+
# ====== Remove the index named accounts_branch_id_index in the accounts table
|
616
|
+
# t.remove_index :column => :branch_id
|
617
|
+
# ====== Remove the index named accounts_branch_id_party_id_index in the accounts table
|
618
|
+
# t.remove_index :column => [:branch_id, :party_id]
|
619
|
+
# ====== Remove the index named by_branch_party in the accounts table
|
620
|
+
# t.remove_index :name => :by_branch_party
|
621
|
+
def remove_index(options = {})
|
622
|
+
@base.remove_index(@table_name, options)
|
623
|
+
end
|
624
|
+
|
625
|
+
# Removes the timestamp columns (created_at and updated_at) from the table.
|
626
|
+
# ===== Example
|
627
|
+
# t.remove_timestamps
|
628
|
+
def remove_timestamps
|
629
|
+
@base.remove_timestamps(@table_name)
|
630
|
+
end
|
631
|
+
|
632
|
+
# Renames a column.
|
633
|
+
# ===== Example
|
634
|
+
# t.rename(:description, :name)
|
635
|
+
def rename(column_name, new_column_name)
|
636
|
+
@base.rename_column(@table_name, column_name, new_column_name)
|
637
|
+
end
|
638
|
+
|
639
|
+
# Adds a reference. Optionally adds a +type+ column.
|
640
|
+
# <tt>references</tt> and <tt>belongs_to</tt> are acceptable.
|
641
|
+
# ===== Examples
|
642
|
+
# t.references(:goat)
|
643
|
+
# t.references(:goat, :polymorphic => true)
|
644
|
+
# t.belongs_to(:goat)
|
645
|
+
def references(*args)
|
646
|
+
options = args.extract_options!
|
647
|
+
polymorphic = options.delete(:polymorphic)
|
648
|
+
args.each do |col|
|
649
|
+
@base.add_column(@table_name, "#{col}_id", :integer, options)
|
650
|
+
@base.add_column(@table_name, "#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) unless polymorphic.nil?
|
651
|
+
end
|
652
|
+
end
|
653
|
+
alias :belongs_to :references
|
654
|
+
|
655
|
+
# Removes a reference. Optionally removes a +type+ column.
|
656
|
+
# <tt>remove_references</tt> and <tt>remove_belongs_to</tt> are acceptable.
|
657
|
+
# ===== Examples
|
658
|
+
# t.remove_references(:goat)
|
659
|
+
# t.remove_references(:goat, :polymorphic => true)
|
660
|
+
# t.remove_belongs_to(:goat)
|
661
|
+
def remove_references(*args)
|
662
|
+
options = args.extract_options!
|
663
|
+
polymorphic = options.delete(:polymorphic)
|
664
|
+
args.each do |col|
|
665
|
+
@base.remove_column(@table_name, "#{col}_id")
|
666
|
+
@base.remove_column(@table_name, "#{col}_type") unless polymorphic.nil?
|
667
|
+
end
|
668
|
+
end
|
669
|
+
alias :remove_belongs_to :remove_references
|
670
|
+
|
671
|
+
# Adds a column or columns of a specified type
|
672
|
+
# ===== Examples
|
673
|
+
# t.string(:goat)
|
674
|
+
# t.string(:goat, :sheep)
|
675
|
+
%w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
|
676
|
+
class_eval <<-EOV
|
677
|
+
def #{column_type}(*args)
|
678
|
+
options = args.extract_options!
|
679
|
+
column_names = args
|
680
|
+
|
681
|
+
column_names.each do |name|
|
682
|
+
column = ColumnDefinition.new(@base, name, '#{column_type}')
|
683
|
+
if options[:limit]
|
684
|
+
column.limit = options[:limit]
|
685
|
+
elsif native['#{column_type}'.to_sym].is_a?(Hash)
|
686
|
+
column.limit = native['#{column_type}'.to_sym][:limit]
|
687
|
+
end
|
688
|
+
column.precision = options[:precision]
|
689
|
+
column.scale = options[:scale]
|
690
|
+
column.default = options[:default]
|
691
|
+
column.null = options[:null]
|
692
|
+
@base.add_column(@table_name, name, column.sql_type, options)
|
693
|
+
end
|
694
|
+
end
|
695
|
+
EOV
|
696
|
+
end
|
697
|
+
|
698
|
+
private
|
699
|
+
def native
|
700
|
+
@base.native_database_types
|
701
|
+
end
|
702
|
+
end
|
703
|
+
|
704
|
+
end
|
705
|
+
end
|