hyrax 4.0.0 → 5.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +124 -232
  3. data/.dassie/.env +8 -2
  4. data/.dassie/Gemfile +27 -42
  5. data/.dassie/Gemfile.dassie +2 -0
  6. data/.dassie/app/assets/config/manifest.js +2 -0
  7. data/.dassie/app/assets/stylesheets/hyrax.scss +1 -0
  8. data/.dassie/config/environments/test.rb +1 -0
  9. data/.dassie/config/initializers/hyrax.rb +3 -1
  10. data/.dassie/config/initializers/riiif.rb +11 -7
  11. data/.dassie/config/metadata/collection_resource.yaml +3 -0
  12. data/.dassie/config/metadata/monograph.yaml +8 -0
  13. data/.dassie/config/metadata/sample_metadata.yaml +1 -0
  14. data/.dassie/config/redis.yml +2 -0
  15. data/.dassie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
  16. data/.dassie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
  17. data/.dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb +8 -0
  18. data/.dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb +8 -0
  19. data/.dassie/db/schema.rb +22 -3
  20. data/.dockerignore +7 -0
  21. data/.github/PULL_REQUEST_TEMPLATE.md +10 -7
  22. data/.github/release.yml +5 -2
  23. data/.gitignore +1 -1
  24. data/.koppie/.env +13 -4
  25. data/.koppie/Gemfile +10 -12
  26. data/.koppie/Gemfile.koppie +2 -0
  27. data/.koppie/Rakefile +0 -2
  28. data/.koppie/app/models/ability.rb +1 -5
  29. data/.koppie/app/models/user.rb +0 -2
  30. data/.koppie/config/application.rb +2 -1
  31. data/.koppie/config/arkivo.yml +6 -0
  32. data/.koppie/config/blacklight.yml +2 -2
  33. data/.koppie/config/environments/test.rb +1 -0
  34. data/.koppie/config/features.yml +2 -0
  35. data/.koppie/config/initializers/1_valkyrie.rb +29 -6
  36. data/.koppie/config/initializers/arkivo_constraint.rb +12 -0
  37. data/.koppie/config/initializers/hyrax.rb +10 -4
  38. data/.koppie/config/initializers/riiif.rb +11 -7
  39. data/.koppie/config/metadata/collection_resource.yaml +49 -0
  40. data/.koppie/config/metadata/generic_work.yaml +2 -0
  41. data/.koppie/config/metadata/monograph.yaml +10 -0
  42. data/.koppie/config/role_map.yml +3 -25
  43. data/.koppie/config/routes.rb +1 -2
  44. data/.koppie/config/solr.yml +1 -1
  45. data/.koppie/config/valkyrie_index.yml +4 -10
  46. data/.koppie/config/zotero.yml +6 -0
  47. data/.koppie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
  48. data/.koppie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
  49. data/.koppie/db/schema.rb +12 -1
  50. data/.koppie/yarn.lock +23 -23
  51. data/.regen +1 -1
  52. data/CONTAINERS.md +1 -3
  53. data/Dockerfile +17 -13
  54. data/Gemfile +4 -21
  55. data/Gemfile.dassie +2 -0
  56. data/Gemfile.koppie +2 -0
  57. data/README.md +0 -1
  58. data/Rakefile +0 -11
  59. data/app/actors/hyrax/actors/base_actor.rb +4 -3
  60. data/app/actors/hyrax/actors/embargo_actor.rb +3 -3
  61. data/app/actors/hyrax/actors/lease_actor.rb +5 -2
  62. data/app/assets/javascripts/hyrax/batch_select_all.js +1 -1
  63. data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
  64. data/app/assets/javascripts/hyrax/file_manager/sorting.es6 +3 -2
  65. data/app/assets/stylesheets/hyrax/_file-listing.scss +0 -2
  66. data/app/assets/stylesheets/hyrax/_work-show.scss +19 -3
  67. data/app/assets/stylesheets/hyrax/sidebar.scss +23 -0
  68. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +8 -2
  69. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +7 -1
  70. data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +79 -0
  71. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +64 -14
  72. data/app/controllers/hyrax/admin/workflows_controller.rb +48 -3
  73. data/app/controllers/hyrax/api/items_controller.rb +2 -3
  74. data/app/controllers/hyrax/batch_edits_controller.rb +39 -10
  75. data/app/controllers/hyrax/batch_uploads_controller.rb +5 -1
  76. data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
  77. data/app/controllers/hyrax/downloads_controller.rb +8 -1
  78. data/app/controllers/hyrax/file_sets_controller.rb +50 -6
  79. data/app/controllers/hyrax/my/collections_controller.rb +2 -0
  80. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +16 -2
  81. data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +38 -0
  82. data/app/forms/hyrax/forms/collection_form.rb +0 -15
  83. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -34
  84. data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
  85. data/app/forms/hyrax/forms/file_set_form.rb +2 -2
  86. data/app/forms/hyrax/forms/pcdm_object_form.rb +21 -0
  87. data/app/forms/hyrax/forms/permission_template_form.rb +2 -7
  88. data/app/forms/hyrax/forms/resource_batch_edit_form.rb +118 -0
  89. data/app/forms/hyrax/forms/resource_form.rb +21 -34
  90. data/app/forms/hyrax/forms/work_embargo_form.rb +1 -0
  91. data/app/forms/hyrax/forms/work_form.rb +1 -1
  92. data/app/forms/hyrax/forms/work_lease_form.rb +1 -0
  93. data/app/helpers/hyrax/dashboard_helper_behavior.rb +30 -9
  94. data/app/helpers/hyrax/membership_helper.rb +13 -1
  95. data/app/helpers/hyrax/work_form_helper.rb +0 -107
  96. data/app/indexers/hyrax/file_set_indexer.rb +6 -0
  97. data/app/indexers/hyrax/location_indexer.rb +29 -0
  98. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +36 -5
  99. data/app/indexers/hyrax/valkyrie_work_indexer.rb +9 -2
  100. data/app/inputs/controlled_vocabulary_input.rb +1 -1
  101. data/app/jobs/characterize_job.rb +1 -1
  102. data/app/jobs/create_work_job.rb +36 -4
  103. data/app/jobs/valkyrie_characterization_job.rb +9 -0
  104. data/app/jobs/valkyrie_create_derivatives_job.rb +8 -7
  105. data/app/jobs/valkyrie_ingest_job.rb +1 -4
  106. data/app/models/admin_set.rb +1 -31
  107. data/app/models/collection_branding_info.rb +2 -9
  108. data/app/models/concerns/hyrax/ability.rb +2 -1
  109. data/app/models/concerns/hyrax/collection_behavior.rb +4 -12
  110. data/app/models/concerns/hyrax/file_set/derivatives.rb +3 -2
  111. data/app/models/concerns/hyrax/riiif_file.rb +30 -0
  112. data/app/models/concerns/hyrax/solr_document_behavior.rb +20 -3
  113. data/app/models/hyrax/collection_type.rb +5 -14
  114. data/app/models/hyrax/counter_metric.rb +7 -0
  115. data/app/models/hyrax/file_metadata.rb +9 -9
  116. data/app/models/hyrax/file_set.rb +76 -15
  117. data/app/models/hyrax/orcid_validator.rb +0 -6
  118. data/app/models/hyrax/resource.rb +30 -2
  119. data/app/models/hyrax/work.rb +2 -5
  120. data/app/presenters/hyrax/collection_presenter.rb +0 -17
  121. data/app/presenters/hyrax/embargo_presenter.rb +4 -0
  122. data/app/presenters/hyrax/file_set_presenter.rb +6 -0
  123. data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -7
  124. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +6 -4
  125. data/app/presenters/hyrax/presenter_renderer.rb +0 -7
  126. data/app/presenters/hyrax/version_list_presenter.rb +19 -10
  127. data/app/presenters/hyrax/version_presenter.rb +19 -4
  128. data/app/presenters/hyrax/work_show_presenter.rb +6 -11
  129. data/app/search_builders/hyrax/file_set_search_builder.rb +1 -1
  130. data/app/search_builders/hyrax/valkyrie_abstract_type_relation.rb +37 -0
  131. data/app/search_builders/hyrax/valkyrie_work_relation.rb +9 -0
  132. data/app/services/hyrax/admin_set_create_service.rb +0 -17
  133. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +16 -9
  134. data/app/services/hyrax/collections/collection_member_service.rb +1 -1
  135. data/app/services/hyrax/custom_queries/find_by_date_range.rb +55 -0
  136. data/app/services/hyrax/custom_queries/find_count_by.rb +62 -0
  137. data/app/services/hyrax/custom_queries/find_file_metadata.rb +1 -1
  138. data/app/services/hyrax/custom_queries/find_models_by_access.rb +59 -0
  139. data/app/services/hyrax/derivative_bucketed_storage.rb +25 -0
  140. data/app/services/hyrax/derivative_path.rb +14 -4
  141. data/app/services/hyrax/embargo_manager.rb +106 -13
  142. data/app/services/hyrax/embargo_service.rb +12 -10
  143. data/app/services/hyrax/file_set_derivatives_service.rb +14 -13
  144. data/app/services/hyrax/fixity_check_failure_service.rb +1 -1
  145. data/app/services/hyrax/identifier/dispatcher.rb +9 -2
  146. data/app/services/hyrax/lease_manager.rb +88 -8
  147. data/app/services/hyrax/listeners/file_metadata_listener.rb +16 -8
  148. data/app/services/hyrax/listeners/member_cleanup_listener.rb +2 -28
  149. data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
  150. data/app/services/hyrax/listeners/workflow_listener.rb +8 -11
  151. data/app/services/hyrax/lock_manager.rb +1 -2
  152. data/app/services/hyrax/persist_directly_contained_output_file_service.rb +24 -2
  153. data/app/services/hyrax/riiif_file_resolver.rb +50 -0
  154. data/app/services/hyrax/simple_schema_loader.rb +31 -0
  155. data/app/services/hyrax/solr_query_service.rb +7 -6
  156. data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
  157. data/app/services/hyrax/statistics/over_time.rb +1 -1
  158. data/app/services/hyrax/statistics/users/over_time.rb +3 -1
  159. data/app/services/hyrax/statistics/valkyrie_query_service.rb +49 -0
  160. data/app/services/hyrax/statistics/works/count.rb +1 -1
  161. data/app/services/hyrax/thumbnail_path_service.rb +5 -0
  162. data/app/services/hyrax/valkyrie_persist_derivatives.rb +16 -11
  163. data/app/services/hyrax/valkyrie_upload.rb +16 -28
  164. data/app/services/hyrax/versioning_service.rb +30 -15
  165. data/app/services/hyrax/visibility_intention.rb +1 -4
  166. data/app/services/hyrax/visibility_propagator.rb +1 -1
  167. data/app/services/hyrax/work_uploads_handler.rb +1 -1
  168. data/app/services/hyrax/workflow/actionable_objects.rb +28 -3
  169. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +1 -1
  170. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +1 -1
  171. data/app/services/hyrax/workflow/permission_query.rb +23 -2
  172. data/app/validators/hyrax/collection_membership_validator.rb +1 -1
  173. data/app/views/catalog/_search_form.html.erb +1 -1
  174. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  175. data/app/views/hyrax/admin/workflows/_tabs.html.erb +9 -0
  176. data/app/views/hyrax/admin/workflows/index.html.erb +53 -76
  177. data/app/views/hyrax/base/_file_manager_members.html.erb +2 -2
  178. data/app/views/hyrax/base/_file_manager_resource_form.html.erb +1 -1
  179. data/app/views/hyrax/base/_form.html.erb +0 -10
  180. data/app/views/hyrax/base/_form_permission_embargo.html.erb +1 -1
  181. data/app/views/hyrax/base/_form_permission_lease.html.erb +1 -1
  182. data/app/views/hyrax/base/_form_visibility_component.html.erb +4 -4
  183. data/app/views/hyrax/base/_items.html.erb +1 -1
  184. data/app/views/hyrax/base/_show_actions.html.erb +1 -1
  185. data/app/views/hyrax/base/_workflow_actions.html.erb +25 -23
  186. data/app/views/hyrax/base/file_manager.html.erb +1 -1
  187. data/app/views/hyrax/base/show.json.jbuilder +4 -3
  188. data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
  189. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
  190. data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
  191. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +3 -3
  192. data/app/views/hyrax/file_sets/_versioning.html.erb +5 -5
  193. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -4
  194. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  195. data/app/views/hyrax/file_sets/media_display/_video.html.erb +2 -2
  196. data/app/views/hyrax/file_sets/show.html.erb +5 -3
  197. data/app/views/hyrax/homepage/_explore_collections.html.erb +1 -1
  198. data/app/views/hyrax/my/_search_form.html.erb +1 -1
  199. data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
  200. data/app/views/hyrax/users/_vitals.html.erb +1 -1
  201. data/bin/dev-entrypoint.sh +13 -0
  202. data/chart/hyrax/Chart.yaml +18 -14
  203. data/chart/hyrax/README.md +34 -21
  204. data/chart/hyrax/templates/_helpers.tpl +34 -1
  205. data/chart/hyrax/templates/configmap-env.yaml +12 -2
  206. data/chart/hyrax/templates/secrets.yaml +1 -1
  207. data/chart/hyrax/values.yaml +39 -14
  208. data/config/initializers/file_length_patch.rb +10 -0
  209. data/config/initializers/listeners.rb +4 -10
  210. data/config/initializers/storage_adapter_initializer.rb +1 -1
  211. data/config/locales/hyrax.en.yml +8 -0
  212. data/config/metadata/basic_metadata.yaml +52 -0
  213. data/config/metadata/core_metadata.yaml +4 -0
  214. data/config/metadata/file_set_metadata.yaml +20 -1
  215. data/config/metadata/hyrax_internal_metadata.yaml +57 -0
  216. data/docker-compose-koppie.yml +36 -22
  217. data/docker-compose-sirenia.yml +202 -0
  218. data/docker-compose.yml +42 -26
  219. data/documentation/developing-your-hyrax-based-app.md +6 -14
  220. data/documentation/legacyREADME.md +3 -1
  221. data/hyrax.gemspec +12 -13
  222. data/karma.conf.js +9 -10
  223. data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +2 -0
  224. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
  225. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +11 -7
  226. data/lib/generators/hyrax/templates/db/migrate/20230725222727_create_hyrax_counter_metrics.rb.erb +14 -0
  227. data/lib/generators/hyrax/templates/db/migrate/20230803165135_change_work_id_to_string.rb.erb +5 -0
  228. data/lib/generators/hyrax/templates/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.rb.erb +8 -0
  229. data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +8 -0
  230. data/lib/generators/hyrax/templates/db/seeds.rb +1 -1
  231. data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
  232. data/lib/generators/hyrax/work_resource/templates/metadata.yaml +2 -0
  233. data/lib/hyrax/active_fedora_dummy_model.rb +6 -1
  234. data/lib/hyrax/configuration.rb +147 -43
  235. data/lib/hyrax/controlled_vocabularies/location.rb +7 -1
  236. data/lib/hyrax/engine.rb +2 -1
  237. data/lib/hyrax/form_fields.rb +6 -0
  238. data/lib/hyrax/publisher.rb +23 -3
  239. data/lib/hyrax/redis_event_store.rb +7 -8
  240. data/lib/hyrax/resource_name.rb +4 -0
  241. data/lib/hyrax/specs/capybara.rb +25 -37
  242. data/lib/hyrax/specs/shared_specs/hydra_works.rb +34 -7
  243. data/lib/hyrax/specs/shared_specs/indexers.rb +24 -6
  244. data/lib/hyrax/transactions/collection_destroy.rb +3 -2
  245. data/lib/hyrax/transactions/container.rb +47 -0
  246. data/lib/hyrax/transactions/file_metadata_destroy.rb +20 -0
  247. data/lib/hyrax/transactions/file_set_destroy.rb +3 -1
  248. data/lib/hyrax/transactions/file_set_update.rb +21 -0
  249. data/lib/hyrax/transactions/steps/add_file_sets.rb +6 -0
  250. data/lib/hyrax/transactions/steps/add_to_parent.rb +1 -1
  251. data/lib/hyrax/transactions/steps/apply_permission_template.rb +40 -0
  252. data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +46 -0
  253. data/lib/hyrax/transactions/steps/delete_all_file_sets.rb +46 -0
  254. data/lib/hyrax/transactions/steps/file_metadata_delete.rb +40 -0
  255. data/lib/hyrax/transactions/steps/remove_from_membership.rb +45 -0
  256. data/lib/hyrax/transactions/steps/save.rb +21 -0
  257. data/lib/hyrax/transactions/work_create.rb +1 -0
  258. data/lib/hyrax/transactions/work_destroy.rb +3 -2
  259. data/lib/hyrax/version.rb +1 -1
  260. data/lib/hyrax.rb +1 -0
  261. data/lib/tasks/collection_type_global_id.rake +9 -4
  262. data/lib/tasks/embargo_lease.rake +1 -0
  263. data/lib/valkyrie/indexing/solr/indexing_adapter.rb +2 -0
  264. data/lib/wings/active_fedora_converter/default_work.rb +7 -2
  265. data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
  266. data/lib/wings/active_fedora_converter.rb +53 -11
  267. data/lib/wings/attribute_transformer.rb +24 -17
  268. data/lib/wings/model_transformer.rb +23 -12
  269. data/lib/wings/orm_converter.rb +23 -18
  270. data/lib/wings/setup.rb +23 -3
  271. data/lib/wings/valkyrie/persister.rb +4 -2
  272. data/lib/wings/valkyrie/storage.rb +8 -90
  273. data/lib/wings.rb +5 -0
  274. data/package.json +3 -1
  275. data/tasks/hyrax_dev.rake +2 -33
  276. data/template.rb +1 -1
  277. metadata +104 -81
  278. data/.engine_cart.yml +0 -3
  279. data/app/forms/hyrax/forms/file_manager_form.rb +0 -35
  280. data/app/services/hyrax/collections/migration_service.rb +0 -113
  281. data/app/views/hyrax/base/_form_collections_error.html.erb +0 -1
  282. data/app/views/hyrax/base/_form_in_works_error.html.erb +0 -3
  283. data/app/views/hyrax/base/_form_ordered_members_error.html.erb +0 -3
  284. data/app/views/hyrax/base/_form_visibility_error.html.erb +0 -19
  285. data/app/views/hyrax/users/_user_util_links_extra.html.erb +0 -0
  286. data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +0 -9
