radiant 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +33 -1
- data/CONTRIBUTORS +15 -2
- data/INSTALL +9 -7
- data/README +11 -7
- data/app/controllers/admin/layouts_controller.rb +5 -2
- data/app/controllers/admin/pages_controller.rb +8 -5
- data/app/controllers/admin/snippets_controller.rb +5 -2
- data/app/controllers/application_controller.rb +7 -0
- data/app/helpers/admin/node_helper.rb +2 -2
- data/app/helpers/application_helper.rb +2 -2
- data/app/models/radiant/config.rb +36 -4
- data/app/models/standard_tags.rb +1 -1
- data/app/views/admin/layouts/index.html.haml +15 -12
- data/app/views/admin/page_parts/_page_part.html.haml +2 -2
- data/app/views/admin/pages/index.html.haml +1 -1
- data/app/views/admin/snippets/_form.html.haml +1 -1
- data/app/views/admin/snippets/index.html.haml +14 -10
- data/config/database.db2.yml +20 -0
- data/config/environment.rb +4 -4
- data/config/environments/test.rb +1 -2
- data/features/support/env.rb +2 -1
- data/lib/generators/extension/extension_generator.rb +5 -0
- data/lib/generators/extension/templates/RSpecRakefile +11 -8
- data/lib/generators/extension/templates/cucumber.yml +1 -0
- data/lib/generators/extension/templates/cucumber_env.rb +16 -0
- data/lib/generators/extension/templates/cucumber_paths.rb +14 -0
- data/lib/generators/extension/templates/extension.rb +1 -1
- data/lib/generators/instance/instance_generator.rb +1 -1
- data/lib/generators/instance/templates/databases/db2.yml +40 -0
- data/lib/generators/instance/templates/instance_environment.rb +6 -6
- data/lib/local_time.rb +3 -9
- data/lib/radiant.rb +1 -1
- data/lib/radiant/cache.rb +10 -8
- data/lib/radiant/extension.rb +36 -0
- data/lib/radiant/extension/script.rb +1 -1
- data/lib/radiant/extension_loader.rb +5 -1
- data/lib/radiant/initializer.rb +52 -4
- data/lib/task_support.rb +33 -0
- data/lib/tasks/cucumber.rake +5 -1
- data/lib/tasks/radiant_config.rake +18 -0
- data/lib/tasks/release.rake +1 -0
- data/public/javascripts/admin/admin.js +1 -1
- data/spec/controllers/admin/layouts_controller_spec.rb +18 -12
- data/spec/controllers/admin/pages_controller_spec.rb +35 -29
- data/spec/controllers/admin/snippets_controller_spec.rb +11 -5
- data/spec/controllers/admin/welcome_controller_spec.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +18 -0
- data/spec/fixtures/radiant_config.yml +10 -0
- data/spec/generators/extension_generator_spec.rb +12 -0
- data/spec/helpers/admin/node_helper_spec.rb +6 -0
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/lib/radiant/extension_loader_spec.rb +17 -0
- data/spec/lib/radiant/extension_spec.rb +28 -0
- data/spec/lib/radiant/initializer_spec.rb +34 -0
- data/spec/lib/task_support_spec.rb +42 -0
- data/spec/models/page_spec.rb +6 -2
- data/spec/models/radiant/config_spec.rb +42 -1
- data/spec/models/standard_tags_spec.rb +2 -2
- data/test/fixtures/extensions/01_basic/app/metal/basic_metal.rb +9 -0
- data/test/fixtures/extensions/02_overriding/app/metal/basic_metal.rb +9 -0
- data/vendor/extensions/textile_filter/textile.html +2 -2
- data/vendor/plugins/dataset/CHANGELOG +2 -1
- data/vendor/plugins/dataset/Rakefile +3 -0
- data/vendor/plugins/dataset/VERSION.yml +2 -2
- data/vendor/plugins/dataset/dataset.gemspec +9 -3
- data/vendor/plugins/dataset/lib/dataset.rb +3 -0
- data/vendor/radius/lib/radius.rb +5 -0
- data/vendor/radius/test/radius_test.rb +6 -0
- data/vendor/rails/actionmailer/CHANGELOG +8 -0
- data/vendor/rails/actionmailer/Rakefile +3 -2
- data/vendor/rails/actionmailer/lib/action_mailer/base.rb +2 -1
- data/vendor/rails/actionmailer/lib/action_mailer/version.rb +1 -1
- data/vendor/rails/actionmailer/test/abstract_unit.rb +0 -3
- data/vendor/rails/actionmailer/test/mail_service_test.rb +3 -2
- data/vendor/rails/actionpack/CHANGELOG +16 -0
- data/vendor/rails/actionpack/Rakefile +5 -3
- data/vendor/rails/actionpack/lib/action_controller.rb +2 -7
- data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +13 -3
- data/vendor/rails/actionpack/lib/action_controller/base.rb +12 -3
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/caching/actions.rb +9 -1
- data/vendor/rails/actionpack/lib/action_controller/caching/sweeper.rb +45 -0
- data/vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb +0 -42
- data/vendor/rails/actionpack/lib/action_controller/cookies.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/dispatcher.rb +21 -6
- data/vendor/rails/actionpack/lib/action_controller/failsafe.rb +40 -6
- data/vendor/rails/actionpack/lib/action_controller/flash.rb +11 -3
- data/vendor/rails/actionpack/lib/action_controller/http_authentication.rb +7 -3
- data/vendor/rails/actionpack/lib/action_controller/integration.rb +5 -12
- data/vendor/rails/actionpack/lib/action_controller/middlewares.rb +0 -1
- data/vendor/rails/actionpack/lib/action_controller/params_parser.rb +6 -0
- data/vendor/rails/actionpack/lib/action_controller/reloader.rb +47 -7
- data/vendor/rails/actionpack/lib/action_controller/request.rb +6 -2
- data/vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb +2 -1
- data/vendor/rails/actionpack/lib/action_controller/resources.rb +17 -13
- data/vendor/rails/actionpack/lib/action_controller/response.rb +8 -2
- data/vendor/rails/actionpack/lib/action_controller/routing.rb +3 -0
- data/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb +20 -6
- data/vendor/rails/actionpack/lib/action_controller/streaming.rb +4 -2
- data/vendor/rails/actionpack/lib/action_controller/test_process.rb +9 -1
- data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +1 -1
- data/vendor/rails/actionpack/lib/action_pack/version.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb +21 -9
- data/vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb +26 -12
- data/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb +71 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb +10 -4
- data/vendor/rails/actionpack/lib/action_view/helpers/number_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +7 -7
- data/vendor/rails/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +5 -5
- data/vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb +23 -14
- data/vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/locale/en.yml +4 -0
- data/vendor/rails/actionpack/lib/action_view/paths.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/template.rb +22 -33
- data/vendor/rails/actionpack/test/abstract_unit.rb +17 -1
- data/vendor/rails/actionpack/test/activerecord/active_record_store_test.rb +3 -3
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +27 -0
- data/vendor/rails/actionpack/test/controller/caching_test.rb +40 -1
- data/vendor/rails/actionpack/test/controller/cookie_test.rb +16 -0
- data/vendor/rails/actionpack/test/controller/dispatcher_test.rb +59 -18
- data/vendor/rails/actionpack/test/controller/failsafe_test.rb +60 -0
- data/vendor/rails/actionpack/test/controller/filter_params_test.rb +3 -1
- data/vendor/rails/actionpack/test/controller/flash_test.rb +6 -1
- data/vendor/rails/actionpack/test/controller/http_basic_authentication_test.rb +25 -0
- data/vendor/rails/actionpack/test/controller/http_digest_authentication_test.rb +63 -9
- data/vendor/rails/actionpack/test/controller/integration_test.rb +31 -3
- data/vendor/rails/actionpack/test/controller/rack_test.rb +18 -1
- data/vendor/rails/actionpack/test/controller/redirect_test.rb +4 -1
- data/vendor/rails/actionpack/test/controller/reloader_test.rb +124 -0
- data/vendor/rails/actionpack/test/controller/render_test.rb +19 -9
- data/vendor/rails/actionpack/test/controller/request/json_params_parsing_test.rb +24 -4
- data/vendor/rails/actionpack/test/controller/request/multipart_params_parsing_test.rb +1 -62
- data/vendor/rails/actionpack/test/controller/request/test_request_test.rb +35 -0
- data/vendor/rails/actionpack/test/controller/request/url_encoded_params_parsing_test.rb +0 -38
- data/vendor/rails/actionpack/test/controller/request/xml_params_parsing_test.rb +15 -0
- data/vendor/rails/actionpack/test/controller/request_forgery_protection_test.rb +6 -5
- data/vendor/rails/actionpack/test/controller/request_test.rb +218 -230
- data/vendor/rails/actionpack/test/controller/resources_test.rb +52 -0
- data/vendor/rails/actionpack/test/controller/routing_test.rb +28 -2
- data/vendor/rails/actionpack/test/controller/send_file_test.rb +12 -2
- data/vendor/rails/actionpack/test/controller/session/cookie_store_test.rb +9 -32
- data/vendor/rails/actionpack/test/controller/test_test.rb +8 -0
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +29 -3
- data/vendor/rails/actionpack/test/fixtures/failsafe/500.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/absolute/test.css +23 -0
- data/vendor/rails/actionpack/test/fixtures/public/absolute/test.js +63 -0
- data/vendor/rails/actionpack/test/template/active_record_helper_test.rb +1 -1
- data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +46 -0
- data/vendor/rails/actionpack/test/template/atom_feed_helper_test.rb +29 -0
- data/vendor/rails/actionpack/test/template/form_helper_test.rb +143 -6
- data/vendor/rails/actionpack/test/template/form_options_helper_i18n_test.rb +27 -0
- data/vendor/rails/actionpack/test/template/form_options_helper_test.rb +56 -0
- data/vendor/rails/actionpack/test/template/form_tag_helper_test.rb +23 -6
- data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +11 -11
- data/vendor/rails/actionpack/test/template/template_test.rb +32 -0
- data/vendor/rails/actionpack/test/template/text_helper_test.rb +23 -0
- data/vendor/rails/actionpack/test/template/url_helper_test.rb +8 -0
- data/vendor/rails/activerecord/CHANGELOG +18 -0
- data/vendor/rails/activerecord/Rakefile +26 -9
- data/vendor/rails/activerecord/examples/performance.rb +162 -0
- data/vendor/rails/activerecord/lib/active_record/associations.rb +104 -35
- data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +10 -5
- data/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +22 -4
- data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +5 -1
- data/vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +16 -0
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +1 -0
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +13 -3
- data/vendor/rails/activerecord/lib/active_record/associations/has_one_through_association.rb +15 -9
- data/vendor/rails/activerecord/lib/active_record/autosave_association.rb +15 -9
- data/vendor/rails/activerecord/lib/active_record/base.rb +34 -31
- data/vendor/rails/activerecord/lib/active_record/batches.rb +23 -15
- data/vendor/rails/activerecord/lib/active_record/calculations.rb +7 -13
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +16 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +7 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +17 -8
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +98 -35
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +15 -0
- data/vendor/rails/activerecord/lib/active_record/dirty.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/fixtures.rb +14 -11
- data/vendor/rails/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/locale/en.yml +4 -0
- data/vendor/rails/activerecord/lib/active_record/named_scope.rb +3 -8
- data/vendor/rails/activerecord/lib/active_record/reflection.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/schema_dumper.rb +6 -3
- data/vendor/rails/activerecord/lib/active_record/serialization.rb +3 -2
- data/vendor/rails/activerecord/lib/active_record/serializers/json_serializer.rb +10 -18
- data/vendor/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +6 -2
- data/vendor/rails/activerecord/lib/active_record/session_store.rb +9 -1
- data/vendor/rails/activerecord/lib/active_record/timestamp.rb +39 -9
- data/vendor/rails/activerecord/lib/active_record/validations.rb +149 -80
- data/vendor/rails/activerecord/lib/active_record/version.rb +1 -1
- data/vendor/rails/activerecord/test/cases/adapter_test.rb +12 -0
- data/vendor/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb +102 -22
- data/vendor/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb +5 -5
- data/vendor/rails/activerecord/test/cases/associations/eager_test.rb +12 -0
- data/vendor/rails/activerecord/test/cases/associations/habtm_join_table_test.rb +56 -0
- data/vendor/rails/activerecord/test/cases/associations/has_many_associations_test.rb +62 -2
- data/vendor/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb +46 -1
- data/vendor/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb +18 -1
- data/vendor/rails/activerecord/test/cases/associations/inner_join_association_test.rb +5 -0
- data/vendor/rails/activerecord/test/cases/associations/join_model_test.rb +4 -4
- data/vendor/rails/activerecord/test/cases/autosave_association_test.rb +22 -0
- data/vendor/rails/activerecord/test/cases/base_test.rb +51 -6
- data/vendor/rails/activerecord/test/cases/calculations_test.rb +14 -14
- data/vendor/rails/activerecord/test/cases/column_definition_test.rb +34 -0
- data/vendor/rails/activerecord/test/cases/copy_table_test_sqlite.rb +5 -5
- data/vendor/rails/activerecord/test/cases/dirty_test.rb +10 -0
- data/vendor/rails/activerecord/test/cases/finder_test.rb +21 -50
- data/vendor/rails/activerecord/test/cases/fixtures_test.rb +6 -1
- data/vendor/rails/activerecord/test/cases/helper.rb +1 -2
- data/vendor/rails/activerecord/test/cases/i18n_test.rb +5 -0
- data/vendor/rails/activerecord/test/cases/json_serialization_test.rb +57 -57
- data/vendor/rails/activerecord/test/cases/method_scoping_test.rb +14 -4
- data/vendor/rails/activerecord/test/cases/migration_test.rb +39 -11
- data/vendor/rails/activerecord/test/cases/modules_test.rb +42 -0
- data/vendor/rails/activerecord/test/cases/named_scope_test.rb +6 -4
- data/vendor/rails/activerecord/test/cases/pk_test.rb +18 -0
- data/vendor/rails/activerecord/test/cases/reflection_test.rb +7 -7
- data/vendor/rails/activerecord/test/cases/schema_dumper_test.rb +35 -7
- data/vendor/rails/activerecord/test/cases/schema_test_postgresql.rb +76 -0
- data/vendor/rails/activerecord/test/cases/timestamp_test.rb +75 -0
- data/vendor/rails/activerecord/test/cases/validations_i18n_test.rb +656 -624
- data/vendor/rails/activerecord/test/cases/validations_test.rb +12 -2
- data/vendor/rails/activerecord/test/cases/xml_serialization_test.rb +20 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database.sqlite +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database_2.sqlite +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/rails/activerecord/test/fixtures/posts.yml +3 -0
- data/vendor/rails/activerecord/test/models/author.rb +5 -0
- data/vendor/rails/activerecord/test/models/comment.rb +5 -1
- data/vendor/rails/activerecord/test/models/company.rb +9 -7
- data/vendor/rails/activerecord/test/models/company_in_module.rb +1 -1
- data/vendor/rails/activerecord/test/models/contract.rb +5 -0
- data/vendor/rails/activerecord/test/models/developer.rb +10 -0
- data/vendor/rails/activerecord/test/models/essay.rb +3 -0
- data/vendor/rails/activerecord/test/models/organization.rb +2 -0
- data/vendor/rails/activerecord/test/models/pet.rb +1 -1
- data/vendor/rails/activerecord/test/models/project.rb +1 -1
- data/vendor/rails/activerecord/test/models/reply.rb +2 -1
- data/vendor/rails/activerecord/test/models/topic.rb +1 -2
- data/vendor/rails/activerecord/test/models/toy.rb +2 -0
- data/vendor/rails/activerecord/test/schema/postgresql_specific_schema.rb +13 -2
- data/vendor/rails/activerecord/test/schema/schema.rb +19 -0
- data/vendor/rails/activeresource/CHANGELOG +16 -0
- data/vendor/rails/activeresource/Rakefile +3 -2
- data/vendor/rails/activeresource/lib/active_resource/base.rb +89 -9
- data/vendor/rails/activeresource/lib/active_resource/connection.rb +73 -8
- data/vendor/rails/activeresource/lib/active_resource/exceptions.rb +66 -0
- data/vendor/rails/activeresource/lib/active_resource/formats/json_format.rb +2 -2
- data/vendor/rails/activeresource/lib/active_resource/validations.rb +20 -4
- data/vendor/rails/activeresource/lib/active_resource/version.rb +1 -1
- data/vendor/rails/activeresource/test/abstract_unit.rb +1 -3
- data/vendor/rails/activeresource/test/base/load_test.rb +16 -1
- data/vendor/rails/activeresource/test/base_errors_test.rb +56 -19
- data/vendor/rails/activeresource/test/base_test.rb +147 -0
- data/vendor/rails/activeresource/test/connection_test.rb +42 -0
- data/vendor/rails/activeresource/test/debug.log +7974 -0
- data/vendor/rails/activeresource/test/fixtures/proxy.rb +4 -0
- data/vendor/rails/activesupport/CHANGELOG +13 -0
- data/vendor/rails/activesupport/lib/active_support/all.rb +8 -0
- data/vendor/rails/activesupport/lib/active_support/cache.rb +14 -1
- data/vendor/rails/activesupport/lib/active_support/cache/mem_cache_store.rb +16 -10
- data/vendor/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +2 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb +2 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +14 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +2 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +19 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb +8 -6
- data/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +15 -9
- data/vendor/rails/activesupport/lib/active_support/core_ext/string.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/access.rb +29 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/bytesize.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +7 -7
- data/vendor/rails/activesupport/lib/active_support/deprecation.rb +9 -9
- data/vendor/rails/activesupport/lib/active_support/duration.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json.rb +1 -22
- data/vendor/rails/activesupport/lib/active_support/json/backends/jsongem.rb +38 -0
- data/vendor/rails/activesupport/lib/active_support/json/backends/yaml.rb +88 -0
- data/vendor/rails/activesupport/lib/active_support/json/decoding.rb +23 -72
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date_time.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb +14 -9
- data/vendor/rails/activesupport/lib/active_support/json/encoders/false_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb +21 -11
- data/vendor/rails/activesupport/lib/active_support/json/encoders/nil_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/numeric.rb +16 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/object.rb +6 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/regexp.rb +4 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/string.rb +5 -32
- data/vendor/rails/activesupport/lib/active_support/json/encoders/symbol.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/time.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/true_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoding.rb +80 -9
- data/vendor/rails/activesupport/lib/active_support/memoizable.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/message_verifier.rb +16 -3
- data/vendor/rails/activesupport/lib/active_support/multibyte.rb +30 -6
- data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +23 -17
- data/vendor/rails/activesupport/lib/active_support/multibyte/utils.rb +61 -0
- data/vendor/rails/activesupport/lib/active_support/ordered_hash.rb +28 -0
- data/vendor/rails/activesupport/lib/active_support/test_case.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/testing/deprecation.rb +2 -0
- data/vendor/rails/activesupport/lib/active_support/time_with_zone.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/vendor.rb +6 -7
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/{memcache-client-1.6.5 → memcache-client-1.7.4}/memcache.rb +242 -70
- data/vendor/rails/activesupport/lib/active_support/version.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/xml_mini/jdom.rb +162 -0
- data/vendor/rails/railties/CHANGELOG +10 -0
- data/vendor/rails/railties/Rakefile +13 -9
- data/vendor/rails/railties/bin/about +2 -2
- data/vendor/rails/railties/bin/console +1 -1
- data/vendor/rails/railties/bin/dbconsole +1 -1
- data/vendor/rails/railties/bin/destroy +1 -1
- data/vendor/rails/railties/bin/generate +1 -1
- data/vendor/rails/railties/bin/performance/benchmarker +1 -1
- data/vendor/rails/railties/bin/performance/profiler +1 -1
- data/vendor/rails/railties/bin/plugin +1 -1
- data/vendor/rails/railties/bin/runner +1 -1
- data/vendor/rails/railties/bin/server +1 -1
- data/vendor/rails/railties/builtin/rails_info/rails/info.rb +4 -2
- data/vendor/rails/railties/configs/initializers/new_rails_defaults.rb +2 -0
- data/vendor/rails/railties/configs/routes.rb +1 -1
- data/vendor/rails/railties/configs/seeds.rb +7 -0
- data/vendor/rails/railties/environments/boot.rb +1 -1
- data/vendor/rails/railties/guides/files/javascripts/code_highlighter.js +188 -0
- data/vendor/rails/railties/guides/files/javascripts/guides.js +8 -0
- data/vendor/rails/railties/guides/files/javascripts/highlighters.js +90 -0
- data/vendor/rails/railties/guides/files/stylesheets/main.css +441 -0
- data/vendor/rails/railties/guides/files/stylesheets/print.css +52 -0
- data/vendor/rails/railties/guides/files/stylesheets/reset.css +43 -0
- data/vendor/rails/railties/guides/files/stylesheets/style.css +13 -0
- data/vendor/rails/railties/guides/files/stylesheets/syntax.css +31 -0
- data/vendor/rails/railties/guides/images/belongs_to.png +0 -0
- data/vendor/rails/railties/guides/images/book_icon.gif +0 -0
- data/vendor/rails/railties/guides/images/bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/chapters_icon.gif +0 -0
- data/vendor/rails/railties/guides/images/check_bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/credits_pic_blank.gif +0 -0
- data/vendor/rails/railties/guides/images/csrf.png +0 -0
- data/vendor/rails/railties/guides/images/customized_error_messages.png +0 -0
- data/vendor/rails/railties/guides/images/error_messages.png +0 -0
- data/vendor/rails/railties/guides/images/feature_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/footer_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/fxn.jpg +0 -0
- data/vendor/rails/railties/guides/images/grey_bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/habtm.png +0 -0
- data/vendor/rails/railties/guides/images/has_many.png +0 -0
- data/vendor/rails/railties/guides/images/has_many_through.png +0 -0
- data/vendor/rails/railties/guides/images/has_one.png +0 -0
- data/vendor/rails/railties/guides/images/has_one_through.png +0 -0
- data/vendor/rails/railties/guides/images/header_backdrop.png +0 -0
- data/vendor/rails/railties/guides/images/header_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_localized_pirate.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translated_en.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translated_pirate.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translation_missing.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_untranslated.png +0 -0
- data/vendor/rails/railties/guides/images/icons/README +5 -0
- data/vendor/rails/railties/guides/images/icons/callouts/1.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/10.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/11.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/12.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/13.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/14.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/15.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/2.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/3.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/4.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/5.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/6.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/7.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/8.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/9.png +0 -0
- data/vendor/rails/railties/guides/images/icons/caution.png +0 -0
- data/vendor/rails/railties/guides/images/icons/example.png +0 -0
- data/vendor/rails/railties/guides/images/icons/home.png +0 -0
- data/vendor/rails/railties/guides/images/icons/important.png +0 -0
- data/vendor/rails/railties/guides/images/icons/next.png +0 -0
- data/vendor/rails/railties/guides/images/icons/note.png +0 -0
- data/vendor/rails/railties/guides/images/icons/prev.png +0 -0
- data/vendor/rails/railties/guides/images/icons/tip.png +0 -0
- data/vendor/rails/railties/guides/images/icons/up.png +0 -0
- data/vendor/rails/railties/guides/images/icons/warning.png +0 -0
- data/vendor/rails/railties/guides/images/nav_arrow.gif +0 -0
- data/vendor/rails/railties/guides/images/polymorphic.png +0 -0
- data/vendor/rails/railties/guides/images/posts_index.png +0 -0
- data/vendor/rails/railties/guides/images/rails_guides_logo.gif +0 -0
- data/vendor/rails/railties/guides/images/rails_logo_remix.gif +0 -0
- data/vendor/rails/railties/guides/images/rails_welcome.png +0 -0
- data/vendor/rails/railties/guides/images/session_fixation.png +0 -0
- data/vendor/rails/railties/guides/images/tab_grey.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_info.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_note.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_red.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_yellow.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_yellow.png +0 -0
- data/vendor/rails/railties/guides/images/validation_error_messages.png +0 -0
- data/vendor/rails/railties/guides/rails_guides.rb +42 -0
- data/vendor/rails/railties/guides/rails_guides/generator.rb +138 -0
- data/vendor/rails/railties/guides/rails_guides/helpers.rb +34 -0
- data/vendor/rails/railties/guides/rails_guides/indexer.rb +55 -0
- data/vendor/rails/railties/guides/rails_guides/textile_extensions.rb +41 -0
- data/vendor/rails/railties/guides/source/2_2_release_notes.textile +422 -0
- data/vendor/rails/railties/guides/source/2_3_release_notes.textile +610 -0
- data/vendor/rails/railties/guides/source/action_controller_overview.textile +776 -0
- data/vendor/rails/railties/guides/source/action_mailer_basics.textile +424 -0
- data/vendor/rails/railties/guides/source/active_record_basics.textile +135 -0
- data/vendor/rails/railties/guides/source/active_record_querying.textile +969 -0
- data/vendor/rails/railties/guides/source/activerecord_validations_callbacks.textile +1086 -0
- data/vendor/rails/railties/guides/source/association_basics.textile +1781 -0
- data/vendor/rails/railties/guides/source/caching_with_rails.textile +524 -0
- data/vendor/rails/railties/guides/source/command_line.textile +589 -0
- data/vendor/rails/railties/guides/source/configuring.textile +234 -0
- data/vendor/rails/railties/guides/source/contribute.textile +71 -0
- data/vendor/rails/railties/guides/source/contributing_to_rails.textile +239 -0
- data/vendor/rails/railties/guides/source/credits.erb.textile +52 -0
- data/vendor/rails/railties/guides/source/debugging_rails_applications.textile +709 -0
- data/vendor/rails/railties/guides/source/form_helpers.textile +766 -0
- data/vendor/rails/railties/guides/source/getting_started.textile +1297 -0
- data/vendor/rails/railties/guides/source/i18n.textile +912 -0
- data/vendor/rails/railties/guides/source/index.erb.textile +124 -0
- data/vendor/rails/railties/guides/source/layout.html.erb +103 -0
- data/vendor/rails/railties/guides/source/layouts_and_rendering.textile +979 -0
- data/vendor/rails/railties/guides/source/migrations.textile +591 -0
- data/vendor/rails/railties/guides/source/nested_model_forms.textile +222 -0
- data/vendor/rails/railties/guides/source/performance_testing.textile +531 -0
- data/vendor/rails/railties/guides/source/plugins.textile +1512 -0
- data/vendor/rails/railties/guides/source/rails_on_rack.textile +309 -0
- data/vendor/rails/railties/guides/source/routing.textile +903 -0
- data/vendor/rails/railties/guides/source/security.textile +986 -0
- data/vendor/rails/railties/guides/source/testing.textile +951 -0
- data/vendor/rails/railties/lib/commands/dbconsole.rb +8 -4
- data/vendor/rails/railties/lib/commands/performance/profiler.rb +1 -1
- data/vendor/rails/railties/lib/initializer.rb +27 -4
- data/vendor/rails/railties/lib/rails/gem_dependency.rb +35 -6
- data/vendor/rails/railties/lib/rails/plugin.rb +12 -0
- data/vendor/rails/railties/lib/rails/plugin/loader.rb +7 -0
- data/vendor/rails/railties/lib/rails/rack/metal.rb +1 -1
- data/vendor/rails/railties/lib/rails/version.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/base.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb +5 -0
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/template_runner.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/model_generator.rb +9 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +1 -0
- data/vendor/rails/railties/lib/tasks/databases.rake +17 -4
- data/vendor/rails/railties/lib/tasks/gems.rake +19 -6
- data/vendor/rails/railties/lib/tasks/routes.rake +4 -3
- data/vendor/rails/railties/lib/test_help.rb +4 -1
- metadata +158 -58
- data/spec/lib/local_time_spec.rb +0 -40
- data/vendor/rails/actionpack/lib/action_controller/rewindable_input.rb +0 -28
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb +0 -89
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/adapter/camping.rb +0 -22
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb +0 -37
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/request.rb +0 -37
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/basic.rb +0 -58
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/md5.rb +0 -124
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/nonce.rb +0 -51
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/params.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/request.rb +0 -40
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/openid.rb +0 -480
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/builder.rb +0 -63
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/cascade.rb +0 -36
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/chunked.rb +0 -49
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/commonlogger.rb +0 -61
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/conditionalget.rb +0 -45
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb +0 -29
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb +0 -23
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb +0 -85
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/directory.rb +0 -153
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb +0 -88
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler.rb +0 -48
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/cgi.rb +0 -61
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/evented_mongrel.rb +0 -8
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/fastcgi.rb +0 -89
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/lsws.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb +0 -84
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/scgi.rb +0 -59
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/thin.rb +0 -18
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb +0 -67
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/head.rb +0 -19
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb +0 -462
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lobster.rb +0 -65
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lock.rb +0 -16
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb +0 -27
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/mime.rb +0 -204
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/mock.rb +0 -160
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/recursive.rb +0 -57
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/reloader.rb +0 -64
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/request.rb +0 -241
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/response.rb +0 -179
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/abstract/id.rb +0 -142
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/cookie.rb +0 -91
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/memcache.rb +0 -109
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/pool.rb +0 -100
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/showexceptions.rb +0 -349
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/showstatus.rb +0 -106
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/static.rb +0 -38
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb +0 -392
data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/params.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
module Auth
|
3
|
-
module Digest
|
4
|
-
class Params < Hash
|
5
|
-
|
6
|
-
def self.parse(str)
|
7
|
-
split_header_value(str).inject(new) do |header, param|
|
8
|
-
k, v = param.split('=', 2)
|
9
|
-
header[k] = dequote(v)
|
10
|
-
header
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.dequote(str) # From WEBrick::HTTPUtils
|
15
|
-
ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup
|
16
|
-
ret.gsub!(/\\(.)/, "\\1")
|
17
|
-
ret
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.split_header_value(str)
|
21
|
-
str.scan( /(\w+\=(?:"[^\"]+"|[^,]+))/n ).collect{ |v| v[0] }
|
22
|
-
end
|
23
|
-
|
24
|
-
def initialize
|
25
|
-
super
|
26
|
-
|
27
|
-
yield self if block_given?
|
28
|
-
end
|
29
|
-
|
30
|
-
def [](k)
|
31
|
-
super k.to_s
|
32
|
-
end
|
33
|
-
|
34
|
-
def []=(k, v)
|
35
|
-
super k.to_s, v.to_s
|
36
|
-
end
|
37
|
-
|
38
|
-
UNQUOTED = ['qop', 'nc', 'stale']
|
39
|
-
|
40
|
-
def to_s
|
41
|
-
inject([]) do |parts, (k, v)|
|
42
|
-
parts << "#{k}=" + (UNQUOTED.include?(k) ? v.to_s : quote(v))
|
43
|
-
parts
|
44
|
-
end.join(', ')
|
45
|
-
end
|
46
|
-
|
47
|
-
def quote(str) # From WEBrick::HTTPUtils
|
48
|
-
'"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/request.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'rack/auth/abstract/request'
|
2
|
-
require 'rack/auth/digest/params'
|
3
|
-
require 'rack/auth/digest/nonce'
|
4
|
-
|
5
|
-
module Rack
|
6
|
-
module Auth
|
7
|
-
module Digest
|
8
|
-
class Request < Auth::AbstractRequest
|
9
|
-
|
10
|
-
def method
|
11
|
-
@env['rack.methodoverride.original_method'] || @env['REQUEST_METHOD']
|
12
|
-
end
|
13
|
-
|
14
|
-
def digest?
|
15
|
-
:digest == scheme
|
16
|
-
end
|
17
|
-
|
18
|
-
def correct_uri?
|
19
|
-
(@env['SCRIPT_NAME'].to_s + @env['PATH_INFO'].to_s) == uri
|
20
|
-
end
|
21
|
-
|
22
|
-
def nonce
|
23
|
-
@nonce ||= Nonce.parse(params['nonce'])
|
24
|
-
end
|
25
|
-
|
26
|
-
def params
|
27
|
-
@params ||= Params.parse(parts.last)
|
28
|
-
end
|
29
|
-
|
30
|
-
def method_missing(sym)
|
31
|
-
if params.has_key? key = sym.to_s
|
32
|
-
return params[key]
|
33
|
-
end
|
34
|
-
super
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,480 +0,0 @@
|
|
1
|
-
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
|
2
|
-
|
3
|
-
gem 'ruby-openid', '~> 2' if defined? Gem
|
4
|
-
require 'rack/request'
|
5
|
-
require 'rack/utils'
|
6
|
-
require 'rack/auth/abstract/handler'
|
7
|
-
require 'uri'
|
8
|
-
require 'openid' #gem
|
9
|
-
require 'openid/extension' #gem
|
10
|
-
require 'openid/store/memory' #gem
|
11
|
-
|
12
|
-
module Rack
|
13
|
-
class Request
|
14
|
-
def openid_request
|
15
|
-
@env['rack.auth.openid.request']
|
16
|
-
end
|
17
|
-
|
18
|
-
def openid_response
|
19
|
-
@env['rack.auth.openid.response']
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module Auth
|
24
|
-
|
25
|
-
# Rack::Auth::OpenID provides a simple method for setting up an OpenID
|
26
|
-
# Consumer. It requires the ruby-openid library from janrain to operate,
|
27
|
-
# as well as a rack method of session management.
|
28
|
-
#
|
29
|
-
# The ruby-openid home page is at http://openidenabled.com/ruby-openid/.
|
30
|
-
#
|
31
|
-
# The OpenID specifications can be found at
|
32
|
-
# http://openid.net/specs/openid-authentication-1_1.html
|
33
|
-
# and
|
34
|
-
# http://openid.net/specs/openid-authentication-2_0.html. Documentation
|
35
|
-
# for published OpenID extensions and related topics can be found at
|
36
|
-
# http://openid.net/developers/specs/.
|
37
|
-
#
|
38
|
-
# It is recommended to read through the OpenID spec, as well as
|
39
|
-
# ruby-openid's documentation, to understand what exactly goes on. However
|
40
|
-
# a setup as simple as the presented examples is enough to provide
|
41
|
-
# Consumer functionality.
|
42
|
-
#
|
43
|
-
# This library strongly intends to utilize the OpenID 2.0 features of the
|
44
|
-
# ruby-openid library, which provides OpenID 1.0 compatiblity.
|
45
|
-
#
|
46
|
-
# NOTE: Due to the amount of data that this library stores in the
|
47
|
-
# session, Rack::Session::Cookie may fault.
|
48
|
-
|
49
|
-
class OpenID
|
50
|
-
|
51
|
-
class NoSession < RuntimeError; end
|
52
|
-
class BadExtension < RuntimeError; end
|
53
|
-
# Required for ruby-openid
|
54
|
-
ValidStatus = [:success, :setup_needed, :cancel, :failure]
|
55
|
-
|
56
|
-
# = Arguments
|
57
|
-
#
|
58
|
-
# The first argument is the realm, identifying the site they are trusting
|
59
|
-
# with their identity. This is required, also treated as the trust_root
|
60
|
-
# in OpenID 1.x exchanges.
|
61
|
-
#
|
62
|
-
# The optional second argument is a hash of options.
|
63
|
-
#
|
64
|
-
# == Options
|
65
|
-
#
|
66
|
-
# <tt>:return_to</tt> defines the url to return to after the client
|
67
|
-
# authenticates with the openid service provider. This url should point
|
68
|
-
# to where Rack::Auth::OpenID is mounted. If <tt>:return_to</tt> is not
|
69
|
-
# provided, return_to will be the current url which allows flexibility
|
70
|
-
# with caveats.
|
71
|
-
#
|
72
|
-
# <tt>:session_key</tt> defines the key to the session hash in the env.
|
73
|
-
# It defaults to 'rack.session'.
|
74
|
-
#
|
75
|
-
# <tt>:openid_param</tt> defines at what key in the request parameters to
|
76
|
-
# find the identifier to resolve. As per the 2.0 spec, the default is
|
77
|
-
# 'openid_identifier'.
|
78
|
-
#
|
79
|
-
# <tt>:store</tt> defined what OpenID Store to use for persistant
|
80
|
-
# information. By default a Store::Memory will be used.
|
81
|
-
#
|
82
|
-
# <tt>:immediate</tt> as true will make initial requests to be of an
|
83
|
-
# immediate type. This is false by default. See OpenID specification
|
84
|
-
# documentation.
|
85
|
-
#
|
86
|
-
# <tt>:extensions</tt> should be a hash of openid extension
|
87
|
-
# implementations. The key should be the extension main module, the value
|
88
|
-
# should be an array of arguments for extension::Request.new.
|
89
|
-
# The hash is iterated over and passed to #add_extension for processing.
|
90
|
-
# Please see #add_extension for further documentation.
|
91
|
-
#
|
92
|
-
# == Examples
|
93
|
-
#
|
94
|
-
# simple_oid = OpenID.new('http://mysite.com/')
|
95
|
-
#
|
96
|
-
# return_oid = OpenID.new('http://mysite.com/', {
|
97
|
-
# :return_to => 'http://mysite.com/openid'
|
98
|
-
# })
|
99
|
-
#
|
100
|
-
# complex_oid = OpenID.new('http://mysite.com/',
|
101
|
-
# :immediate => true,
|
102
|
-
# :extensions => {
|
103
|
-
# ::OpenID::SReg => [['email'],['nickname']]
|
104
|
-
# }
|
105
|
-
# )
|
106
|
-
#
|
107
|
-
# = Advanced
|
108
|
-
#
|
109
|
-
# Most of the functionality of this library is encapsulated such that
|
110
|
-
# expansion and overriding functions isn't difficult nor tricky.
|
111
|
-
# Alternately, to avoid opening up singleton objects or subclassing, a
|
112
|
-
# wrapper rack middleware can be composed to act upon Auth::OpenID's
|
113
|
-
# responses. See #check and #finish for locations of pertinent data.
|
114
|
-
#
|
115
|
-
# == Responses
|
116
|
-
#
|
117
|
-
# To change the responses that Auth::OpenID returns, override the methods
|
118
|
-
# #redirect, #bad_request, #unauthorized, #access_denied, and
|
119
|
-
# #foreign_server_failure.
|
120
|
-
#
|
121
|
-
# Additionally #confirm_post_params is used when the URI would exceed
|
122
|
-
# length limits on a GET request when doing the initial verification
|
123
|
-
# request.
|
124
|
-
#
|
125
|
-
# == Processing
|
126
|
-
#
|
127
|
-
# To change methods of processing completed transactions, override the
|
128
|
-
# methods #success, #setup_needed, #cancel, and #failure. Please ensure
|
129
|
-
# the returned object is a rack compatible response.
|
130
|
-
#
|
131
|
-
# The first argument is an OpenID::Response, the second is a
|
132
|
-
# Rack::Request of the current request, the last is the hash used in
|
133
|
-
# ruby-openid handling, which can be found manually at
|
134
|
-
# env['rack.session'][:openid].
|
135
|
-
#
|
136
|
-
# This is useful if you wanted to expand the processing done, such as
|
137
|
-
# setting up user accounts.
|
138
|
-
#
|
139
|
-
# oid_app = Rack::Auth::OpenID.new realm, :return_to => return_to
|
140
|
-
# def oid_app.success oid, request, session
|
141
|
-
# user = Models::User[oid.identity_url]
|
142
|
-
# user ||= Models::User.create_from_openid oid
|
143
|
-
# request['rack.session'][:user] = user.id
|
144
|
-
# redirect MyApp.site_home
|
145
|
-
# end
|
146
|
-
#
|
147
|
-
# site_map['/openid'] = oid_app
|
148
|
-
# map = Rack::URLMap.new site_map
|
149
|
-
# ...
|
150
|
-
|
151
|
-
def initialize(realm, options={})
|
152
|
-
realm = URI(realm)
|
153
|
-
raise ArgumentError, "Invalid realm: #{realm}" \
|
154
|
-
unless realm.absolute? \
|
155
|
-
and realm.fragment.nil? \
|
156
|
-
and realm.scheme =~ /^https?$/ \
|
157
|
-
and realm.host =~ /^(\*\.)?#{URI::REGEXP::PATTERN::URIC_NO_SLASH}+/
|
158
|
-
realm.path = '/' if realm.path.empty?
|
159
|
-
@realm = realm.to_s
|
160
|
-
|
161
|
-
if ruri = options[:return_to]
|
162
|
-
ruri = URI(ruri)
|
163
|
-
raise ArgumentError, "Invalid return_to: #{ruri}" \
|
164
|
-
unless ruri.absolute? \
|
165
|
-
and ruri.scheme =~ /^https?$/ \
|
166
|
-
and ruri.fragment.nil?
|
167
|
-
raise ArgumentError, "return_to #{ruri} not within realm #{realm}" \
|
168
|
-
unless self.within_realm?(ruri)
|
169
|
-
@return_to = ruri.to_s
|
170
|
-
end
|
171
|
-
|
172
|
-
@session_key = options[:session_key] || 'rack.session'
|
173
|
-
@openid_param = options[:openid_param] || 'openid_identifier'
|
174
|
-
@store = options[:store] || ::OpenID::Store::Memory.new
|
175
|
-
@immediate = !!options[:immediate]
|
176
|
-
|
177
|
-
@extensions = {}
|
178
|
-
if extensions = options.delete(:extensions)
|
179
|
-
extensions.each do |ext, args|
|
180
|
-
add_extension ext, *args
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
# Undocumented, semi-experimental
|
185
|
-
@anonymous = !!options[:anonymous]
|
186
|
-
end
|
187
|
-
|
188
|
-
attr_reader :realm, :return_to, :session_key, :openid_param, :store,
|
189
|
-
:immediate, :extensions
|
190
|
-
|
191
|
-
# Sets up and uses session data at <tt>:openid</tt> within the session.
|
192
|
-
# Errors in this setup will raise a NoSession exception.
|
193
|
-
#
|
194
|
-
# If the parameter 'openid.mode' is set, which implies a followup from
|
195
|
-
# the openid server, processing is passed to #finish and the result is
|
196
|
-
# returned. However, if there is no appropriate openid information in the
|
197
|
-
# session, a 400 error is returned.
|
198
|
-
#
|
199
|
-
# If the parameter specified by <tt>options[:openid_param]</tt> is
|
200
|
-
# present, processing is passed to #check and the result is returned.
|
201
|
-
#
|
202
|
-
# If neither of these conditions are met, #unauthorized is called.
|
203
|
-
|
204
|
-
def call(env)
|
205
|
-
env['rack.auth.openid'] = self
|
206
|
-
env_session = env[@session_key]
|
207
|
-
unless env_session and env_session.is_a?(Hash)
|
208
|
-
raise NoSession, 'No compatible session'
|
209
|
-
end
|
210
|
-
# let us work in our own namespace...
|
211
|
-
session = (env_session[:openid] ||= {})
|
212
|
-
unless session and session.is_a?(Hash)
|
213
|
-
raise NoSession, 'Incompatible openid session'
|
214
|
-
end
|
215
|
-
|
216
|
-
request = Rack::Request.new(env)
|
217
|
-
consumer = ::OpenID::Consumer.new(session, @store)
|
218
|
-
|
219
|
-
if mode = request.GET['openid.mode']
|
220
|
-
if session.key?(:openid_param)
|
221
|
-
finish(consumer, session, request)
|
222
|
-
else
|
223
|
-
bad_request
|
224
|
-
end
|
225
|
-
elsif request.GET[@openid_param]
|
226
|
-
check(consumer, session, request)
|
227
|
-
else
|
228
|
-
unauthorized
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
# As the first part of OpenID consumer action, #check retrieves the data
|
233
|
-
# required for completion.
|
234
|
-
#
|
235
|
-
# If all parameters fit within the max length of a URI, a 303 redirect
|
236
|
-
# will be returned. Otherwise #confirm_post_params will be called.
|
237
|
-
#
|
238
|
-
# Any messages from OpenID's request are logged to env['rack.errors']
|
239
|
-
#
|
240
|
-
# <tt>env['rack.auth.openid.request']</tt> is the openid checkid request
|
241
|
-
# instance.
|
242
|
-
#
|
243
|
-
# <tt>session[:openid_param]</tt> is set to the openid identifier
|
244
|
-
# provided by the user.
|
245
|
-
#
|
246
|
-
# <tt>session[:return_to]</tt> is set to the return_to uri given to the
|
247
|
-
# identity provider.
|
248
|
-
|
249
|
-
def check(consumer, session, req)
|
250
|
-
oid = consumer.begin(req.GET[@openid_param], @anonymous)
|
251
|
-
req.env['rack.auth.openid.request'] = oid
|
252
|
-
req.env['rack.errors'].puts(oid.message)
|
253
|
-
p oid if $DEBUG
|
254
|
-
|
255
|
-
## Extension support
|
256
|
-
extensions.each do |ext,args|
|
257
|
-
oid.add_extension(ext::Request.new(*args))
|
258
|
-
end
|
259
|
-
|
260
|
-
session[:openid_param] = req.GET[openid_param]
|
261
|
-
return_to_uri = return_to ? return_to : req.url
|
262
|
-
session[:return_to] = return_to_uri
|
263
|
-
immediate = session.key?(:setup_needed) ? false : immediate
|
264
|
-
|
265
|
-
if oid.send_redirect?(realm, return_to_uri, immediate)
|
266
|
-
uri = oid.redirect_url(realm, return_to_uri, immediate)
|
267
|
-
redirect(uri)
|
268
|
-
else
|
269
|
-
confirm_post_params(oid, realm, return_to_uri, immediate)
|
270
|
-
end
|
271
|
-
rescue ::OpenID::DiscoveryFailure => e
|
272
|
-
# thrown from inside OpenID::Consumer#begin by yadis stuff
|
273
|
-
req.env['rack.errors'].puts([e.message, *e.backtrace]*"\n")
|
274
|
-
return foreign_server_failure
|
275
|
-
end
|
276
|
-
|
277
|
-
# This is the final portion of authentication.
|
278
|
-
# If successful, a redirect to the realm is be returned.
|
279
|
-
# Data gathered from extensions are stored in session[:openid] with the
|
280
|
-
# extension's namespace uri as the key.
|
281
|
-
#
|
282
|
-
# Any messages from OpenID's response are logged to env['rack.errors']
|
283
|
-
#
|
284
|
-
# <tt>env['rack.auth.openid.response']</tt> will contain the openid
|
285
|
-
# response.
|
286
|
-
|
287
|
-
def finish(consumer, session, req)
|
288
|
-
oid = consumer.complete(req.GET, req.url)
|
289
|
-
req.env['rack.auth.openid.response'] = oid
|
290
|
-
req.env['rack.errors'].puts(oid.message)
|
291
|
-
p oid if $DEBUG
|
292
|
-
|
293
|
-
raise unless ValidStatus.include?(oid.status)
|
294
|
-
__send__(oid.status, oid, req, session)
|
295
|
-
end
|
296
|
-
|
297
|
-
# The first argument should be the main extension module.
|
298
|
-
# The extension module should contain the constants:
|
299
|
-
# * class Request, should have OpenID::Extension as an ancestor
|
300
|
-
# * class Response, should have OpenID::Extension as an ancestor
|
301
|
-
# * string NS_URI, which defining the namespace of the extension
|
302
|
-
#
|
303
|
-
# All trailing arguments will be passed to extension::Request.new in
|
304
|
-
# #check.
|
305
|
-
# The openid response will be passed to
|
306
|
-
# extension::Response#from_success_response, #get_extension_args will be
|
307
|
-
# called on the result to attain the gathered data.
|
308
|
-
#
|
309
|
-
# This method returns the key at which the response data will be found in
|
310
|
-
# the session, which is the namespace uri by default.
|
311
|
-
|
312
|
-
def add_extension(ext, *args)
|
313
|
-
raise BadExtension unless valid_extension?(ext)
|
314
|
-
extensions[ext] = args
|
315
|
-
return ext::NS_URI
|
316
|
-
end
|
317
|
-
|
318
|
-
# Checks the validitity, in the context of usage, of a submitted
|
319
|
-
# extension.
|
320
|
-
|
321
|
-
def valid_extension?(ext)
|
322
|
-
if not %w[NS_URI Request Response].all?{|c| ext.const_defined?(c) }
|
323
|
-
raise ArgumentError, 'Extension is missing constants.'
|
324
|
-
elsif not ext::Response.respond_to?(:from_success_response)
|
325
|
-
raise ArgumentError, 'Response is missing required method.'
|
326
|
-
end
|
327
|
-
return true
|
328
|
-
rescue
|
329
|
-
return false
|
330
|
-
end
|
331
|
-
|
332
|
-
# Checks the provided uri to ensure it'd be considered within the realm.
|
333
|
-
# is currently not compatible with wildcard realms.
|
334
|
-
|
335
|
-
def within_realm? uri
|
336
|
-
uri = URI.parse(uri.to_s)
|
337
|
-
realm = URI.parse(self.realm)
|
338
|
-
return false unless uri.absolute?
|
339
|
-
return false unless uri.path[0, realm.path.size] == realm.path
|
340
|
-
return false unless uri.host == realm.host or realm.host[/^\*\./]
|
341
|
-
# for wildcard support, is awkward with URI limitations
|
342
|
-
realm_match = Regexp.escape(realm.host).
|
343
|
-
sub(/^\*\./,"^#{URI::REGEXP::PATTERN::URIC_NO_SLASH}+.")+'$'
|
344
|
-
return false unless uri.host.match(realm_match)
|
345
|
-
return true
|
346
|
-
end
|
347
|
-
alias_method :include?, :within_realm?
|
348
|
-
|
349
|
-
protected
|
350
|
-
|
351
|
-
### These methods define some of the boilerplate responses.
|
352
|
-
|
353
|
-
# Returns an html form page for posting to an Identity Provider if the
|
354
|
-
# GET request would exceed the upper URI length limit.
|
355
|
-
|
356
|
-
def confirm_post_params(oid, realm, return_to, immediate)
|
357
|
-
Rack::Response.new.finish do |r|
|
358
|
-
r.write '<html><head><title>Confirm...</title></head><body>'
|
359
|
-
r.write oid.form_markup(realm, return_to, immediate)
|
360
|
-
r.write '</body></html>'
|
361
|
-
end
|
362
|
-
end
|
363
|
-
|
364
|
-
# Returns a 303 redirect with the destination of that provided by the
|
365
|
-
# argument.
|
366
|
-
|
367
|
-
def redirect(uri)
|
368
|
-
[ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',
|
369
|
-
'Location' => uri},
|
370
|
-
[] ]
|
371
|
-
end
|
372
|
-
|
373
|
-
# Returns an empty 400 response.
|
374
|
-
|
375
|
-
def bad_request
|
376
|
-
[ 400, {'Content-Type'=>'text/plain', 'Content-Length'=>'0'},
|
377
|
-
[''] ]
|
378
|
-
end
|
379
|
-
|
380
|
-
# Returns a basic unauthorized 401 response.
|
381
|
-
|
382
|
-
def unauthorized
|
383
|
-
[ 401, {'Content-Type' => 'text/plain', 'Content-Length' => '13'},
|
384
|
-
['Unauthorized.'] ]
|
385
|
-
end
|
386
|
-
|
387
|
-
# Returns a basic access denied 403 response.
|
388
|
-
|
389
|
-
def access_denied
|
390
|
-
[ 403, {'Content-Type' => 'text/plain', 'Content-Length' => '14'},
|
391
|
-
['Access denied.'] ]
|
392
|
-
end
|
393
|
-
|
394
|
-
# Returns a 503 response to be used if communication with the remote
|
395
|
-
# OpenID server fails.
|
396
|
-
|
397
|
-
def foreign_server_failure
|
398
|
-
[ 503, {'Content-Type'=>'text/plain', 'Content-Length' => '23'},
|
399
|
-
['Foreign server failure.'] ]
|
400
|
-
end
|
401
|
-
|
402
|
-
private
|
403
|
-
|
404
|
-
### These methods are called after a transaction is completed, depending
|
405
|
-
# on its outcome. These should all return a rack compatible response.
|
406
|
-
# You'd want to override these to provide additional functionality.
|
407
|
-
|
408
|
-
# Called to complete processing on a successful transaction.
|
409
|
-
# Within the openid session, :openid_identity and :openid_identifier are
|
410
|
-
# set to the user friendly and the standard representation of the
|
411
|
-
# validated identity. All other data in the openid session is cleared.
|
412
|
-
|
413
|
-
def success(oid, request, session)
|
414
|
-
session.clear
|
415
|
-
session[:openid_identity] = oid.display_identifier
|
416
|
-
session[:openid_identifier] = oid.identity_url
|
417
|
-
extensions.keys.each do |ext|
|
418
|
-
label = ext.name[/[^:]+$/].downcase
|
419
|
-
response = ext::Response.from_success_response(oid)
|
420
|
-
session[label] = response.data
|
421
|
-
end
|
422
|
-
redirect(realm)
|
423
|
-
end
|
424
|
-
|
425
|
-
# Called if the Identity Provider indicates further setup by the user is
|
426
|
-
# required.
|
427
|
-
# The identifier is retrived from the openid session at :openid_param.
|
428
|
-
# And :setup_needed is set to true to prevent looping.
|
429
|
-
|
430
|
-
def setup_needed(oid, request, session)
|
431
|
-
identifier = session[:openid_param]
|
432
|
-
session[:setup_needed] = true
|
433
|
-
redirect req.script_name + '?' + openid_param + '=' + identifier
|
434
|
-
end
|
435
|
-
|
436
|
-
# Called if the user indicates they wish to cancel identification.
|
437
|
-
# Data within openid session is cleared.
|
438
|
-
|
439
|
-
def cancel(oid, request, session)
|
440
|
-
session.clear
|
441
|
-
access_denied
|
442
|
-
end
|
443
|
-
|
444
|
-
# Called if the Identity Provider indicates the user is unable to confirm
|
445
|
-
# their identity. Data within the openid session is left alone, in case
|
446
|
-
# of swarm auth attacks.
|
447
|
-
|
448
|
-
def failure(oid, request, session)
|
449
|
-
unauthorized
|
450
|
-
end
|
451
|
-
end
|
452
|
-
|
453
|
-
# A class developed out of the request to use OpenID as an authentication
|
454
|
-
# middleware. The request will be sent to the OpenID instance unless the
|
455
|
-
# block evaluates to true. For example in rackup, you can use it as such:
|
456
|
-
#
|
457
|
-
# use Rack::Session::Pool
|
458
|
-
# use Rack::Auth::OpenIDAuth, realm, openid_options do |env|
|
459
|
-
# env['rack.session'][:authkey] == a_string
|
460
|
-
# end
|
461
|
-
# run RackApp
|
462
|
-
#
|
463
|
-
# Or simply:
|
464
|
-
#
|
465
|
-
# app = Rack::Auth::OpenIDAuth.new app, realm, openid_options, &auth
|
466
|
-
|
467
|
-
class OpenIDAuth < Rack::Auth::AbstractHandler
|
468
|
-
attr_reader :oid
|
469
|
-
def initialize(app, realm, options={}, &auth)
|
470
|
-
@oid = OpenID.new(realm, options)
|
471
|
-
super(app, &auth)
|
472
|
-
end
|
473
|
-
|
474
|
-
def call(env)
|
475
|
-
to = auth.call(env) ? @app : @oid
|
476
|
-
to.call env
|
477
|
-
end
|
478
|
-
end
|
479
|
-
end
|
480
|
-
end
|