hydra-head 3.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +71 -0
- data/.gitmodules +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +257 -0
- data/README.textile +150 -0
- data/README_RAILS3_CHANGES.textile +42 -0
- data/Rakefile +5 -0
- data/TESTING.textile +85 -0
- data/app/controllers/assets_controller.rb +117 -0
- data/app/controllers/contributors_controller.rb +54 -0
- data/app/controllers/file_assets_controller.rb +152 -0
- data/app/controllers/permissions_controller.rb +137 -0
- data/app/controllers/user_sessions_controller.rb +14 -0
- data/app/helpers/article_metadata_helper.rb +80 -0
- data/app/helpers/blacklight_helper.rb +192 -0
- data/app/helpers/downloads_helper.rb +19 -0
- data/app/helpers/generic_content_objects_helper.rb +16 -0
- data/app/helpers/hydra_assets_helper.rb +75 -0
- data/app/helpers/hydra_djatoka_helper.rb +23 -0
- data/app/helpers/hydra_fedora_metadata_helper.rb +365 -0
- data/app/helpers/hydra_helper.rb +155 -0
- data/app/helpers/hydra_uploader_helper.rb +18 -0
- data/app/helpers/inline_editable_metadata_helper.rb +15 -0
- data/app/helpers/javascript_includes_helper.rb +93 -0
- data/app/helpers/release_process_helper.rb +32 -0
- data/app/models/audio_asset.rb +8 -0
- data/app/models/file_asset.rb +111 -0
- data/app/models/generic_content.rb +21 -0
- data/app/models/generic_image.rb +62 -0
- data/app/models/image_asset.rb +8 -0
- data/app/models/mods_asset.rb +6 -0
- data/app/models/role_mapper.rb +22 -0
- data/app/models/superuser.rb +6 -0
- data/app/models/video_asset.rb +8 -0
- data/app/views/_add_assets_links.html.erb +13 -0
- data/app/views/_brown_sidebar.html +15 -0
- data/app/views/_user_util_links.html.erb +31 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints_element.html.erb +34 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_document_list.html.erb +11 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +64 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_email_form.html.erb +9 -0
- data/app/views/catalog/_facets.html.erb +37 -0
- data/app/views/catalog/_flash_msg.html.erb +17 -0
- data/app/views/catalog/_home.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_partials/_default.html.erb +20 -0
- data/app/views/catalog/_index_partials/_default_details.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +15 -0
- data/app/views/catalog/_search_form.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +23 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +12 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +22 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/show.html.erb +48 -0
- data/app/views/contributors/_add_contributor_split_button.html.erb +10 -0
- data/app/views/contributors/_edit_conference.html.erb +29 -0
- data/app/views/contributors/_edit_organization.html.erb +29 -0
- data/app/views/contributors/_edit_person.html.erb +42 -0
- data/app/views/contributors/_index.html.erb +12 -0
- data/app/views/contributors/_new.html.erb +10 -0
- data/app/views/contributors/_show_conference.html.erb +22 -0
- data/app/views/contributors/_show_organization.html.erb +29 -0
- data/app/views/contributors/_show_person.html.erb +17 -0
- data/app/views/contributors/new.html.erb +13 -0
- data/app/views/downloads/index.html.erb +1 -0
- data/app/views/file_assets/_deletable_result.html.erb +5 -0
- data/app/views/file_assets/_index.html.erb +15 -0
- data/app/views/file_assets/_new.html.erb +2 -0
- data/app/views/file_assets/_result.html.erb +16 -0
- data/app/views/file_assets/index.html.erb +5 -0
- data/app/views/fluid_infusion/_uploader.html.erb +81 -0
- data/app/views/fluid_infusion/_uploader_generic_content_objects.js.erb +38 -0
- data/app/views/fluid_infusion/_uploader_js.erb +45 -0
- data/app/views/generic_content_objects/_edit_description.html.erb +50 -0
- data/app/views/generic_content_objects/_new.html.erb +0 -0
- data/app/views/generic_content_objects/_show_description.html.erb +68 -0
- data/app/views/generic_content_objects/contributors/_edit_conference.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_organization.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_person.html.erb +37 -0
- data/app/views/generic_content_objects/contributors/_new.html.erb +10 -0
- data/app/views/generic_content_objects/contributors/_show_conference.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_organization.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_person.html.erb +38 -0
- data/app/views/generic_contents/_edit.html.erb +59 -0
- data/app/views/generic_contents/_index.html.erb +23 -0
- data/app/views/generic_contents/_show.html.erb +18 -0
- data/app/views/generic_contents/_show_content.html.erb +4 -0
- data/app/views/generic_images/_edit.html.erb +59 -0
- data/app/views/generic_images/_index.html.erb +24 -0
- data/app/views/generic_images/_show.html.erb +18 -0
- data/app/views/generic_images/_show_all.html.erb +14 -0
- data/app/views/generic_images/_show_content.html.erb +7 -0
- data/app/views/layouts/application.html.erb +57 -0
- data/app/views/layouts/hydra-head.html.erb +12 -0
- data/app/views/mods_assets/_edit.html.erb +49 -0
- data/app/views/mods_assets/_edit_description.html.erb +82 -0
- data/app/views/mods_assets/_edit_journal.html.erb +72 -0
- data/app/views/mods_assets/_index.html.erb +1 -0
- data/app/views/mods_assets/_index_list.html.erb +37 -0
- data/app/views/mods_assets/_index_table.html.erb +7 -0
- data/app/views/mods_assets/_progress_box.html.erb +82 -0
- data/app/views/mods_assets/_show.html.erb +44 -0
- data/app/views/mods_assets/_show_description.html.erb +44 -0
- data/app/views/mods_assets/_show_journal.html.erb +42 -0
- data/app/views/mods_assets/_show_permissions.html.erb +14 -0
- data/app/views/permissions/_edit_person_permissions.html.erb +35 -0
- data/app/views/permissions/_index.html.erb +55 -0
- data/app/views/permissions/_new.html.erb +18 -0
- data/app/views/permissions/index.html.erb +1 -0
- data/app/views/permissions/new.html.erb +1 -0
- data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
- data/app/views/user_sessions/_login_form.html.erb +10 -0
- data/app/views/user_sessions/logged_out.html.erb +1 -0
- data/config/routes.rb +12 -0
- data/fedora_conf/conf/fedora.fcfg +1021 -0
- data/hydra-head.gemspec +70 -0
- data/lib/application_controller.rb +25 -0
- data/lib/application_helper.rb +2 -0
- data/lib/engine.rb +30 -0
- data/lib/generators/hydra/head_generator.rb +152 -0
- data/lib/generators/hydra/templates/config/fedora.yml +17 -0
- data/lib/generators/hydra/templates/config/initializers/blacklight_config.rb +246 -0
- data/lib/generators/hydra/templates/config/initializers/fedora_config.rb +23 -0
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +29 -0
- data/lib/generators/hydra/templates/config/role_map_cucumber.yml +10 -0
- data/lib/generators/hydra/templates/config/role_map_development.yml +12 -0
- data/lib/generators/hydra/templates/config/role_map_production.yml +2 -0
- data/lib/generators/hydra/templates/config/role_map_test.yml +15 -0
- data/lib/generators/hydra/templates/config/solr.yml +10 -0
- data/lib/generators/hydra/templates/config/solr_mappings.yml +22 -0
- data/lib/generators/hydra/templates/fedora_conf/conf/fedora.fcfg +1021 -0
- data/lib/generators/hydra/templates/migrations/add_user_attributes_table.rb +15 -0
- data/lib/generators/hydra/templates/migrations/create_superusers.rb +12 -0
- data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +118 -0
- data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +332 -0
- data/lib/generators/hydra/templates/solr_conf/solr.xml +35 -0
- data/lib/hydra-head.rb +29 -0
- data/lib/hydra-head/engine.rb +9 -0
- data/lib/hydra-head/routes.rb +87 -0
- data/lib/hydra-head/version.rb +4 -0
- data/lib/hydra.rb +22 -0
- data/lib/hydra/access_controls_enforcement.rb +236 -0
- data/lib/hydra/access_controls_evaluation.rb +97 -0
- data/lib/hydra/assets_controller_helper.rb +144 -0
- data/lib/hydra/catalog.rb +64 -0
- data/lib/hydra/common_mods_index_methods.rb +42 -0
- data/lib/hydra/controller.rb +7 -0
- data/lib/hydra/file_assets_helper.rb +144 -0
- data/lib/hydra/fixtures.rb +43 -0
- data/lib/hydra/generic_content.rb +113 -0
- data/lib/hydra/generic_image.rb +100 -0
- data/lib/hydra/image.rb +177 -0
- data/lib/hydra/model_methods.rb +95 -0
- data/lib/hydra/model_mixins.rb +2 -0
- data/lib/hydra/model_mixins/common_metadata.rb +24 -0
- data/lib/hydra/model_mixins/mods_object.rb +16 -0
- data/lib/hydra/mods_article.rb +505 -0
- data/lib/hydra/mods_dataset.rb +165 -0
- data/lib/hydra/mods_generic_content.rb +494 -0
- data/lib/hydra/mods_image.rb +494 -0
- data/lib/hydra/repository_controller.rb +102 -0
- data/lib/hydra/rights_metadata.rb +189 -0
- data/lib/hydra/superuser_attributes.rb +12 -0
- data/lib/hydra/testing_server.rb +183 -0
- data/lib/hydra/user.rb +22 -0
- data/lib/mediashelf/active_fedora_helper.rb +72 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/hydra-fixtures.rake +184 -0
- data/lib/railties/hydra_jetty.rake +79 -0
- data/lib/railties/hyhead_cucumber.rake +127 -0
- data/lib/railties/hyhead_rspec.rake +137 -0
- data/lib/stanford/searchworks_helper.rb +1338 -0
- data/lib/stanford/solr_helper.rb +108 -0
- data/lib/uva/mods_index_methods.rb +24 -0
- data/solr_conf/conf/schema.xml +122 -0
- data/solr_conf/conf/solrconfig.xml +332 -0
- data/solr_conf/solr.xml +35 -0
- data/tasks/hydra-head-fixtures.rake +54 -0
- data/tasks/hydra-head.rake +247 -0
- data/tasks/hydra_jetty.rake +79 -0
- data/tasks/replicator.rake +27 -0
- data/tasks/solrizer-fedora.rake +53 -0
- data/tasks/solrizer.rake +13 -0
- data/test_support/etc/Gemfile +29 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/button_add_assets.feature +22 -0
- data/test_support/features/button_add_generic_content.feature +11 -0
- data/test_support/features/button_add_image.feature +11 -0
- data/test_support/features/button_add_mods_asset.feature +11 -0
- data/test_support/features/contributor_add.feature +39 -0
- data/test_support/features/file_assets_list.feature +32 -0
- data/test_support/features/file_upload.feature +40 -0
- data/test_support/features/home_page.feature +9 -0
- data/test_support/features/html_validity.feature +47 -0
- data/test_support/features/mods_asset_contributors_edit.feature +80 -0
- data/test_support/features/mods_asset_create.feature +12 -0
- data/test_support/features/mods_asset_edit.feature +33 -0
- data/test_support/features/mods_asset_edit_without_permission.feature +10 -0
- data/test_support/features/mods_asset_search_result.feature +13 -0
- data/test_support/features/mods_asset_show.feature +39 -0
- data/test_support/features/permissions_add.feature +15 -0
- data/test_support/features/permissions_edit.feature +63 -0
- data/test_support/features/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/features/step_definitions/create_asset_steps.rb +7 -0
- data/test_support/features/step_definitions/edit_metadata_steps.rb +73 -0
- data/test_support/features/step_definitions/file_list_steps.rb +28 -0
- data/test_support/features/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/features/step_definitions/hydra_steps.rb +8 -0
- data/test_support/features/step_definitions/inline_editable_edit_steps.rb +77 -0
- data/test_support/features/step_definitions/search_steps.rb +88 -0
- data/test_support/features/step_definitions/searching_steps.rb +22 -0
- data/test_support/features/step_definitions/show_document_steps.rb +85 -0
- data/test_support/features/step_definitions/user_steps.rb +36 -0
- data/test_support/features/step_definitions/web_steps.rb +219 -0
- data/test_support/features/support/env.rb +55 -0
- data/test_support/features/support/paths.rb +80 -0
- data/test_support/features/switch_users.feature +14 -0
- data/test_support/features/view_catalog_index.feature +18 -0
- data/test_support/fixtures/empty_file.txt +0 -0
- data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +1212 -0
- data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
- data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +187 -0
- data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
- data/test_support/fixtures/image.jp2 +0 -0
- data/test_support/fixtures/libra-oa_1.foxml.xml +2324 -0
- data/test_support/fixtures/libra-oa_2.foxml.xml +2422 -0
- data/test_support/spec/controllers/assets_controller_spec.rb +113 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +148 -0
- data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +62 -0
- data/test_support/spec/controllers/contributors_controller_spec.rb +47 -0
- data/test_support/spec/controllers/file_assets_controller_spec.rb +189 -0
- data/test_support/spec/controllers/hydra_controller_spec.rb +15 -0
- data/test_support/spec/controllers/permissions_controller_spec.rb +80 -0
- data/test_support/spec/controllers/user_sessions_controller_spec.rb +35 -0
- data/test_support/spec/generators/hydra-head_generator_spec.rb +14 -0
- data/test_support/spec/helpers/access_controls_enforcement_spec.rb +212 -0
- data/test_support/spec/helpers/access_controls_evaluation_spec.rb +35 -0
- data/test_support/spec/helpers/assets_controller_helper_spec.rb +71 -0
- data/test_support/spec/helpers/blacklight_helper_spec.rb +64 -0
- data/test_support/spec/helpers/file_assets_helper_spec.rb +107 -0
- data/test_support/spec/helpers/hydra-repository_controller_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_assets_helper_spec.rb +195 -0
- data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +215 -0
- data/test_support/spec/helpers/hydra_helper_spec.rb +73 -0
- data/test_support/spec/helpers/hydra_model_methods_spec.rb +95 -0
- data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +18 -0
- data/test_support/spec/helpers/javascript_includes_helper_spec.rb +43 -0
- data/test_support/spec/integration/file_asset_spec.rb +150 -0
- data/test_support/spec/lib/active_fedora_helper_spec.rb +56 -0
- data/test_support/spec/lib/catalog_spec.rb +16 -0
- data/test_support/spec/lib/common_mods_index_methods_spec.rb +28 -0
- data/test_support/spec/models/audio_asset_spec.rb +23 -0
- data/test_support/spec/models/file_asset_spec.rb +42 -0
- data/test_support/spec/models/generic_content_spec.rb +29 -0
- data/test_support/spec/models/generic_image_spec.rb +58 -0
- data/test_support/spec/models/hydra_rights_metadata_spec.rb +162 -0
- data/test_support/spec/models/image_asset_spec.rb +23 -0
- data/test_support/spec/models/mods_asset_spec.rb +29 -0
- data/test_support/spec/models/role_mapper_spec.rb +22 -0
- data/test_support/spec/models/user_spec.rb +52 -0
- data/test_support/spec/models/video_asset_spec.rb +23 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +44 -0
- data/test_support/spec/support/matchers/helper_matcher.rb +14 -0
- data/test_support/spec/support/matchers/solr_matchers.rb +60 -0
- data/test_support/spec/unit/hydra-head-engine_spec.rb +8 -0
- data/test_support/spec/unit/hydra-head_spec.rb +8 -0
- data/test_support/spec/utilities/hydra_testing_server_spec.rb +49 -0
- data/test_support/spec/views/uploader.html.erb_spec.rb +30 -0
- data/vendor/cache/RedCloth-4.2.3.gem +0 -0
- data/vendor/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/actionmailer-3.0.9.gem +0 -0
- data/vendor/cache/actionpack-3.0.9.gem +0 -0
- data/vendor/cache/active-fedora-2.3.3.gem +0 -0
- data/vendor/cache/activemodel-3.0.9.gem +0 -0
- data/vendor/cache/activerecord-3.0.9.gem +0 -0
- data/vendor/cache/activeresource-3.0.9.gem +0 -0
- data/vendor/cache/activesupport-3.0.9.gem +0 -0
- data/vendor/cache/arel-2.0.10.gem +0 -0
- data/vendor/cache/blacklight-3.0.0.gem +0 -0
- data/vendor/cache/block_helpers-0.3.3.gem +0 -0
- data/vendor/cache/builder-2.1.2.gem +0 -0
- data/vendor/cache/capybara-1.0.0.gem +0 -0
- data/vendor/cache/childprocess-0.2.0.gem +0 -0
- data/vendor/cache/columnize-0.3.4.gem +0 -0
- data/vendor/cache/crack-0.1.8.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/cucumber-rails-1.0.2.gem +0 -0
- data/vendor/cache/curb-0.7.15.gem +0 -0
- data/vendor/cache/daemons-1.1.4.gem +0 -0
- data/vendor/cache/database_cleaner-0.6.7.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/equivalent-xml-0.2.7.gem +0 -0
- data/vendor/cache/erubis-2.6.6.gem +0 -0
- data/vendor/cache/facets-2.8.4.gem +0 -0
- data/vendor/cache/factory_girl-1.3.3.gem +0 -0
- data/vendor/cache/fastercsv-1.5.4.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.5.gem +0 -0
- data/vendor/cache/haml-3.1.2.gem +0 -0
- data/vendor/cache/httparty-0.7.8.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/jettywrapper-0.0.10.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/json_pure-1.5.3.gem +0 -0
- data/vendor/cache/kaminari-0.12.4.gem +0 -0
- data/vendor/cache/launchy-2.0.3.gem +0 -0
- data/vendor/cache/linecache-0.46.gem +0 -0
- data/vendor/cache/logger-1.2.8.gem +0 -0
- data/vendor/cache/mail-2.2.19.gem +0 -0
- data/vendor/cache/marc-0.4.3.gem +0 -0
- data/vendor/cache/mediashelf-loggable-0.4.2.gem +0 -0
- data/vendor/cache/mime-types-1.16.gem +0 -0
- data/vendor/cache/mocha-0.9.12.gem +0 -0
- data/vendor/cache/multipart-post-1.1.2.gem +0 -0
- data/vendor/cache/nokogiri-1.5.0.gem +0 -0
- data/vendor/cache/om-1.2.5.gem +0 -0
- data/vendor/cache/polyglot-0.3.1.gem +0 -0
- data/vendor/cache/rack-1.2.3.gem +0 -0
- data/vendor/cache/rack-mount-0.6.14.gem +0 -0
- data/vendor/cache/rack-test-0.5.7.gem +0 -0
- data/vendor/cache/rails-3.0.9.gem +0 -0
- data/vendor/cache/railties-3.0.9.gem +0 -0
- data/vendor/cache/rake-0.9.2.gem +0 -0
- data/vendor/cache/rbx-require-relative-0.0.5.gem +0 -0
- data/vendor/cache/rcov-0.9.9.gem +0 -0
- data/vendor/cache/rdoc-3.8.gem +0 -0
- data/vendor/cache/rsolr-1.0.2.gem +0 -0
- data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
- data/vendor/cache/rspec-2.6.0.gem +0 -0
- data/vendor/cache/rspec-core-2.6.4.gem +0 -0
- data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
- data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
- data/vendor/cache/ruby-debug-0.10.4.gem +0 -0
- data/vendor/cache/ruby-debug-base-0.10.4.gem +0 -0
- data/vendor/cache/rubyzip-0.9.4.gem +0 -0
- data/vendor/cache/sanitize-2.0.3.gem +0 -0
- data/vendor/cache/selenium-webdriver-0.2.2.gem +0 -0
- data/vendor/cache/solr-ruby-0.0.8.gem +0 -0
- data/vendor/cache/solrizer-1.1.0.gem +0 -0
- data/vendor/cache/solrizer-fedora-1.1.0.gem +0 -0
- data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
- data/vendor/cache/stomp-1.1.9.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/treetop-1.4.9.gem +0 -0
- data/vendor/cache/trollop-1.16.2.gem +0 -0
- data/vendor/cache/tzinfo-0.3.29.gem +0 -0
- data/vendor/cache/unicode-0.4.0.gem +0 -0
- data/vendor/cache/will_paginate-2.3.15.gem +0 -0
- data/vendor/cache/xml-simple-1.1.0.gem +0 -0
- data/vendor/cache/xpath-0.1.4.gem +0 -0
- data/vendor/cache/yard-0.7.2.gem +0 -0
- metadata +1110 -0
data/lib/hydra/user.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Injects behaviors into User model so that it will work with Hydra Access Controls
|
2
|
+
# By default, this module assumes you are using the User model created by Blacklight, which uses Devise.
|
3
|
+
# To integrate your own User implementation into Hydra, override this Module or define your own User model in app/models/user.rb within your Hydra head.
|
4
|
+
module Hydra::User
|
5
|
+
|
6
|
+
def self.included(klass)
|
7
|
+
# Other modules to auto-include
|
8
|
+
klass.send(:include, Hydra::SuperuserAttributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
# This method should display the unique identifier for this user
|
12
|
+
# the unique identifier is what access controls will be enforced against.
|
13
|
+
def unique_id
|
14
|
+
return to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
# For backwards compatibility with the Rails2 User models in Hydra/Blacklight
|
18
|
+
def login
|
19
|
+
return unique_id
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Stanford SolrHelper is a controller layer mixin. It is in the controller scope: request params, session etc.
|
2
|
+
#
|
3
|
+
# NOTE: Be careful when creating variables here as they may be overriding something that already exists.
|
4
|
+
# The ActionController docs: http://api.rubyonrails.org/classes/ActionController/Base.html
|
5
|
+
#
|
6
|
+
# Override these methods in your own controller for customizations:
|
7
|
+
#
|
8
|
+
# class HomeController < ActionController::Base
|
9
|
+
#
|
10
|
+
# include Stanford::SolrHelper
|
11
|
+
#
|
12
|
+
# def solr_search_params
|
13
|
+
# super.merge :per_page=>10
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
module MediaShelf
|
19
|
+
module ActiveFedoraHelper
|
20
|
+
|
21
|
+
def retrieve_af_model(class_name, opts={})
|
22
|
+
if !class_name.nil?
|
23
|
+
klass = Module.const_get(class_name.camelcase)
|
24
|
+
else
|
25
|
+
klass = nil
|
26
|
+
end
|
27
|
+
#klass.included_modules.include?(ActiveFedora::Model)
|
28
|
+
if klass.is_a?(Class) && klass.superclass == ActiveFedora::Base
|
29
|
+
return klass
|
30
|
+
else
|
31
|
+
return opts.fetch(:default, false)
|
32
|
+
end
|
33
|
+
rescue NameError
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
37
|
+
def load_af_instance_from_solr(doc)
|
38
|
+
pid = doc[:id] ? doc[:id] : doc[:id.to_s]
|
39
|
+
pid ? ActiveFedora::Base.load_instance_from_solr(pid,doc) : nil
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def require_fedora
|
45
|
+
Fedora::Repository.register(ActiveFedora.fedora_config[:url], session[:user])
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
|
49
|
+
def require_solr
|
50
|
+
ActiveFedora::SolrService.register(ActiveFedora.solr_config[:url])
|
51
|
+
end
|
52
|
+
|
53
|
+
#underscores are escaped w/ + signs, which are unescaped by rails to spaces
|
54
|
+
def unescape_keys(attrs)
|
55
|
+
h=Hash.new
|
56
|
+
attrs.each do |k,v|
|
57
|
+
h[k.gsub(/ /, '_')]=v
|
58
|
+
|
59
|
+
end
|
60
|
+
h
|
61
|
+
end
|
62
|
+
def escape_keys(attrs)
|
63
|
+
h=Hash.new
|
64
|
+
attrs.each do |k,v|
|
65
|
+
h[k.gsub(/_/, '+')]=v
|
66
|
+
|
67
|
+
end
|
68
|
+
h
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
namespace :hyhead do
|
2
|
+
begin
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'rspec/core'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
desc "Run HydraHead cucumber and rspec, with test solr"
|
8
|
+
task :all_tests => ['hyhead:spec:with_solr', 'hyhead:cucumber:with_solr']
|
9
|
+
|
10
|
+
namespace :all_tests do
|
11
|
+
desc "Run HydraHead rspec and cucumber tests with rcov"
|
12
|
+
rm "hyhead-coverage.data" if File.exist?("hyhead-coverage.data")
|
13
|
+
task :rcov => ['hyhead:spec:rcov', 'hyhead:cucumber:rcov']
|
14
|
+
end
|
15
|
+
|
16
|
+
rescue LoadError
|
17
|
+
desc "Not available! (cucumber and rspec not avail)"
|
18
|
+
task :all_tests do
|
19
|
+
abort 'Not available. Both cucumber and rspec need to be installed to run hyhead:all_tests'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,184 @@
|
|
1
|
+
# require File.expand_path(File.dirname(__FILE__) + '/hydra_jetty.rb')
|
2
|
+
require "active-fedora"
|
3
|
+
require "solrizer-fedora"
|
4
|
+
require "active_support" # This is just to load ActiveSupport::CoreExtensions::String::Inflections
|
5
|
+
require "hydra/fixtures"
|
6
|
+
namespace :hydra do
|
7
|
+
|
8
|
+
|
9
|
+
desc "Delete and re-import the fixture identified by pid"
|
10
|
+
task :refresh_fixture => :init do
|
11
|
+
# If a destination url has been provided, attampt to export from the fedora repository there.
|
12
|
+
if ENV["destination"]
|
13
|
+
Fedora::Repository.register(ENV["destination"])
|
14
|
+
end
|
15
|
+
if ENV["pid"].nil?
|
16
|
+
raise "You must specify a valid pid. Example: rake hydra:refresh_fixture pid=demo:12"
|
17
|
+
end
|
18
|
+
begin
|
19
|
+
Hydra::Fixtures.reload(ENV["pid"])
|
20
|
+
rescue Errno::ECONNREFUSED => e
|
21
|
+
puts "Can't connect to Fedora! Are you sure jetty is running?"
|
22
|
+
rescue Fedora::ServerError => e
|
23
|
+
logger.error("Received a Fedora error while deleting #{pid}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Delete the object identified by pid. Example: rake hydra:delete pid=demo:12"
|
28
|
+
task :delete => :init do
|
29
|
+
# If a destination url has been provided, attampt to export from the fedora repository there.
|
30
|
+
if ENV["destination"]
|
31
|
+
Fedora::Repository.register(ENV["destination"])
|
32
|
+
end
|
33
|
+
|
34
|
+
if ENV["pid"].nil?
|
35
|
+
raise "You must specify a valid pid. Example: rake hydra:delete pid=demo:12"
|
36
|
+
else
|
37
|
+
pid = ENV["pid"]
|
38
|
+
puts "Deleting '#{pid}' from #{Fedora::Repository.instance.fedora_url}"
|
39
|
+
begin
|
40
|
+
Hydra::Fixtures.delete(pid)
|
41
|
+
rescue Errno::ECONNREFUSED => e
|
42
|
+
puts "Can't connect to Fedora! Are you sure jetty is running?"
|
43
|
+
rescue Fedora::ServerError => e
|
44
|
+
logger.error("Received a Fedora error while deleting #{pid}")
|
45
|
+
end
|
46
|
+
logger.info "Deleted '#{pid}' from #{Fedora::Repository.instance.fedora_url}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Delete a range of objects in a given namespace. ie 'rake hydra:purge_range[demo, 22, 50]' will delete demo:22 through demo:50"
|
51
|
+
task :purge_range => :init do |t, args|
|
52
|
+
# If Fedora Repository connection is not already initialized, initialize it using ActiveFedora defaults
|
53
|
+
# ActiveFedora.init unless Thread.current[:repo]
|
54
|
+
|
55
|
+
namespace = ENV["namespace"]
|
56
|
+
start_point = ENV["start"].to_i
|
57
|
+
stop_point = ENV["stop"].to_i
|
58
|
+
unless start_point < stop_point
|
59
|
+
raise StandardError "start point must be less that end point."
|
60
|
+
end
|
61
|
+
puts "Deleting #{stop_point - start_point} objects from #{namespace}:#{start_point.to_s} to #{namespace}:#{stop_point.to_s}"
|
62
|
+
i = start_point
|
63
|
+
while i <= stop_point do
|
64
|
+
pid = namespace + ":" + i.to_s
|
65
|
+
begin
|
66
|
+
ActiveFedora::Base.load_instance(pid).delete
|
67
|
+
rescue ActiveFedora::ObjectNotFoundError
|
68
|
+
# The object has already been deleted (or was never created). Do nothing.
|
69
|
+
end
|
70
|
+
puts "Deleted '#{pid}' from #{Fedora::Repository.instance.fedora_url}"
|
71
|
+
i += 1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
namespace :fixtures do
|
76
|
+
desc "Refresh the fixtures applicable to this hydra head"
|
77
|
+
task :refresh => ["hydra:default_fixtures:refresh"] do
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "Export the object identified by pid into test_support/fixtures. Example:rake hydra:harvest_fixture pid=druid:sb733gr4073 source=http://fedoraAdmin:fedoraAdmin@127.0.0.1:8080/fedora"
|
82
|
+
task :harvest_fixture => :init do
|
83
|
+
|
84
|
+
# If a source url has been provided, attampt to export from the fedora repository there.
|
85
|
+
if ENV["source"]
|
86
|
+
Fedora::Repository.register(ENV["source"])
|
87
|
+
end
|
88
|
+
|
89
|
+
if ENV["pid"].nil?
|
90
|
+
puts "You must specify a valid pid. Example: rake hydra:harvest_fixture pid=demo:12"
|
91
|
+
else
|
92
|
+
pid = ENV["pid"]
|
93
|
+
puts "Exporting '#{pid}' from #{Fedora::Repository.instance.fedora_url}"
|
94
|
+
foxml = Fedora::Repository.instance.export(pid)
|
95
|
+
filename = File.join("test_support","fixtures","#{pid.gsub(":","_")}.foxml.xml")
|
96
|
+
file = File.new(filename,"w")
|
97
|
+
file.syswrite(foxml)
|
98
|
+
puts "The object has been saved as #{filename}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "Import the fixture located at the provided path. Example: rake hydra:import_fixture fixture=test_support/fixtures/demo_12.foxml.xml"
|
103
|
+
task :import_fixture => [:init, :environment] do
|
104
|
+
|
105
|
+
# If a destination url has been provided, attampt to export from the fedora repository there.
|
106
|
+
if ENV["destination"]
|
107
|
+
Fedora::Repository.register(ENV["destination"])
|
108
|
+
end
|
109
|
+
if !ENV["fixture"].nil?
|
110
|
+
body = Hydra::Fixtures.import_to_fedora(ENV["fixture"])
|
111
|
+
elsif !ENV["pid"].nil?
|
112
|
+
body = Hydra::Fixtures.import_and_index(ENV["pid"])
|
113
|
+
else
|
114
|
+
raise "You must specify a path to the fixture or provide its pid. Example: rake hydra:import_fixture fixture=test_support/fixtures/demo_12.foxml.xml"
|
115
|
+
end
|
116
|
+
puts "The fixture has been ingested as #{body}"
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
desc "Init Hydra configuration"
|
121
|
+
task :init do
|
122
|
+
if !ENV["environment"].nil?
|
123
|
+
Rails.env = ENV["environment"]
|
124
|
+
end
|
125
|
+
# If Fedora Repository connection is not already initialized, initialize it using ActiveFedora defaults
|
126
|
+
ActiveFedora.init unless Thread.current[:repo]
|
127
|
+
end
|
128
|
+
|
129
|
+
desc "Load hydra-head models"
|
130
|
+
task :load_models do
|
131
|
+
require "hydra"
|
132
|
+
Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), "..",'app','models', '*.rb')).each do |model|
|
133
|
+
load model
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
namespace :default_fixtures do
|
138
|
+
|
139
|
+
FIXTURES = [
|
140
|
+
"hydrangea:fixture_mods_article1",
|
141
|
+
"hydrangea:fixture_mods_article3",
|
142
|
+
"hydrangea:fixture_file_asset1",
|
143
|
+
"hydrangea:fixture_mods_article2",
|
144
|
+
"hydrangea:fixture_uploaded_svg1",
|
145
|
+
"hydrangea:fixture_archivist_only_mods_article",
|
146
|
+
"hydrangea:fixture_mods_dataset1",
|
147
|
+
"libra-oa:1", "libra-oa:2"
|
148
|
+
]
|
149
|
+
|
150
|
+
desc "Load default Hydra fixtures"
|
151
|
+
task :load do
|
152
|
+
FIXTURES.each do |fixture|
|
153
|
+
ENV["fixture"] = nil
|
154
|
+
ENV["pid"] = fixture
|
155
|
+
Rake::Task["hydra:import_fixture"].reenable
|
156
|
+
Rake::Task["hydra:import_fixture"].invoke
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
desc "Remove default Hydra fixtures"
|
161
|
+
task :delete do
|
162
|
+
FIXTURES.each do |fixture|
|
163
|
+
ENV["fixture"] = nil
|
164
|
+
ENV["pid"] = fixture
|
165
|
+
Rake::Task["hydra:delete"].reenable
|
166
|
+
Rake::Task["hydra:delete"].invoke
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
desc "Refresh default Hydra fixtures"
|
171
|
+
task :refresh do
|
172
|
+
FIXTURES.each do |fixture|
|
173
|
+
logger.debug("Refreshing #{fixture}")
|
174
|
+
ENV["fixture"] = nil
|
175
|
+
ENV["pid"] = fixture
|
176
|
+
Rake::Task["hydra:delete"].reenable
|
177
|
+
Rake::Task["hydra:delete"].invoke
|
178
|
+
Rake::Task["hydra:import_fixture"].reenable
|
179
|
+
Rake::Task["hydra:import_fixture"].invoke
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require "hydra/testing_server"
|
2
|
+
|
3
|
+
# if you would like to see solr startup messages on STDERR
|
4
|
+
# when starting solr test server during functional tests use:
|
5
|
+
#
|
6
|
+
# rake SOLR_CONSOLE=true
|
7
|
+
JETTY_PARAMS = {
|
8
|
+
:quiet => ENV['HYDRA_CONSOLE'] ? false : true,
|
9
|
+
:jetty_home => ENV['HYDRA_JETTY_HOME'],
|
10
|
+
:jetty_port => 8983,
|
11
|
+
:solr_home => ENV['HYDRA_SOLR_HOME'],
|
12
|
+
:fedora_home => ENV['HYDRA_SOLR_HOME']
|
13
|
+
}
|
14
|
+
|
15
|
+
#:jetty_port => ENV['HYDRA_JETTY_PORT'],
|
16
|
+
namespace :hydra do
|
17
|
+
namespace :jetty do
|
18
|
+
desc "Starts the bundled Hydra Testing Server"
|
19
|
+
task :start do
|
20
|
+
Hydra::TestingServer.configure(JETTY_PARAMS)
|
21
|
+
Hydra::TestingServer.instance.start
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Stops the bundled Hydra Testing Server"
|
25
|
+
task :stop do
|
26
|
+
Hydra::TestingServer.instance.stop
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Restarts the bundled Hydra Testing Server"
|
30
|
+
task :restart do
|
31
|
+
Hydra::TestingServer.instance.stop
|
32
|
+
Hydra::TestingServer.configure(JETTY_PARAMS)
|
33
|
+
Hydra::TestingServer.instance.start
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
|
37
|
+
task :config do
|
38
|
+
Rake::Task["hydra:jetty:config_fedora"].invoke
|
39
|
+
Rake::Task["hydra:jetty:config_solr"].invoke
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Copies the default SOLR config for the bundled Hydra Testing Server"
|
43
|
+
task :config_solr do
|
44
|
+
FileList['solr_conf/conf/*'].each do |f|
|
45
|
+
cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
|
46
|
+
cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Copies a custom fedora config for the bundled Hydra Testing Server"
|
52
|
+
task :config_fedora do
|
53
|
+
# load a custom fedora.fcfg -
|
54
|
+
if defined?(Rails.root)
|
55
|
+
app_root = Rails.root
|
56
|
+
else
|
57
|
+
app_root = File.join(File.dirname(__FILE__),"..")
|
58
|
+
end
|
59
|
+
|
60
|
+
fcfg = File.join(app_root,"fedora_conf","conf","fedora.fcfg")
|
61
|
+
puts "PWD:: #{FileUtils.pwd}"
|
62
|
+
if File.exists?(fcfg)
|
63
|
+
puts "copying over fedora.fcfg"
|
64
|
+
cp("#{fcfg}", 'jetty/fedora/default/server/config/', :verbose => true)
|
65
|
+
else
|
66
|
+
puts "#{fcfg} file not found -- skipping fedora config"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Copies the default SOLR config files and starts up the fedora instance."
|
71
|
+
task :load => [:config, :start]
|
72
|
+
|
73
|
+
desc "Returns the status of the Hydra::TestingServer."
|
74
|
+
task :status do
|
75
|
+
status = Hydra::TestingServer.instance.pid ? "Running: #{Hydra::TestingServer.instance.pid}" : "Not running"
|
76
|
+
puts status
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
# Blacklight customization, trick Cucumber into looking in our current
|
8
|
+
# location for Rails.root, even though we're going to give it features
|
9
|
+
# from elsewhere.
|
10
|
+
ENV['RAILS_ROOT'] = Rails.root.to_s
|
11
|
+
|
12
|
+
# hyhead_features, where to find features inside hyhead source?
|
13
|
+
hyhead_features = File.expand_path("./test_support/features",HydraHead.root)
|
14
|
+
|
15
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
16
|
+
|
17
|
+
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
18
|
+
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'cucumber/rake/task'
|
22
|
+
|
23
|
+
namespace :hyhead do
|
24
|
+
desc 'Alias for hyhead:cucumber:ok'
|
25
|
+
task :cucumber => 'hyhead:cucumber:ok'
|
26
|
+
namespace :cucumber do
|
27
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
28
|
+
# Blacklight customization, call features from external location, pass
|
29
|
+
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
30
|
+
t.cucumber_opts = hyhead_features
|
31
|
+
|
32
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
33
|
+
t.fork = true # You may get faster startup if you set this to false
|
34
|
+
t.profile = 'default'
|
35
|
+
end
|
36
|
+
|
37
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
38
|
+
# Blacklight customization, call features from external location, pass
|
39
|
+
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
40
|
+
t.cucumber_opts = hyhead_features
|
41
|
+
|
42
|
+
|
43
|
+
t.binary = vendored_cucumber_bin
|
44
|
+
t.fork = true # You may get faster startup if you set this to false
|
45
|
+
t.profile = 'wip'
|
46
|
+
end
|
47
|
+
|
48
|
+
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
49
|
+
# Blacklight customization, call features from external location, pass
|
50
|
+
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
51
|
+
t.cucumber_opts = hyhead_features
|
52
|
+
|
53
|
+
t.binary = vendored_cucumber_bin
|
54
|
+
t.fork = true # You may get faster startup if you set this to false
|
55
|
+
t.profile = 'rerun'
|
56
|
+
end
|
57
|
+
|
58
|
+
if (RUBY_VERSION.to_f < 1.9) then
|
59
|
+
Cucumber::Rake::Task.new({:rcov => 'db:test:prepare'}, 'Run features with rcov') do |t|
|
60
|
+
# Blacklight customization, call features from external location, pass
|
61
|
+
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
62
|
+
t.cucumber_opts = hyhead_features
|
63
|
+
|
64
|
+
|
65
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
66
|
+
t.fork = true # You may get faster startup if you set this to false
|
67
|
+
t.profile = 'default'
|
68
|
+
t.rcov = true
|
69
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate hyhead-coverage.data}
|
70
|
+
t.rcov_opts << %[-o "#{HydraHead.root}/coverage"]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Run all features'
|
75
|
+
task :all => [:ok, :wip]
|
76
|
+
|
77
|
+
|
78
|
+
# Solr wrapper. for now just for hyhead:cucumber, plan to
|
79
|
+
# provide it for all variants eventually.
|
80
|
+
# if you would like to see solr startup messages on STDERR
|
81
|
+
# when starting solr test server during functional tests use:
|
82
|
+
#
|
83
|
+
# rake SOLR_CONSOLE=true
|
84
|
+
require File.expand_path('../jetty_solr_server.rb', __FILE__)
|
85
|
+
desc "hyhead:cucumber with jetty/solr launch"
|
86
|
+
task :with_solr do
|
87
|
+
# wrap tests with a test-specific Solr server
|
88
|
+
# Need to look up where the test jetty is located
|
89
|
+
# from solr.yml, we don't hardcode it anymore.
|
90
|
+
|
91
|
+
solr_yml_path = locate_path("config", "solr.yml")
|
92
|
+
jetty_path = if ( File.exists?( solr_yml_path ))
|
93
|
+
solr_config = YAML::load(File.open(solr_yml_path))
|
94
|
+
solr_config["test"]["jetty_path"] if solr_config["test"]
|
95
|
+
end
|
96
|
+
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
97
|
+
|
98
|
+
JettySolrServer.new(
|
99
|
+
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
100
|
+
:sleep_after_start => 2).wrap do
|
101
|
+
Rake::Task["hyhead:cucumber"].invoke
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
task :features => :cucumber do
|
114
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
115
|
+
end
|
116
|
+
|
117
|
+
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
118
|
+
task 'db:test:prepare' do
|
119
|
+
end
|
120
|
+
rescue LoadError
|
121
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
122
|
+
task :cucumber do
|
123
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|