@@ -18,7 +18,7 @@ module Wings
18
18
  #
19
19
  # @note the `Valkyrie::Resource` object passed to this class **must** have an
20
20
  # `#internal_resource` mapping it to an `ActiveFedora::Base` class.
21
- class ActiveFedoraConverter
21
+ class ActiveFedoraConverter # rubocop:disable Metrics/ClassLength
22
22
  ##
23
23
  # Accesses the Class implemented for handling resource attributes
24
24
  # @return [Class]
@@ -93,7 +93,7 @@ module Wings
93
93
  # then the id hasn't been minted and shouldn't yet be set.
94
94
  # @return [String]
95
95
  def id
96
- return resource[:id].to_s if resource[:id]&.is_a?(::Valkyrie::ID) && resource[:id].present?
96
+ return resource[:id].to_s if resource[:id].present? && resource[:id]&.is_a?(::Valkyrie::ID)
97
97
  return "" unless resource.respond_to?(:alternate_ids)
98
98
 
99
99
  resource.alternate_ids.first.to_s
@@ -130,6 +130,7 @@ module Wings
130
130
 
131
131
  ##
132
132
  # apply attributes to the ActiveFedora model
133
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
133
134
  def apply_attributes_to_model(af_object)
134
135
  case af_object
135
136
  when Hydra::AccessControl
