curation_concerns 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (424) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +18 -0
  5. data/Gemfile +31 -0
  6. data/LICENSE.txt +15 -0
  7. data/README.md +46 -0
  8. data/RELEASING.md +2 -0
  9. data/Rakefile +26 -0
  10. data/VERSION +1 -0
  11. data/app/assets/images/default.png +0 -0
  12. data/app/assets/images/nope.png +0 -0
  13. data/app/assets/javascripts/.gitkeep +0 -0
  14. data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
  15. data/app/assets/javascripts/curation_concerns/application.js +18 -0
  16. data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
  17. data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
  18. data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
  19. data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
  20. data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
  21. data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
  22. data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
  23. data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
  24. data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
  25. data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
  26. data/app/assets/javascripts/modernizr.js +3 -0
  27. data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
  28. data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
  29. data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
  30. data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
  31. data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
  32. data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
  33. data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
  34. data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
  35. data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
  36. data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
  37. data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
  38. data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
  39. data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
  40. data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
  41. data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
  42. data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
  43. data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
  44. data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
  45. data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
  46. data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
  47. data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
  48. data/app/controllers/catalog_controller.rb +3 -0
  49. data/app/controllers/collections_controller.rb +3 -0
  50. data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
  51. data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
  52. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
  53. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
  54. data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
  55. data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
  56. data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
  57. data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
  58. data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
  59. data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
  60. data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
  61. data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
  62. data/app/controllers/curation_concerns/application_controller.rb +7 -0
  63. data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
  64. data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
  65. data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
  66. data/app/controllers/downloads_controller.rb +4 -0
  67. data/app/controllers/embargoes_controller.rb +5 -0
  68. data/app/controllers/leases_controller.rb +5 -0
  69. data/app/controllers/registrations_controller.rb +20 -0
  70. data/app/controllers/sessions_controller.rb +4 -0
  71. data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
  72. data/app/datastreams/generic_work_metadata.rb +3 -0
  73. data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
  74. data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
  75. data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
  76. data/app/helpers/curation_concerns/ability_helper.rb +46 -0
  77. data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
  78. data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
  79. data/app/helpers/curation_concerns/collections_helper.rb +63 -0
  80. data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
  81. data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
  82. data/app/helpers/curation_concerns/lease_helper.rb +18 -0
  83. data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
  84. data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
  85. data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
  86. data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
  87. data/app/helpers/curation_concerns/title_helper.rb +23 -0
  88. data/app/helpers/curation_concerns/url_helper.rb +29 -0
  89. data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
  90. data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
  91. data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
  92. data/app/search_builders/curation_concerns/search_builder.rb +49 -0
  93. data/app/services/curation_concerns/curation_concern.rb +14 -0
  94. data/app/services/curation_concerns/embargo_service.rb +26 -0
  95. data/app/services/curation_concerns/lease_service.rb +23 -0
  96. data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
  97. data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
  98. data/app/views/catalog/_document.html.erb +3 -0
  99. data/app/views/catalog/_document_list.html.erb +5 -0
  100. data/app/views/catalog/_home_text.html.erb +8 -0
  101. data/app/views/catalog/_index_default.html.erb +17 -0
  102. data/app/views/catalog/_index_header_list_default.html.erb +8 -0
  103. data/app/views/catalog/_navbar.html.erb +12 -0
  104. data/app/views/catalog/_show_partials/_default.html.erb +22 -0
  105. data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
  106. data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
  107. data/app/views/catalog/index.html.erb +47 -0
  108. data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
  109. data/app/views/collections/_batch_edits_actions.html.erb +3 -0
  110. data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
  111. data/app/views/collections/_collection.html.erb +1 -0
  112. data/app/views/collections/_dashboard_document_list.html.erb +6 -0
  113. data/app/views/collections/_document_list.html.erb +7 -0
  114. data/app/views/collections/_edit_actions.html.erb +5 -0
  115. data/app/views/collections/_edit_descriptions.html.erb +20 -0
  116. data/app/views/collections/_form.html.erb +26 -0
  117. data/app/views/collections/_form_additional_information.html.erb +6 -0
  118. data/app/views/collections/_form_for_select_collection.html.erb +34 -0
  119. data/app/views/collections/_form_permission.html.erb +36 -0
  120. data/app/views/collections/_form_representative_image.html.erb +13 -0
  121. data/app/views/collections/_form_required_information.html.erb +11 -0
  122. data/app/views/collections/_form_to_add_member.html.erb +21 -0
  123. data/app/views/collections/_identifier_and_action.html.erb +15 -0
  124. data/app/views/collections/_media_display.html.erb +1 -0
  125. data/app/views/collections/_paginate.html.erb +6 -0
  126. data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
  127. data/app/views/collections/_show_actions.html.erb +8 -0
  128. data/app/views/collections/_show_descriptions.html.erb +10 -0
  129. data/app/views/collections/_show_fields.html.erb +0 -0
  130. data/app/views/collections/_single_item_action_fields.html.erb +6 -0
  131. data/app/views/collections/_sort_and_per_page.html.erb +29 -0
  132. data/app/views/collections/_view_type_group.html.erb +13 -0
  133. data/app/views/collections/edit.html.erb +17 -0
  134. data/app/views/collections/show.html.erb +24 -0
  135. data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
  136. data/app/views/curation_concerns/base/_collections.html.erb +26 -0
  137. data/app/views/curation_concerns/base/_form.html.erb +25 -0
  138. data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
  139. data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
  140. data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
  141. data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
  142. data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
  143. data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
  144. data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
  145. data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
  146. data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
  147. data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
  148. data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
  149. data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
  150. data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
  151. data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
  152. data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
  153. data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
  154. data/app/views/curation_concerns/base/edit.html.erb +13 -0
  155. data/app/views/curation_concerns/base/new.html.erb +12 -0
  156. data/app/views/curation_concerns/base/show.html.erb +21 -0
  157. data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
  158. data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
  159. data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
  160. data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
  161. data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
  162. data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
  163. data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
  164. data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
  165. data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
  166. data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
  167. data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
  168. data/app/views/embargoes/_embargo_history.html.erb +7 -0
  169. data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
  170. data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
  171. data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
  172. data/app/views/embargoes/edit.html.erb +43 -0
  173. data/app/views/embargoes/index.html.erb +18 -0
  174. data/app/views/layouts/boilerplate.html.erb +22 -0
  175. data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
  176. data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
  177. data/app/views/layouts/curation_concerns.html.erb +22 -0
  178. data/app/views/leases/_lease_history.html.erb +7 -0
  179. data/app/views/leases/_list_active_leases.html.erb +16 -0
  180. data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
  181. data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
  182. data/app/views/leases/edit.html.erb +43 -0
  183. data/app/views/leases/index.html.erb +18 -0
  184. data/app/views/shared/_add_content.html.erb +32 -0
  185. data/app/views/shared/_brand_bar.html.erb +10 -0
  186. data/app/views/shared/_flash_message.html.erb +17 -0
  187. data/app/views/shared/_footer.html.erb +10 -0
  188. data/app/views/shared/_ga.html.erb +6 -0
  189. data/app/views/shared/_header.html.erb +12 -0
  190. data/app/views/shared/_my_actions.html.erb +21 -0
  191. data/app/views/shared/_site_actions.html.erb +7 -0
  192. data/app/views/shared/_site_search.html.erb +12 -0
  193. data/app/views/shared/_title_bar.html.erb +16 -0
  194. data/app/workers/visibility_copy_worker.rb +30 -0
  195. data/config/initializers/simple_form.rb +31 -0
  196. data/config/locales/curation_concerns.en.yml +96 -0
  197. data/config/routes.rb +4 -0
  198. data/curation_concerns-models/.gitignore +17 -0
  199. data/curation_concerns-models/Gemfile +4 -0
  200. data/curation_concerns-models/LICENSE.md +177 -0
  201. data/curation_concerns-models/README.md +42 -0
  202. data/curation_concerns-models/Rakefile +1 -0
  203. data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
  204. data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
  205. data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
  206. data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
  207. data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
  208. data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
  209. data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
  210. data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
  211. data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
  212. data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
  213. data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
  214. data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
  215. data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
  216. data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
  217. data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
  218. data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
  219. data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
  220. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
  221. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
  222. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
  223. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
  224. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
  225. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
  226. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
  227. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
  228. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
  229. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
  230. data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
  231. data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
  232. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
  233. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
  234. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
  235. data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
  236. data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
  237. data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
  238. data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
  239. data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
  240. data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
  241. data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
  242. data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
  243. data/curation_concerns-models/app/models/version_committer.rb +2 -0
  244. data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
  245. data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
  246. data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
  247. data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
  248. data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
  249. data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
  250. data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
  251. data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
  252. data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
  253. data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
  254. data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
  255. data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
  256. data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
  257. data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
  258. data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
  259. data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
  260. data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
  261. data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
  262. data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
  263. data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
  264. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
  265. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
  266. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
  267. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
  268. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
  269. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
  270. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
  271. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
  272. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
  273. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
  274. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
  275. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
  276. data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
  277. data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
  278. data/curation_concerns-models/lib/tasks/resque.rake +13 -0
  279. data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
  280. data/curation_concerns.gemspec +46 -0
  281. data/lib/curation_concerns/configuration.rb +74 -0
  282. data/lib/curation_concerns/controller_resource.rb +10 -0
  283. data/lib/curation_concerns/engine.rb +20 -0
  284. data/lib/curation_concerns/rails/routes.rb +76 -0
  285. data/lib/curation_concerns/spec_support.rb +10 -0
  286. data/lib/curation_concerns/version.rb +3 -0
  287. data/lib/curation_concerns.rb +8 -0
  288. data/lib/generators/curation_concerns/install_generator.rb +103 -0
  289. data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
  290. data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
  291. data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
  292. data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
  293. data/lib/generators/curation_concerns/work/USAGE +19 -0
  294. data/lib/generators/curation_concerns/work/templates/README +13 -0
  295. data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
  296. data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
  297. data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
  298. data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
  299. data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
  300. data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
  301. data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
  302. data/solr_conf/conf/solrconfig.xml +223 -0
  303. data/spec/abilities/collection_abilities_spec.rb +48 -0
  304. data/spec/abilities/generic_file_abilities_spec.rb +62 -0
  305. data/spec/abilities/generic_work_abilities_spec.rb +58 -0
  306. data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
  307. data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
  308. data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
  309. data/spec/controllers/catalog_controller_spec.rb +115 -0
  310. data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
  311. data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
  312. data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
  313. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
  314. data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
  315. data/spec/controllers/downloads_controller_spec.rb +51 -0
  316. data/spec/controllers/embargoes_controller_spec.rb +114 -0
  317. data/spec/controllers/leases_controller_spec.rb +94 -0
  318. data/spec/factories/collections.rb +15 -0
  319. data/spec/factories/create_curation_concern.rb +3 -0
  320. data/spec/factories/generic_files.rb +31 -0
  321. data/spec/factories/generic_works.rb +54 -0
  322. data/spec/factories/users.rb +28 -0
  323. data/spec/features/add_file_spec.rb +30 -0
  324. data/spec/features/collection_spec.rb +222 -0
  325. data/spec/features/create_work_spec.rb +43 -0
  326. data/spec/features/embargo_spec.rb +51 -0
  327. data/spec/features/lease_spec.rb +49 -0
  328. data/spec/features/update_file_spec.rb +32 -0
  329. data/spec/features/work_generator_spec.rb +58 -0
  330. data/spec/fixtures/Example.ogg +0 -0
  331. data/spec/fixtures/charter.docx +0 -0
  332. data/spec/fixtures/countdown.avi +0 -0
  333. data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
  334. data/spec/fixtures/files/image.png +0 -0
  335. data/spec/fixtures/image.jp2 +0 -0
  336. data/spec/fixtures/image.jpg +0 -0
  337. data/spec/fixtures/piano_note.wav +0 -0
  338. data/spec/fixtures/sample_mpeg4.mp4 +0 -0
  339. data/spec/fixtures/small_file.txt +1 -0
  340. data/spec/fixtures/spoken-text.m4a +0 -0
  341. data/spec/fixtures/test4.pdf +0 -0
  342. data/spec/fixtures/test5.mp3 +0 -0
  343. data/spec/fixtures/world.png +0 -0
  344. data/spec/forms/collection_edit_form_spec.rb +20 -0
  345. data/spec/forms/generic_file_edit_form_spec.rb +33 -0
  346. data/spec/helpers/catalog_helper_spec.rb +58 -0
  347. data/spec/helpers/configuration_helper_spec.rb +13 -0
  348. data/spec/helpers/curation_concerns/.keep +0 -0
  349. data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
  350. data/spec/helpers/render_constraints_helper_spec.rb +19 -0
  351. data/spec/helpers/thumbnail_helper_spec.rb +21 -0
  352. data/spec/helpers/url_helper_spec.rb +22 -0
  353. data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
  354. data/spec/jobs/audit_job_spec.rb +53 -0
  355. data/spec/jobs/characterize_job_spec.rb +23 -0
  356. data/spec/jobs/copy_permissions_job_spec.rb +49 -0
  357. data/spec/jobs/create_derivatives_job_spec.rb +23 -0
  358. data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
  359. data/spec/jobs/import_url_job_spec.rb +45 -0
  360. data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
  361. data/spec/lib/curation_concerns/messages_spec.rb +70 -0
  362. data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
  363. data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
  364. data/spec/matchers/metadata_field_matchers.rb +28 -0
  365. data/spec/matchers/response_matchers.rb +7 -0
  366. data/spec/matchers.rb +24 -0
  367. data/spec/models/checksum_audit_log_spec.rb +66 -0
  368. data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
  369. data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
  370. data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
  371. data/spec/models/fits_datastream_spec.rb +127 -0
  372. data/spec/models/generic_file_spec.rb +619 -0
  373. data/spec/models/generic_work_spec.rb +43 -0
  374. data/spec/models/user_spec.rb +23 -0
  375. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
  376. data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
  377. data/spec/routing/curation_concerns/routes_spec.rb +36 -0
  378. data/spec/routing/route_spec.rb +86 -0
  379. data/spec/services/characterization_service_spec.rb +30 -0
  380. data/spec/services/embargo_service_spec.rb +38 -0
  381. data/spec/services/full_text_extraction_service_spec.rb +5 -0
  382. data/spec/services/generic_file_audit_service_spec.rb +71 -0
  383. data/spec/services/generic_file_indexing_service_spec.rb +57 -0
  384. data/spec/services/generic_work_indexing_service_spec.rb +18 -0
  385. data/spec/services/lease_service_spec.rb +53 -0
  386. data/spec/services/repository_audit_service_spec.rb +18 -0
  387. data/spec/services/versioning_service_spec.rb +32 -0
  388. data/spec/spec_helper.rb +94 -0
  389. data/spec/support/controllers/engine_helpers.rb +7 -0
  390. data/spec/support/curation_concerns/factory_helpers.rb +14 -0
  391. data/spec/support/features/fixture_file_upload.rb +14 -0
  392. data/spec/support/features/session_helpers.rb +41 -0
  393. data/spec/support/features.rb +19 -0
  394. data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
  395. data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
  396. data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
  397. data/spec/tasks/rake_spec.rb +24 -0
  398. data/spec/test_app_templates/Gemfile.extra +1 -0
  399. data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
  400. data/spec/views/catalog/index.html.erb_spec.rb +59 -0
  401. data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
  402. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
  403. data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
  404. data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
  405. data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
  406. data/spec/workers/visibility_copy_worker_spec.rb +70 -0
  407. data/tasks/jetty.rake +15 -0
  408. data/tasks/release.rake +93 -0
  409. data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  410. data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  411. data/vendor/assets/javascripts/handlebars.js +2278 -0
  412. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
  413. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
  414. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
  415. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
  416. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
  417. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
  418. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
  419. data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
  420. data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
  421. data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
  422. data/vendor/assets/stylesheets/token-input-mac.css +204 -0
  423. data/vendor/assets/stylesheets/token-input.css +127 -0
  424. 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,8 @@
1
+ shared_examples 'is_embargoable' do
2
+
3
+ it "has an embargo_release_date attribute" do
4
+ expect(subject).to respond_to(:embargo_release_date)
5
+ expect(subject).to respond_to(:embargo_release_date=)
6
+ end
7
+
8
+ 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
@@ -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
+