curation_concerns 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +15 -0
- data/README.md +46 -0
- data/RELEASING.md +2 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/application.js +18 -0
- data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
- data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
- data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
- data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
- data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
- data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
- data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
- data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
- data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
- data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
- data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
- data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
- data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
- data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
- data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
- data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
- data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
- data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
- data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
- data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
- data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +3 -0
- data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
- data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
- data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
- data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
- data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
- data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
- data/app/controllers/curation_concerns/application_controller.rb +7 -0
- data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
- data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
- data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +5 -0
- data/app/controllers/leases_controller.rb +5 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
- data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
- data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
- data/app/helpers/curation_concerns/ability_helper.rb +46 -0
- data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
- data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
- data/app/helpers/curation_concerns/collections_helper.rb +63 -0
- data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
- data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
- data/app/helpers/curation_concerns/lease_helper.rb +18 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
- data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
- data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
- data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
- data/app/helpers/curation_concerns/title_helper.rb +23 -0
- data/app/helpers/curation_concerns/url_helper.rb +29 -0
- data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
- data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
- data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
- data/app/search_builders/curation_concerns/search_builder.rb +49 -0
- data/app/services/curation_concerns/curation_concern.rb +14 -0
- data/app/services/curation_concerns/embargo_service.rb +26 -0
- data/app/services/curation_concerns/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +47 -0
- data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_additional_information.html.erb +6 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_representative_image.html.erb +13 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_form_to_add_member.html.erb +21 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +17 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
- data/app/views/curation_concerns/base/_collections.html.erb +26 -0
- data/app/views/curation_concerns/base/_form.html.erb +25 -0
- data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
- data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
- data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
- data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
- data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
- data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concerns/base/edit.html.erb +13 -0
- data/app/views/curation_concerns/base/new.html.erb +12 -0
- data/app/views/curation_concerns/base/show.html.erb +21 -0
- data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
- data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
- data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
- data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
- data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
- data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
- data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
- data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
- data/app/views/layouts/curation_concerns.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/workers/visibility_copy_worker.rb +30 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/curation_concerns.en.yml +96 -0
- data/config/routes.rb +4 -0
- data/curation_concerns-models/.gitignore +17 -0
- data/curation_concerns-models/Gemfile +4 -0
- data/curation_concerns-models/LICENSE.md +177 -0
- data/curation_concerns-models/README.md +42 -0
- data/curation_concerns-models/Rakefile +1 -0
- data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
- data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
- data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
- data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
- data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
- data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
- data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
- data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
- data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
- data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
- data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
- data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
- data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
- data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
- data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
- data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
- data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
- data/curation_concerns-models/app/models/version_committer.rb +2 -0
- data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
- data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
- data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
- data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
- data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
- data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
- data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
- data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
- data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
- data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
- data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
- data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
- data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
- data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
- data/curation_concerns-models/lib/tasks/resque.rake +13 -0
- data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
- data/curation_concerns.gemspec +46 -0
- data/lib/curation_concerns/configuration.rb +74 -0
- data/lib/curation_concerns/controller_resource.rb +10 -0
- data/lib/curation_concerns/engine.rb +20 -0
- data/lib/curation_concerns/rails/routes.rb +76 -0
- data/lib/curation_concerns/spec_support.rb +10 -0
- data/lib/curation_concerns/version.rb +3 -0
- data/lib/curation_concerns.rb +8 -0
- data/lib/generators/curation_concerns/install_generator.rb +103 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
- data/lib/generators/curation_concerns/work/USAGE +19 -0
- data/lib/generators/curation_concerns/work/templates/README +13 -0
- data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
- data/solr_conf/conf/solrconfig.xml +223 -0
- data/spec/abilities/collection_abilities_spec.rb +48 -0
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
- data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
- data/spec/controllers/catalog_controller_spec.rb +115 -0
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
- data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +51 -0
- data/spec/controllers/embargoes_controller_spec.rb +114 -0
- data/spec/controllers/leases_controller_spec.rb +94 -0
- data/spec/factories/collections.rb +15 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +31 -0
- data/spec/factories/generic_works.rb +54 -0
- data/spec/factories/users.rb +28 -0
- data/spec/features/add_file_spec.rb +30 -0
- data/spec/features/collection_spec.rb +222 -0
- data/spec/features/create_work_spec.rb +43 -0
- data/spec/features/embargo_spec.rb +51 -0
- data/spec/features/lease_spec.rb +49 -0
- data/spec/features/update_file_spec.rb +32 -0
- data/spec/features/work_generator_spec.rb +58 -0
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/charter.docx +0 -0
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/fixtures/image.jp2 +0 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sample_mpeg4.mp4 +0 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/fixtures/spoken-text.m4a +0 -0
- data/spec/fixtures/test4.pdf +0 -0
- data/spec/fixtures/test5.mp3 +0 -0
- data/spec/fixtures/world.png +0 -0
- data/spec/forms/collection_edit_form_spec.rb +20 -0
- data/spec/forms/generic_file_edit_form_spec.rb +33 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/curation_concerns/.keep +0 -0
- data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +22 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
- data/spec/jobs/audit_job_spec.rb +53 -0
- data/spec/jobs/characterize_job_spec.rb +23 -0
- data/spec/jobs/copy_permissions_job_spec.rb +49 -0
- data/spec/jobs/create_derivatives_job_spec.rb +23 -0
- data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
- data/spec/jobs/import_url_job_spec.rb +45 -0
- data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
- data/spec/lib/curation_concerns/messages_spec.rb +70 -0
- data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
- data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/matchers/response_matchers.rb +7 -0
- data/spec/matchers.rb +24 -0
- data/spec/models/checksum_audit_log_spec.rb +66 -0
- data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
- data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
- data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
- data/spec/models/fits_datastream_spec.rb +127 -0
- data/spec/models/generic_file_spec.rb +619 -0
- data/spec/models/generic_work_spec.rb +43 -0
- data/spec/models/user_spec.rb +23 -0
- data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
- data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
- data/spec/routing/curation_concerns/routes_spec.rb +36 -0
- data/spec/routing/route_spec.rb +86 -0
- data/spec/services/characterization_service_spec.rb +30 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/full_text_extraction_service_spec.rb +5 -0
- data/spec/services/generic_file_audit_service_spec.rb +71 -0
- data/spec/services/generic_file_indexing_service_spec.rb +57 -0
- data/spec/services/generic_work_indexing_service_spec.rb +18 -0
- data/spec/services/lease_service_spec.rb +53 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/services/versioning_service_spec.rb +32 -0
- data/spec/spec_helper.rb +94 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concerns/factory_helpers.rb +14 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/tasks/rake_spec.rb +24 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
- data/spec/views/catalog/index.html.erb_spec.rb +59 -0
- data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +70 -0
- data/tasks/jetty.rake +15 -0
- data/tasks/release.rake +93 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- metadata +888 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
module Features
|
2
|
+
module SessionHelpers
|
3
|
+
# Regular login
|
4
|
+
def login_as(user)
|
5
|
+
user.reload # because the user isn't re-queried via Warden
|
6
|
+
super(user, scope: :user, run_callbacks: false)
|
7
|
+
end
|
8
|
+
# Regular logout
|
9
|
+
def logout(user=:user)
|
10
|
+
super(user)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Poltergeist-friendly sign-up
|
14
|
+
# Use this in feature tests
|
15
|
+
def sign_up_with(email, password)
|
16
|
+
Capybara.exact = true
|
17
|
+
visit new_user_registration_path
|
18
|
+
fill_in 'Email', with: email
|
19
|
+
fill_in 'Password', with: password
|
20
|
+
fill_in 'Password confirmation', with: password
|
21
|
+
click_button 'Sign up'
|
22
|
+
end
|
23
|
+
|
24
|
+
# Poltergeist-friendly sign-in
|
25
|
+
# Use this in feature tests
|
26
|
+
def sign_in(who = :user)
|
27
|
+
user = if who.instance_of?(User)
|
28
|
+
who
|
29
|
+
else
|
30
|
+
FactoryGirl.build(:user).tap do |u|
|
31
|
+
u.save!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
visit new_user_session_path
|
35
|
+
fill_in 'Email', with: user.email
|
36
|
+
fill_in 'Password', with: user.password
|
37
|
+
click_button 'Log in'
|
38
|
+
expect(page).to_not have_text 'Invalid email or password.'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../features/session_helpers', __FILE__)
|
2
|
+
require File.expand_path('../features/fixture_file_upload', __FILE__)
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.include Warden::Test::Helpers, type: :feature
|
6
|
+
config.include Features::SessionHelpers, type: :feature
|
7
|
+
config.include Features::FixtureFileUpload
|
8
|
+
|
9
|
+
config.before(:each, type: :feature) do
|
10
|
+
Warden.test_mode!
|
11
|
+
@old_resque_inline_value = Resque.inline
|
12
|
+
Resque.inline = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.after(:each, type: :feature) do
|
16
|
+
Warden.test_reset!
|
17
|
+
Resque.inline = @old_resque_inline_value
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
shared_examples 'has_dc_metadata' do
|
2
|
+
|
3
|
+
# Single-valued fields
|
4
|
+
it { should have_unique_field(:created) }
|
5
|
+
it { should have_unique_field(:date_uploaded) }
|
6
|
+
it { should have_unique_field(:date_modified) }
|
7
|
+
|
8
|
+
# Multivalued fields
|
9
|
+
it { should have_multivalue_field(:content_format) }
|
10
|
+
it { should have_multivalue_field(:description) }
|
11
|
+
it { should have_multivalue_field(:identifier) }
|
12
|
+
it { should have_multivalue_field(:publisher) }
|
13
|
+
it { should have_multivalue_field(:source) }
|
14
|
+
it { should have_multivalue_field(:language) }
|
15
|
+
it { should have_multivalue_field(:subject) }
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
shared_examples 'with_access_rights' do
|
2
|
+
|
3
|
+
def prepare_subject_for_access_rights_visibility_test!
|
4
|
+
# I am doing this because the actual persistence of the objects requires
|
5
|
+
# so much more and I don't know for certain if it has happened.
|
6
|
+
allow(subject).to receive(:persisted?).and_return(true)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has an under_embargo?" do
|
10
|
+
expect {
|
11
|
+
subject.under_embargo?
|
12
|
+
}.to_not raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has a visibility attribute" do
|
16
|
+
expect(subject).to respond_to(:visibility)
|
17
|
+
expect(subject).to respond_to(:visibility=)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'open access' do
|
21
|
+
it "has an open_access?" do
|
22
|
+
expect {
|
23
|
+
subject.open_access?
|
24
|
+
}.to_not raise_error
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'sets visibility' do
|
28
|
+
prepare_subject_for_access_rights_visibility_test!
|
29
|
+
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
30
|
+
expect(subject).to be_open_access
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'authenticated access' do
|
35
|
+
it 'sets visibility' do
|
36
|
+
prepare_subject_for_access_rights_visibility_test!
|
37
|
+
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
38
|
+
expect(subject).to be_authenticated_only_access
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has an authenticated_only_access?" do
|
42
|
+
expect {
|
43
|
+
subject.authenticated_only_access?
|
44
|
+
}.to_not raise_error
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'private access' do
|
49
|
+
it 'sets visibility' do
|
50
|
+
prepare_subject_for_access_rights_visibility_test!
|
51
|
+
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
52
|
+
expect(subject).to be_private_access
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
it "has an private_access?" do
|
57
|
+
expect {
|
58
|
+
subject.private_access?
|
59
|
+
}.to_not raise_error
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
describe "Rake tasks" do
|
5
|
+
|
6
|
+
describe "curation_concerns:migrate" do
|
7
|
+
let(:namespaced_id) { "curation_concerns:123" }
|
8
|
+
let(:corrected_id) { "123" }
|
9
|
+
before do
|
10
|
+
load File.expand_path("../../../curation_concerns-models/lib/tasks/migrate.rake", __FILE__)
|
11
|
+
Rake::Task.define_task(:environment)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "deleting the namespace from ChecksumAuditLog#generic_file_id" do
|
15
|
+
before do
|
16
|
+
ChecksumAuditLog.create(generic_file_id: namespaced_id)
|
17
|
+
Rake::Task["curation_concerns:migrate:audit_logs"].invoke
|
18
|
+
end
|
19
|
+
subject { ChecksumAuditLog.first.generic_file_id }
|
20
|
+
it { is_expected.to eql corrected_id }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# placeholder to use for pinning against specific gem commit references
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root "../../spec/test_app_templates"
|
5
|
+
|
6
|
+
def install_engine
|
7
|
+
generate 'curation_concerns:install'
|
8
|
+
end
|
9
|
+
|
10
|
+
def run_migrations
|
11
|
+
rake "db:migrate"
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate_generic_work
|
15
|
+
generate 'curation_concerns:work GenericWork'
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove_generic_work_specs
|
19
|
+
remove_file 'spec/models/generic_work_spec.rb'
|
20
|
+
remove_file 'spec/controllers/curation_concerns/generic_works_controller_spec.rb'
|
21
|
+
remove_file 'spec/actors/curation_concerns/generic_work_actor_spec.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
def enable_av_transcoding
|
25
|
+
file_path = "app/models/generic_file.rb"
|
26
|
+
inject_into_file file_path, after: /include ::CurationConcerns::GenericFileBehavior/ do
|
27
|
+
%q(
|
28
|
+
directly_contains_one :ogg, through: :files, type: ::RDF::URI("http://pcdm.org/use#ServiceFile"), class_name: "Hydra::PCDM::File"
|
29
|
+
directly_contains_one :mp3, through: :files, type: ::RDF::URI("http://pcdm.org/use#File"), class_name: "Hydra::PCDM::File"
|
30
|
+
directly_contains_one :mp4, through: :files, type: ::RDF::URI("http://pcdm.org/use#ServiceFile"), class_name: "Hydra::PCDM::File"
|
31
|
+
directly_contains_one :webm, through: :files, type: ::RDF::URI("http://pcdm.org/use#File"), class_name: "Hydra::PCDM::File"
|
32
|
+
|
33
|
+
|
34
|
+
# This was taken directly from Sufia's GenericFile::Derivative.
|
35
|
+
makes_derivatives do |obj|
|
36
|
+
case obj.original_file.mime_type
|
37
|
+
when *pdf_mime_types
|
38
|
+
obj.transform_file :original_file, thumbnail: { format: 'jpg', size: '338x493' }
|
39
|
+
when *office_document_mime_types
|
40
|
+
obj.transform_file :original_file, { thumbnail: { format: 'jpg', size: '200x150>' } }, processor: :document
|
41
|
+
when *audio_mime_types
|
42
|
+
obj.transform_file :original_file, { mp3: { format: 'mp3' }, ogg: { format: 'ogg' } }, processor: :audio
|
43
|
+
when *video_mime_types
|
44
|
+
obj.transform_file :original_file, { webm: { format: 'webm' }, mp4: { format: 'mp4' }, thumbnail: { format: 'jpg' } }, processor: :video
|
45
|
+
when *image_mime_types
|
46
|
+
obj.transform_file :original_file, thumbnail: { format: 'jpg', size: '200x150>' }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'catalog/index.html.erb' do
|
4
|
+
let(:collection) { stub_model(Collection, title: 'collection1', id: 'abc123') }
|
5
|
+
let(:doc) { SolrDocument.new(collection.to_solr) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
view.extend CurationConcerns::CollectionsHelper
|
9
|
+
view.extend CurationConcerns::CatalogHelper
|
10
|
+
allow(view).to receive(:search_action_path).and_return('/catalog')
|
11
|
+
allow(view).to receive(:has_search_parameters?).and_return(true)
|
12
|
+
|
13
|
+
|
14
|
+
allow(view).to receive(:current_users_collections).and_return([])
|
15
|
+
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
16
|
+
stub_template 'catalog/_search_sidebar.html.erb' => ''
|
17
|
+
stub_template 'catalog/_search_header.html.erb' => ''
|
18
|
+
allow(view).to receive(:render_opensearch_response_metadata).and_return('')
|
19
|
+
allow(view).to receive(:render_grouped_response?).and_return(false)
|
20
|
+
allow(view).to receive(:search_session).and_return({})
|
21
|
+
allow(view).to receive(:current_search_session).and_return(nil)
|
22
|
+
allow(view).to receive(:document_counter_with_offset).and_return(5)
|
23
|
+
|
24
|
+
params[:view] = 'gallery'
|
25
|
+
|
26
|
+
resp = []
|
27
|
+
assign(:response, resp )
|
28
|
+
allow(resp).to receive(:total_pages).and_return(1)
|
29
|
+
allow(resp).to receive(:current_page).and_return(1)
|
30
|
+
allow(resp).to receive(:limit_value).and_return(10)
|
31
|
+
allow(resp).to receive(:empty?).and_return(false)
|
32
|
+
|
33
|
+
# This stubs out the SolrDocument#to_model
|
34
|
+
allow(ActiveFedora::Base).to receive(:load_instance_from_solr).with('abc123', doc).and_return(collection)
|
35
|
+
|
36
|
+
assign(:document_list, [doc])
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when user does not have permissions" do
|
40
|
+
before { allow(view).to receive(:can?).and_return(false) }
|
41
|
+
it 'appears on page without error' do
|
42
|
+
render
|
43
|
+
page = Capybara::Node::Simple.new(rendered)
|
44
|
+
expect(page).to have_link(collection.title)
|
45
|
+
expect(page).to have_content "List of files deposited"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
context "when user has all the permissions" do
|
49
|
+
before { allow(view).to receive(:can?).and_return(true) }
|
50
|
+
it 'appears on page without error' do
|
51
|
+
render
|
52
|
+
page = Capybara::Node::Simple.new(rendered)
|
53
|
+
expect(page).to have_link(collection.title)
|
54
|
+
expect(page).to have_content "List of files deposited"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'curation_concerns/base/_attributes.html.erb' do
|
4
|
+
|
5
|
+
let(:creator) { 'Bilbo' }
|
6
|
+
let(:contributor) { 'Frodo' }
|
7
|
+
let(:subject) { 'history' }
|
8
|
+
|
9
|
+
let(:curation_concern) { double(creator: [creator],
|
10
|
+
contributor: [contributor],
|
11
|
+
subject: [subject]) }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(view).to receive(:dom_class) { '' }
|
15
|
+
allow(view).to receive(:permission_badge_for) { '' }
|
16
|
+
|
17
|
+
render partial: 'attributes', locals: { curation_concern: curation_concern }
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'has links to search for other objects with the same metadata' do
|
21
|
+
expect(rendered).to have_link(creator, href: catalog_index_path(search_field: 'creator', q: creator))
|
22
|
+
expect(rendered).to have_link(contributor, href: catalog_index_path(search_field: 'contributor', q: contributor))
|
23
|
+
expect(rendered).to have_link(subject, href: catalog_index_path(search_field: 'subject', q: subject))
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'curation_concerns/base/show.html.erb' do
|
4
|
+
|
5
|
+
let!(:curation_concern) { FactoryGirl.create(:private_generic_work) }
|
6
|
+
|
7
|
+
context "for editors" do
|
8
|
+
before do
|
9
|
+
allow(view).to receive(:can?).and_return(true)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has links to edit' do # and add to collections' do
|
13
|
+
render file: 'curation_concerns/base/show', locals: { curation_concern: curation_concern }
|
14
|
+
expect(rendered).to have_link("Edit This Generic Work", href: edit_polymorphic_path([:curation_concerns, curation_concern]))
|
15
|
+
# expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
|
16
|
+
# expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "for non-editors" do
|
21
|
+
it 'does not have links to edit' do #, but has add to collection' do
|
22
|
+
render file: 'curation_concerns/base/show', locals: { curation_concern: curation_concern }
|
23
|
+
expect(rendered).not_to have_content("Edit this Generic Work")
|
24
|
+
|
25
|
+
# expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
|
26
|
+
# expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'curation_concerns/permissions/confirm.html.erb' do
|
4
|
+
before do
|
5
|
+
allow(curation_concern).to receive(:to_param).and_return('test:123')
|
6
|
+
allow(view).to receive(:curation_concern).and_return(curation_concern)
|
7
|
+
render
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when the work is embargoed" do
|
11
|
+
let(:curation_concern) { build(:embargoed_work, embargo_date: '2099-09-26'.to_date) }
|
12
|
+
|
13
|
+
it "should have a message about embargos" do
|
14
|
+
expect(rendered).to have_content "You've applied an embargo to this Generic Work, Test title, changing its visibility to Private until September 26th, 2099. Would you like to apply the same embargo to all of the files within the Generic Work as well?"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the work is leased" do
|
19
|
+
let(:curation_concern) { build(:leased_work, embargo_date: '2099-09-26'.to_date) }
|
20
|
+
|
21
|
+
it "should have a message about leases" do
|
22
|
+
expect(rendered).to have_content "You've applied a lease to this Generic Work, Test title, changing its visibility to Open Access until September 26th, 2099. Would you like to apply the same lease to all of the files within the Generic Work as well?"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the work is not embargoed" do
|
27
|
+
let(:curation_concern) { build(:work) }
|
28
|
+
|
29
|
+
it "should have a message about visibility" do
|
30
|
+
expect(rendered).to have_content "You've changed the permissions on this Generic Work, Test title, making it visible to Private. Would you like change all of the files within the Generic Work to Private as well?"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'shared/_add_content.html.erb' do
|
4
|
+
|
5
|
+
context "for people who can create Works and Collections" do
|
6
|
+
it 'has links to create works and collections' do
|
7
|
+
allow(view).to receive(:current_user).and_return(FactoryGirl.create(:admin))
|
8
|
+
allow(view).to receive(:can?).and_return(true)
|
9
|
+
render partial: 'shared/add_content'
|
10
|
+
CurationConcerns.configuration.curation_concerns.each do |curation_concern_type|
|
11
|
+
expect(rendered).to have_link("New #{curation_concern_type.human_readable_type}", href: new_polymorphic_path([:curation_concerns, curation_concern_type]))
|
12
|
+
end
|
13
|
+
expect(rendered).to have_link("Add a Collection", href: collections.new_collection_path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
context "for people who can only create Collections" do
|
17
|
+
it 'has links to add collections but not to add works' do
|
18
|
+
allow(view).to receive(:current_user).and_return(FactoryGirl.create(:admin))
|
19
|
+
allow(view).to receive(:can?).and_return(true)
|
20
|
+
allow(view).to receive(:can_ever_create_works?).and_return(false)
|
21
|
+
render partial: 'shared/add_content'
|
22
|
+
CurationConcerns.configuration.curation_concerns.each do |curation_concern_type|
|
23
|
+
expect(rendered).not_to have_link("New #{curation_concern_type.human_readable_type}", href: new_polymorphic_path([:curation_concerns, curation_concern_type]))
|
24
|
+
end
|
25
|
+
expect(rendered).to have_link("Add a Collection", href: collections.new_collection_path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "for people who cannot create anything" do
|
30
|
+
it 'does not have links to add works or collections' do
|
31
|
+
allow(view).to receive(:current_user).and_return(FactoryGirl.create(:user))
|
32
|
+
allow(view).to receive(:can?).and_return(false)
|
33
|
+
render partial: 'shared/add_content'
|
34
|
+
expect(rendered).not_to have_text("Add")
|
35
|
+
expect(rendered).not_to have_text("Admin")
|
36
|
+
CurationConcerns.configuration.curation_concerns.each do |curation_concern_type|
|
37
|
+
expect(rendered).not_to have_link("New #{curation_concern_type.human_readable_type}", href: new_polymorphic_path([:curation_concerns, curation_concern_type]))
|
38
|
+
end
|
39
|
+
expect(rendered).not_to have_link("Add a Collection", href: collections.new_collection_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'shared/_my_actions.html.erb' do
|
4
|
+
include CurationConcerns::SearchPathsHelper
|
5
|
+
context "for admins" do
|
6
|
+
it 'has links to edit and add to collections' do
|
7
|
+
allow(view).to receive(:current_user).and_return(FactoryGirl.create(:user))
|
8
|
+
allow(view).to receive(:can?).and_return(true)
|
9
|
+
render partial: 'shared/my_actions'
|
10
|
+
expect(rendered).to have_link("My Works", href: search_path_for_my_works)
|
11
|
+
expect(rendered).to have_link("My Collections", href: search_path_for_my_collections)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
context "for non-admins" do
|
15
|
+
it 'does not have links to edit' do
|
16
|
+
allow(view).to receive(:current_user).and_return(FactoryGirl.create(:user))
|
17
|
+
allow(view).to receive(:can?).and_return(false)
|
18
|
+
render partial: 'shared/my_actions'
|
19
|
+
expect(rendered).not_to have_text("My Works")
|
20
|
+
expect(rendered).not_to have_text("My Collections")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe VisibilityCopyWorker do
|
4
|
+
|
5
|
+
describe "an open access work" do
|
6
|
+
let(:work) { FactoryGirl.create(:work_with_files) }
|
7
|
+
subject { VisibilityCopyWorker.new(work.id) }
|
8
|
+
|
9
|
+
it "should have no content at the outset" do
|
10
|
+
expect(work.generic_files.first.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should copy visibility to its contained files" do
|
14
|
+
work.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
15
|
+
work.save
|
16
|
+
subject.run
|
17
|
+
work.reload.generic_files.each do |file|
|
18
|
+
expect(file.visibility).to eq 'open'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "an embargoed work" do
|
24
|
+
let(:work) { FactoryGirl.create(:embargoed_work_with_files) }
|
25
|
+
subject { VisibilityCopyWorker.new(work.id) }
|
26
|
+
|
27
|
+
before do
|
28
|
+
expect(work.visibility).to eq 'restricted'
|
29
|
+
expect(work).to be_under_embargo
|
30
|
+
expect(work.generic_files.first).to_not be_under_embargo
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when run" do
|
34
|
+
before do
|
35
|
+
subject.run
|
36
|
+
work.reload
|
37
|
+
end
|
38
|
+
let(:file) { work.generic_files.first }
|
39
|
+
|
40
|
+
it "should copy visibility to its contained files and apply a copy of the embargo to the files" do
|
41
|
+
expect(file).to be_under_embargo
|
42
|
+
expect(file.embargo.id).to_not eq work.embargo.id
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "an leased work" do
|
48
|
+
let(:work) { FactoryGirl.create(:leased_work_with_files) }
|
49
|
+
subject { VisibilityCopyWorker.new(work.id) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
expect(work.visibility).to eq 'open'
|
53
|
+
expect(work).to be_active_lease
|
54
|
+
expect(work.generic_files.first).to_not be_active_lease
|
55
|
+
end
|
56
|
+
|
57
|
+
context "when run" do
|
58
|
+
before do
|
59
|
+
subject.run
|
60
|
+
work.reload
|
61
|
+
end
|
62
|
+
let(:file) { work.generic_files.first }
|
63
|
+
|
64
|
+
it "should copy visibility to its contained files and apply a copy of the lease to the files" do
|
65
|
+
expect(file).to be_active_lease
|
66
|
+
expect(file.lease.id).to_not eq work.lease.id
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/tasks/jetty.rake
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
namespace :jetty do
|
2
|
+
desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
|
3
|
+
task :config do
|
4
|
+
Rake::Task['curation_concerns:jetty:download_jars'].invoke
|
5
|
+
Rake::Task["jetty:config_solr"].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Copies the contents of solr_conf into the Solr development-core and test-core of Testing Server"
|
9
|
+
task :config_solr do
|
10
|
+
FileList['solr_conf/conf/*'].each do |f|
|
11
|
+
cp("#{f}", 'jetty/solr/development-core/conf/', verbose: true)
|
12
|
+
cp("#{f}", 'jetty/solr/test-core/conf/', verbose: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/tasks/release.rake
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
root = File.expand_path('../../', __FILE__)
|
2
|
+
version = File.read("#{root}/VERSION").strip
|
3
|
+
tag = "v#{version}"
|
4
|
+
|
5
|
+
directory 'pkg'
|
6
|
+
|
7
|
+
['curation_concerns-models', 'curation_concerns'].each do |framework|
|
8
|
+
namespace framework do
|
9
|
+
gem = "pkg/#{framework}-#{version}.gem"
|
10
|
+
gemspec = "#{framework}.gemspec"
|
11
|
+
|
12
|
+
task :clean do
|
13
|
+
rm_f gem
|
14
|
+
end
|
15
|
+
|
16
|
+
task :update_version_rb do
|
17
|
+
glob = root.dup
|
18
|
+
if framework == "curation_concerns"
|
19
|
+
glob << "/lib/*"
|
20
|
+
else
|
21
|
+
glob << "/#{framework}/lib/**"
|
22
|
+
end
|
23
|
+
glob << "/version.rb"
|
24
|
+
|
25
|
+
file = Dir[glob].first
|
26
|
+
if file
|
27
|
+
ruby = File.read(file)
|
28
|
+
|
29
|
+
major, minor, tiny, pre = version.split('.')
|
30
|
+
pre = pre ? pre.inspect : "nil"
|
31
|
+
|
32
|
+
ruby.gsub!(/^(\s*)VERSION = ".*?"$/, "\\1VERSION = \"#{version}\"")
|
33
|
+
raise "Could not insert VERSION in #{file}" unless $1
|
34
|
+
File.open(file, 'w') { |f| f.write ruby }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
task gem => %w(update_version_rb pkg) do
|
38
|
+
cmd = ""
|
39
|
+
cmd << "cd #{framework} && " unless framework == "curation_concerns"
|
40
|
+
cmd << "gem build #{gemspec} && mv #{framework}-#{version}.gem #{root}/pkg/"
|
41
|
+
sh cmd
|
42
|
+
end
|
43
|
+
|
44
|
+
task build: [:clean, gem]
|
45
|
+
task install: :build do
|
46
|
+
sh "gem install #{gem}"
|
47
|
+
end
|
48
|
+
|
49
|
+
task prep_release: [:ensure_clean_state, :build]
|
50
|
+
|
51
|
+
task push: :build do
|
52
|
+
sh "gem push #{gem}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
namespace :all do
|
59
|
+
task build: ['curation_concerns-models:build', 'curation_concerns:build']
|
60
|
+
task install: ['curation_concerns-models:install', 'curation_concerns:install']
|
61
|
+
task push: ['curation_concerns-models:push', 'curation_concerns:push']
|
62
|
+
|
63
|
+
task :ensure_clean_state do
|
64
|
+
unless `git status -s | grep -v VERSION | grep -v History.md`.strip.empty?
|
65
|
+
abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed"
|
66
|
+
end
|
67
|
+
|
68
|
+
unless ENV['SKIP_TAG'] || `git tag | grep "#{tag}$"`.strip.empty?
|
69
|
+
abort "[ABORTING] `git tag` shows that #{tag} already exists. Has this version already\n"\
|
70
|
+
" been released? Git tagging can be skipped by setting SKIP_TAG=1"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
task :commit do
|
75
|
+
File.open('pkg/commit_message.txt', 'w') do |f|
|
76
|
+
f.puts "# Preparing for #{version} release\n"
|
77
|
+
f.puts
|
78
|
+
f.puts "# UNCOMMENT THE LINE ABOVE TO APPROVE THIS COMMIT"
|
79
|
+
end
|
80
|
+
|
81
|
+
sh "git add . && git commit --verbose --template=pkg/commit_message.txt"
|
82
|
+
rm_f "pkg/commit_message.txt"
|
83
|
+
end
|
84
|
+
|
85
|
+
task :tag do
|
86
|
+
sh "git tag #{tag}"
|
87
|
+
sh "git push --tags"
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "Release both curation_concerns and curation_concerns-models and update the version to #{version} in all locations"
|
91
|
+
task release: %w(ensure_clean_state build commit tag push)
|
92
|
+
end
|
93
|
+
|
Binary file
|
Binary file
|