@@ -137,15 +138,29 @@ module Wings
137
138
  when ActiveFedora::File
138
139
  add_file_attributes(af_object)
139
140
  else
140
- converted_attrs = normal_attributes
141
- members = Array.wrap(converted_attrs.delete(:members))
142
- files = converted_attrs.delete(:files)
143
- af_object.attributes = converted_attrs
144
- members.empty? ? af_object.try(:ordered_members)&.clear : af_object.try(:ordered_members=, members)
145
- af_object.try(:members)&.replace(members)
146
- af_object.files.build_or_set(files) if files
141
+ parse_attributes(af_object)
147
142
  end
148
143
  end
144
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
145
+
146
+ def parse_attributes(af_object)
147
+ converted_attrs = normal_attributes
148
+ members = Array.wrap(converted_attrs.delete(:members))
149
+ files = converted_attrs.delete(:files)
150
+ af_object.attributes = converted_attrs
151
+ af_object.extracted_text = create_extrated_text(af_object) if resource.attributes[:extracted_text_id].present?
152
+ perform_lease_conversion(af_object: af_object, resource: resource)
153
+ perform_embargo_conversion(af_object: af_object, resource: resource)
154
+ members.empty? ? af_object.try(:ordered_members)&.clear : af_object.try(:ordered_members=, members)
155
+ af_object.try(:members)&.replace(members)
156
+ af_object.files.build_or_set(files) if files
157
+ end
158
+
159
+ def create_extrated_text(af_object)
160
+ pcdm_et_file = af_object.extracted_text.presence || af_object.create_extracted_text
161
+ pcdm_et_file.content = Hyrax.custom_queries.find_many_file_metadata_by_use(resource: resource, use: Hyrax::FileMetadata::Use::EXTRACTED_TEXT).first&.content
162
+ pcdm_et_file
163
+ end
149
164
 
150
165
  # Add attributes from resource which aren't AF properties into af_object
151
166
  def add_access_control_attributes(af_object)
@@ -155,11 +170,38 @@ module Wings
155
170
 
156
171
  # for files, add attributes to metadata_node, plus some other work
157
172
  def add_file_attributes(af_object)
158
- af_object.metadata_node.attributes = normal_attributes
173
+ add_file_uri(af_object)
174
+ converted_attrs = normal_attributes
175
+ pcdm_use = converted_attrs.delete(:pcdm_use)
176
+ af_object.metadata_node.attributes = converted_attrs
177
+ af_object.pcdm_use = pcdm_use.first if pcdm_use.present? && pcdm_use.first.present?
159
178
  af_object.original_name = resource.original_filename
160
- new_type = (resource.type - af_object.metadata_node.type.to_a).first
179
+ new_type = (resource.pcdm_use - af_object.metadata_node.type.to_a).first
161
180
  af_object.metadata_node.type = new_type if new_type
162
181
  af_object.mime_type = resource.mime_type
163
182
  end
183
+
184
+ def add_file_uri(af_object)
185
+ file_uri = Hyrax.storage_adapter.fedora_identifier(id: resource.file_identifier)
186
+ af_object.uri = file_uri.to_s if af_object.uri.to_s.blank? && file_uri.to_s.present?
187
+ end
188
+
189
+ def perform_lease_conversion(af_object:, resource:)
190
+ # TODO(#6134): af_object.lease.class has the same name as resource.lease.class; however, each class has a different object_id
191
+ # so a type mismatch happens. the code below coerces the one object into the other
192
+ return if !resource.try(:lease) || !af_object.reflections.include?(:lease) || af_object.lease&.id
193
+
194
+ resource_lease_dup = af_object.reflections.fetch(:lease).klass.new(resource.lease.attributes.except(:id, :internal_resource, :created_at, :updated_at, :new_record))
195
+ af_object.lease = resource_lease_dup
196
+ end
197
+
198
+ def perform_embargo_conversion(af_object:, resource:)
199
+ # TODO(#6134): af_object.embargo.class has the same name as resource.embargo.class; however, each class has a different object_id
200
+ # so a type mismatch happens. the code below coerces the one object into the other
201
+ return if !resource.try(:embargo) || !af_object.reflections.include?(:embargo) || af_object.embargo&.id
202
+
203
+ resource_embargo_dup = af_object.reflections.fetch(:embargo).klass.new(resource.embargo.attributes.except(:id, :internal_resource, :created_at, :updated_at, :new_record))
204
+ af_object.embargo = resource_embargo_dup
205
+ end
164
206
  end
165
207
  end
@@ -15,29 +15,36 @@ module Wings
15
15
  end
16
16
  end
17
17
 
18
- def self.run(obj) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
19
- attrs = obj.reflections.each_with_object({}) do |(key, reflection), mem|
18
+ def self.run(obj) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
19
+ attrs = obj.reflections.each_with_object({}) do |(key, reflection), mem| # rubocop:disable Metrics/BlockLength
20
20
  case reflection
21
- when ActiveFedora::Reflection::HasManyReflection,
22
- ActiveFedora::Reflection::HasAndBelongsToManyReflection,
23
- ActiveFedora::Reflection::IndirectlyContainsReflection
24
- mem[:"#{key.to_s.singularize}_ids"] =
25
- obj.association(key).ids_reader
26
- when ActiveFedora::Reflection::DirectlyContainsReflection
27
- mem[:"#{key.to_s.singularize}_ids"] =
28
- Array(obj.public_send(reflection.name)).map(&:id)
29
- when ActiveFedora::Reflection::FilterReflection,
30
- ActiveFedora::Reflection::OrdersReflection,
31
- ActiveFedora::Reflection::HasSubresourceReflection,
32
- ActiveFedora::Reflection::BelongsToReflection,
33
- ActiveFedora::Reflection::BasicContainsReflection
21
+ when ActiveFedora::Reflection::BelongsToReflection, # uses foreign_key SingularRDFPropertyReflection
22
+ ActiveFedora::Reflection::BasicContainsReflection, # ???
23
+ ActiveFedora::Reflection::FilterReflection, # rely on :extending_from
24
+ ActiveFedora::Reflection::HasAndBelongsToManyReflection, # uses foreign_key RDFPropertyReflection
25
+ ActiveFedora::Reflection::HasManyReflection, # captured by inverse relation
26
+ ActiveFedora::Reflection::HasSubresourceReflection, # ???
34
27
  :noop
28
+ when ActiveFedora::Reflection::OrdersReflection
29
+ mem[:"#{reflection.options[:unordered_reflection].name.to_s.singularize}_ids"] ||= []
30
+ mem[:"#{reflection.options[:unordered_reflection].name.to_s.singularize}_ids"] +=
31
+ obj.association(reflection.name).target_ids_reader
35
32
  when ActiveFedora::Reflection::DirectlyContainsOneReflection
36
33
  mem[:"#{key.to_s.singularize}_id"] =
37
34
  obj.public_send(reflection.name)&.id
35
+ when ActiveFedora::Reflection::IndirectlyContainsReflection
36
+ mem[:"#{key.to_s.singularize}_ids"] ||= []
37
+ mem[:"#{key.to_s.singularize}_ids"] +=
38
+ obj.association(key).ids_reader
39
+ when ActiveFedora::Reflection::DirectlyContainsReflection
40
+ mem[:"#{key.to_s.singularize}_ids"] ||= []
41
+ mem[:"#{key.to_s.singularize}_ids"] +=
42
+ Array(obj.public_send(reflection.name)).map(&:id)
43
+ when ActiveFedora::Reflection::RDFPropertyReflection
44
+ mem[reflection.name.to_sym] =
45
+ obj.public_send(reflection.name.to_sym)
38
46
  else
39
- mem[reflection.foreign_key.to_sym] =
40
- obj.public_send(reflection.foreign_key.to_sym)
47
+ raise NotImplementedError, "Expected a known ActiveFedora::Reflection, but got #{reflection}"
41
48
  end
42
49
  end
43
50
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Metrics/ClassLength
3
4
  module Wings
4
5
  ##
5
6
  # Transforms ActiveFedora models or objects into Valkyrie::Resource models or
@@ -34,7 +35,7 @@ module Wings
34
35
  #
35
36
  # @param pcdm_object [ActiveFedora::Base]
36
37
  #
37
- # @return [::Valkyrie::Resource] a resource mirroiring `pcdm_object`
38
+ # @return [::Valkyrie::Resource] a resource mirroring `pcdm_object`
38
39
  def self.for(pcdm_object)
39
40
  new(pcdm_object: pcdm_object).build
40
41
  end
@@ -43,6 +44,7 @@ module Wings
43
44
  # Builds a `Valkyrie::Resource` equivalent to the `pcdm_object`
44
45
  #
45
46
  # @return [::Valkyrie::Resource] a resource mirroring `pcdm_object`
47
+ # rubocop:disable Metrics/AbcSize
46
48
  def build
47
49
  klass = cache.fetch(pcdm_object.class) do
48
50
  OrmConverter.to_valkyrie_resource_class(klass: pcdm_object.class)
@@ -53,7 +55,25 @@ module Wings
53
55
  attrs = attributes.tap { |hash| hash[:new_record] = pcdm_object.new_record? }
54
56
  attrs[:alternate_ids] = [::Valkyrie::ID.new(pcdm_object.id)] if pcdm_object.id
55
57
 
56
- klass.new(**attrs).tap { |resource| ensure_current_permissions(resource) }
58
+ klass.new(**attrs).tap do |resource|
59
+ resource.lease = pcdm_object.lease&.valkyrie_resource if pcdm_object.respond_to?(:lease) && pcdm_object.lease
60
+ resource.embargo = pcdm_object.embargo&.valkyrie_resource if pcdm_object.respond_to?(:embargo) && pcdm_object.embargo
61
+ check_size(resource)
62
+ check_pcdm_use(resource)
63
+ ensure_current_permissions(resource)
64
+ end
65
+ end
66
+
67
+ def check_size(resource)
68
+ return unless resource.respond_to?(:recorded_size) && pcdm_object.respond_to?(:size)
69
+ resource.recorded_size = [pcdm_object.size.to_i]
70
+ end
71
+
72
+ def check_pcdm_use(resource)
73
+ return unless resource.respond_to?(:pcdm_use) &&
74
+ pcdm_object.respond_to?(:metadata_node) &&
75
+ pcdm_object&.metadata_node&.respond_to?(:type)
76
+ resource.pcdm_use = pcdm_object.metadata_node.type.to_a
57
77
  end
58
78
 
59
79
  def ensure_current_permissions(resource)
@@ -130,17 +150,9 @@ module Wings
130
150
  { :id => pcdm_object.id,
131
151
  :created_at => pcdm_object.try(:create_date),
132
152
  :updated_at => pcdm_object.try(:modified_date),
133
- :member_ids => member_ids,
134
153
  ::Valkyrie::Persistence::Attributes::OPTIMISTIC_LOCK => lock_token }
135
154
  end
136
155
 
137
- # Prefer ordered members, but if ordered members don't exist, use non-ordered members.
138
- def member_ids
139
- ordered_member_ids = pcdm_object.try(:ordered_member_ids)
140
- return ordered_member_ids if ordered_member_ids.present?
141
- pcdm_object.try(:member_ids)
142
- end
143
-
144
156
  def lock_token
145
157
  result = []
146
158
  result << ::Valkyrie::Persistence::OptimisticLockToken.new(adapter_id: 'wings-fedora-etag', token: pcdm_object.etag) unless pcdm_object.new_record?
@@ -155,7 +167,6 @@ module Wings
155
167
  def append_embargo(attrs)
156
168
  return unless pcdm_object.try(:embargo)
157
169
  embargo_attrs = pcdm_object.embargo.attributes.symbolize_keys
158
- embargo_attrs[:embargo_history] = embargo_attrs[:embargo_history].to_a
159
170
  embargo_attrs[:id] = ::Valkyrie::ID.new(embargo_attrs[:id]) if embargo_attrs[:id]
160
171
 
161
172
  attrs[:embargo] = Hyrax::Embargo.new(**embargo_attrs)
@@ -164,7 +175,6 @@ module Wings
164
175
  def append_lease(attrs)
165
176
  return unless pcdm_object.try(:lease)
166
177
  lease_attrs = pcdm_object.lease.attributes.symbolize_keys
167
- lease_attrs[:lease_history] = lease_attrs[:embargo_history].to_a
168
178
  lease_attrs[:id] = ::Valkyrie::ID.new(lease_attrs[:id]) if lease_attrs[:id]
169
179
 
170
180
  attrs[:lease] = Hyrax::Lease.new(**lease_attrs)
@@ -186,3 +196,4 @@ module Wings
186
196
  end
187
197
  end
188
198
  end
199
+ # rubocop:enable Metrics/ClassLength
@@ -78,29 +78,34 @@ module Wings
78
78
  end
79
79
 
80
80
  # add reflection associations
81
- ldp_reflections = (klass.try(:reflections) || []).select do |_key, reflection|
81
+ (klass.try(:reflections) || []).each do |reflection_key, reflection|
82
82
  case reflection
83
- when ActiveFedora::Reflection::FilterReflection,
84
- ActiveFedora::Reflection::OrdersReflection,
85
- ActiveFedora::Reflection::BasicContainsReflection,
86
- ActiveFedora::Reflection::HasSubresourceReflection
87
- false
88
- else
89
- true
90
- end
91
- end
92
-
93
- ldp_reflections.each do |reflection_key, reflection|
94
- if reflection.collection?
95
- type = ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
83
+ when ActiveFedora::Reflection::BelongsToReflection, # uses foreign_key SingularRDFPropertyReflection
84
+ ActiveFedora::Reflection::BasicContainsReflection, # ???
85
+ ActiveFedora::Reflection::FilterReflection, # rely on :extending_from
86
+ ActiveFedora::Reflection::HasAndBelongsToManyReflection, # uses foreign_key RDFPropertyReflection
87
+ ActiveFedora::Reflection::HasManyReflection, # captured by inverse relation
88
+ ActiveFedora::Reflection::HasSubresourceReflection, # ???
89
+ ActiveFedora::Reflection::OrdersReflection # map to :unordered_association in Wings::AttributeTransformer (but retain order)
90
+ next
91
+ when ActiveFedora::Reflection::DirectlyContainsOneReflection
92
+ attribute_name = (reflection_key.to_s.singularize + '_id').to_sym
93
+ type = ::Valkyrie::Types::ID.optional
94
+ when ActiveFedora::Reflection::DirectlyContainsReflection,
95
+ ActiveFedora::Reflection::IndirectlyContainsReflection
96
96
  attribute_name = (reflection_key.to_s.singularize + '_ids').to_sym
97
+ type = ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
98
+ when ActiveFedora::Reflection::SingularRDFPropertyReflection
99
+ attribute_name = reflection.name.to_sym
100
+ type = ::Valkyrie::Types::ID.optional
101
+ when ActiveFedora::Reflection::RDFPropertyReflection
102
+ attribute_name = reflection.name.to_sym
103
+ type = ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
97
104
  else
98
- type = ::Valkyrie::Types::ID.optional
99
- attribute_name = (reflection_key.to_s.singularize + '_id').to_sym
105
+ raise NotImplementedError, "Expected a known ActiveFedora::Reflection, but got #{reflection}"
100
106
  end
101
107
 
102
- next if fields.include?(attribute_name)
103
- attribute attribute_name, type
108
+ attribute(attribute_name, type)
104
109
  end
105
110
 
106
111
  def internal_resource
data/lib/wings/setup.rb CHANGED
@@ -36,6 +36,7 @@ module ActiveFedora
36
36
  alias eql? ==
37
37
 
38
38
  def self.supports_property?(property)
39
+ return true if ['pcdm_use'].include?(property.to_s)
39
40
  properties.key?(property.to_s)
40
41
  end
41
42
 
@@ -46,6 +47,14 @@ module ActiveFedora
46
47
  def self.default_sort_params
47
48
  ["system_create_dtsi asc"]
48
49
  end
50
+
51
+ def pcdm_use
52
+ metadata.type
53
+ end
54
+
55
+ def pcdm_use=(value)
56
+ metadata.type = value
57
+ end
49
58
  end
50
59
 
51
60
  module WithMetadata
@@ -56,6 +65,14 @@ module ActiveFedora
56
65
  def changed_attributes
57
66
  super.except(:file_hash)
58
67
  end
68
+
69
+ def pcdm_use
70
+ type
71
+ end
72
+
73
+ def pcdm_use=(value)
74
+ self.type = value
75
+ end
59
76
  end
60
77
  end
61
78
 
@@ -81,12 +98,12 @@ end
81
98
  Valkyrie::MetadataAdapter.register(
82
99
  Wings::Valkyrie::MetadataAdapter.new, :wings_adapter
83
100
  )
84
- Valkyrie.config.metadata_adapter = :wings_adapter
101
+ Valkyrie.config.metadata_adapter = :wings_adapter unless Hyrax.config.disable_wings
85
102
 
86
103
  Valkyrie::StorageAdapter.register(
87
104
  Wings::Valkyrie::Storage.new, :active_fedora
88
105
  )
89
- Valkyrie.config.storage_adapter = :active_fedora
106
+ Valkyrie.config.storage_adapter = :active_fedora unless Hyrax.config.disable_wings
90
107
 
91
108
  # TODO: Custom query registration is not Wings specific. These custom_queries need to be registered for other adapters too.
92
109
  # A refactor is needed to add the default implementations to hyrax.rb and only handle the wings specific overrides here.
@@ -102,7 +119,10 @@ custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
102
119
  Wings::CustomQueries::FindCollectionsByType,
103
120
  Wings::CustomQueries::FindFileMetadata, # override Hyrax::CustomQueries::FindFileMetadata
104
121
  Wings::CustomQueries::FindIdsByModel,
105
- Wings::CustomQueries::FindManyByAlternateIds] # override Hyrax::CustomQueries::FindManyByAlternateIds
122
+ Wings::CustomQueries::FindManyByAlternateIds,
123
+ Hyrax::CustomQueries::FindModelsByAccess,
124
+ Hyrax::CustomQueries::FindCountBy,
125
+ Hyrax::CustomQueries::FindByDateRange] # override Hyrax::CustomQueries::FindManyByAlternateIds
106
126
  custom_queries.each do |query_handler|
107
127
  Valkyrie.config.metadata_adapter.query_service.custom_queries.register_query_handler(query_handler)
108
128
  end
@@ -22,8 +22,9 @@ module Wings
22
22
 
23
23
  # Persists a resource using ActiveFedora
24
24
  # @param [Valkyrie::Resource] resource
25
+ # @param [Boolean] perform_af_validation
25
26
  # @return [Valkyrie::Resource] the persisted/updated resource
26
- def save(resource:)
27
+ def save(resource:, perform_af_validation: false)
27
28
  af_object = resource_factory.from_resource(resource: resource)
28
29
 
29
30
  check_lock_tokens(af_object: af_object, resource: resource)
@@ -31,7 +32,8 @@ module Wings
31
32
  # the #save! api differs between ActiveFedora::Base and ActiveFedora::File objects,
32
33
  # if we get a falsey response, we expect we have a File that has failed to save due
33
34
  # to empty content
34
- af_object.save! ||
35
+ # we disable validation on the Active Fedora object, only if validations have already been run and passed
36
+ af_object.save!(validate: perform_af_validation) ||
35
37
  raise(FailedSaveError.new("#{af_object.class}#save! returned non-true. It might be missing required content.", obj: af_object))
36
38
 
37
39
  resource_factory.to_resource(object: af_object)
@@ -19,14 +19,9 @@ module Wings
19
19
  # For use with Hyrax, this adapter defaults to Fedora 4.
20
20
  class Storage < ::Valkyrie::Storage::Fedora
21
21
  DEFAULT_CTYPE = 'application/octet-stream'
22
- LINK_HEADER = "<http://www.w3.org/ns/ldp#NonRDFSource>; rel=\"type\""
23
22
  FILES_PATH = 'files'
24
- VERSIONS_SLUG = '/fcr:versions'
25
-
26
- attr_reader :sha1
27
23
 
28
24
  def initialize(connection: Ldp::Client.new(ActiveFedora.fedora.host), base_path: ActiveFedora.fedora.base_path, fedora_version: 4)
29
- @sha1 = fedora_version == 5 ? "sha" : "sha1"
30
25
  super
31
26
  end
32
27
 
@@ -36,84 +31,19 @@ module Wings
36
31
  ::Valkyrie::ID.new(id.to_s.sub(/^.+\/\//, PROTOCOL))
37
32
  end
38
33
 
39
- ##
40
- # @param key [Symbol] the key for plugin behavior to check support for
41
- #
42
- # @return [Boolean] whether
43
- def supports?(key)
44
- key == :versions
45
- end
46
-
47
34
  def upload(file:, original_filename:, resource:, content_type: DEFAULT_CTYPE, # rubocop:disable Metrics/ParameterLists
48
- resource_uri_transformer: default_resource_uri_transformer, use: Hydra::PCDM::Vocab::PCDMTerms.File,
49
- id_hint: 'original', **extra_arguments)
35
+ resource_uri_transformer: default_resource_uri_transformer, use: Hydra::PCDM::Vocab::PCDMTerms.File, # rubocop:disable Lint/UnusedMethodArgument
36
+ id_hint: 'original', **_extra_arguments)
50
37
  id = if resource.try(:file_set?)
51
38
  upload_with_works(resource: resource, file: file, use: use)
52
39
  else
53
- put_file(file: file,
54
- original_filename: original_filename,
55
- resource: resource,
56
- content_type: content_type,
57
- resource_uri_transformer: resource_uri_transformer,
58
- id_hint: id_hint, **extra_arguments)
40
+ return super(file: file, original_filename: original_filename, resource: resource, content_type: content_type, resource_uri_transformer: resource_uri_transformer_factory(id_hint))
59
41
  end
60
-
61
42
  find_by(id: cast_to_valkyrie_id(id))
62
43
  end
63
44
 
64
- ##
65
- # @return [Enumerable<Version> ordered list of versions
66
- def find_versions(id:)
67
- response = connection.http.get(fedora_identifier(id: id) + VERSIONS_SLUG)
68
- return [] if response.status == 404
69
-
70
- reader = RDF::Reader.for(content_type: response.headers['content-type'])
71
- version_graph = RDF::Graph.new << reader.new(response.body)
72
- query = { predicate: RDF::Vocab::Fcrepo4.hasVersion }
73
-
74
- version_graph.query(query).objects.map do |uri|
75
- timestamp =
76
- version_graph.query([uri, RDF::Vocab::Fcrepo4.created, :created])
77
- .first_object
78
- .object
79
- Version.new(id: cast_to_valkyrie_id(uri.to_s), created: timestamp, adapter: self)
80
- end.sort
81
- end
82
-
83
- ##
84
- # abstractly, {Version} objects should have an {#id} and be orderable
85
- # over {#<=>} (allowing e.g. `#sort` to define a consistent order---
86
- # oldest to newest---for a collection of versions). the {#id} should be a
87
- # globally unique identifier for the version.
88
- #
89
- # this implementation uses an orderable {#version_token}. in practice
90
- # the token is the fcrepo created date for the version, as extracted from
91
- # the versions graph.
92
- Version = Struct.new("Version", :id, :created, :adapter, keyword_init: true) do
93
- include Comparable
94
-
95
- ##
96
- # @return [#read]
97
- def io
98
- adapter.find_by(id: id)
99
- end
100
-
101
- def version_token
102
- created
103
- end
104
-
105
- def <=>(other)
106
- raise ArgumentError unless other.respond_to?(:version_token)
107
- version_token <=> other.version_token
108
- end
109
- end
110
-
111
45
  private
112
46
 
113
- def digest_for(file)
114
- "#{sha1}=#{Digest::SHA1.file(file)}"
115
- end
116
-
117
47
  def default_resource_uri_transformer
118
48
  lambda do |resource, hint|
119
49
  id = [CGI.escape(resource.id), FILES_PATH, hint].join('/')
@@ -121,24 +51,12 @@ module Wings
121
51
  end
122
52
  end
123
53
 
124
- ##
125
- # Create a file with HTTP put; no containers here.
126
- # @return [String] the identifier of the created file
127
- def put_file(file:, original_filename:, resource:, content_type:, # rubocop:disable Metrics/ParameterLists
128
- resource_uri_transformer:, id_hint:, **_extra_arguments)
129
- identifier = resource_uri_transformer.call(resource, id_hint)
130
-
131
- connection.http.put do |request|
132
- request.url identifier
133
- request.headers['Content-Type'] = content_type
134
- request.headers['Content-Length'] = (file.try(:size) || file.try(:length)).to_s
135
- request.headers['Content-Disposition'] = "attachment; filename=\"#{original_filename}\""
136
- request.headers['digest'] = digest_for(file)
137
- request.headers['link'] = LINK_HEADER
138
- request.body = Faraday::UploadIO.new(file, content_type, original_filename)
54
+ # Transforms default_resource_uri_transformer to conform to Valkyrie's
55
+ # expected interface of passing a resource and base url.
56
+ def resource_uri_transformer_factory(hint)
57
+ lambda do |resource, _base_url|
58
+ default_resource_uri_transformer.call(resource, hint)
139
59
  end
140
-
141
- identifier
142
60
  end
143
61
 
144
62
  def upload_with_works(resource:, file:, use:)
data/lib/wings.rb CHANGED
@@ -15,6 +15,8 @@
15
15
  # However, these dependencies should be considered temprorary: this code will
16
16
  # be deprecated for removal in a future release.
17
17
  #
18
+ # @deprecated Wings will be removed when ActiveFedora is no longer supported by Hyrax.
19
+ #
18
20
  # @example casting an ActiveFedora model to Valkyrie
19
21
  # work = GenericWork.create(title: ['Comet in Moominland'])
20
22
  # resource = work.valkyrie_resource
@@ -56,6 +58,9 @@
56
58
  # @see https://wiki.duraspace.org/display/samvera/Hyrax-Valkyrie+Development+Working+Group
57
59
  # for further context regarding the approach
58
60
  module Wings
61
+ Deprecation.warn(self, "ActiveFedora and Wings will be removed from a future major release of Hyrax in favor " \
62
+ "of Valkyrie resource models. Please migrate your models from ActiveFedora::Base to Hyrax::Resource.")
63
+
59
64
  ##
60
65
  # @api public
61
66
  #
data/package.json CHANGED
@@ -6,6 +6,8 @@
6
6
  "karma-chrome-launcher": "^3.1.1",
7
7
  "karma-coffee-preprocessor": "^1.0.1",
8
8
  "karma-jasmine": "^4.0.2",
9
- "karma-spec-reporter": "^0.0.34"
9
+ "karma-selenium-grid-launcher": "^0.3.0",
10
+ "karma-spec-reporter": "^0.0.34",
11
+ "selenium-webdriver": "^4.10.0"
10
12
  }
11
13
  }
data/tasks/hyrax_dev.rake CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'English'
3
3
  require 'rspec/core/rake_task'
4
- require 'engine_cart/rake_task'
5
4
  require 'rubocop/rake_task'
6
5
 
7
6
  desc 'Run style checker'
@@ -11,16 +10,6 @@ end
11
10
 
12
11
  RSpec::Core::RakeTask.new(:spec)
13
12
 
14
- desc 'Spin up test servers and run specs'
15
- task :spec_with_app_load do
16
- require 'solr_wrapper' # necessary for rake_support to work
17
- require 'fcrepo_wrapper' # necessary for rake_support to work
18
- require 'active_fedora/rake_support'
19
- with_test_server do
20
- Rake::Task['spec'].invoke
21
- end
22
- end
23
-
24
13
  desc "Sort locales keys in alphabetic order."
25
14
  task :i18n_sorter do
26
15
  require 'i18n_yaml_sorter'
@@ -34,28 +23,8 @@ task :i18n_sorter do
34
23
  end
35
24
  end
36
25
 
37
- if Gem.loaded_specs.key? 'engine_cart'
38
- namespace :engine_cart do
39
- # This generate task should only add its action to an existing engine_cart:generate task
40
- raise 'engine_cart:generate task should already be defined' unless Rake::Task.task_defined?('engine_cart:generate')
41
- task :generate do |_task|
42
- puts 'Running post-generation operations...'
43
- Rake::Task['engine_cart:after_generate'].invoke
44
- end
45
-
46
- desc 'Operations that need to run after the test_app migrations have run'
47
- task :after_generate do
48
- puts 'Creating default collection type...'
49
- EngineCart.within_test_app do
50
- raise "EngineCart failed on with: #{$CHILD_STATUS}" unless
51
- system('bundle exec rake hyrax:default_collection_types:create')
52
- end
53
- end
54
- end
55
- end
56
-
57
- desc 'Generate the engine_cart and spin up test servers and run specs'
58
- task ci: ['rubocop', 'engine_cart:generate'] do
26
+ desc 'Run rubocop and then run specs'
27
+ task ci: ['rubocop'] do
59
28
  puts 'running continuous integration'
60
29
  Rake::Task['spec_with_app_load'].invoke
61
30
  end
data/template.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  # Hack for https://github.com/rails/rails/issues/35153
3
3
  gsub_file 'Gemfile', /^gem ["']sqlite3["']$/, 'gem "sqlite3", "~> 1.3.0"'
4
- gem 'hyrax', '4.0.0'
4
+ gem 'hyrax', '5.0.0.rc2'
5
5
  run 'bundle install'
6
6
  generate 'hyrax:install', '-f'