dog_biscuits 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +115 -0
  3. data/.codeclimate.yml +52 -0
  4. data/.gitignore +24 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +45 -0
  7. data/.rubocop_todo.yml +92 -0
  8. data/.travis.yml +18 -0
  9. data/CODE_OF_CONDUCT.md +36 -0
  10. data/CONTRIBUTING.md +161 -0
  11. data/Gemfile +40 -0
  12. data/LICENSE +14 -0
  13. data/README.md +98 -0
  14. data/Rakefile +35 -0
  15. data/SUPPORT.md +5 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +7 -0
  18. data/dog_biscuits.gemspec +38 -0
  19. data/lib/dog_biscuits.rb +352 -0
  20. data/lib/dog_biscuits/actors/apply_authorities.rb +32 -0
  21. data/lib/dog_biscuits/actors/singular_attributes.rb +17 -0
  22. data/lib/dog_biscuits/blacklight/commands.rb +118 -0
  23. data/lib/dog_biscuits/configuration.rb +506 -0
  24. data/lib/dog_biscuits/importers/authority.rb +65 -0
  25. data/lib/dog_biscuits/indexers/collection_indexer.rb +10 -0
  26. data/lib/dog_biscuits/indexers/concerns/indexes_common.rb +58 -0
  27. data/lib/dog_biscuits/indexers/conference_item_indexer.rb +17 -0
  28. data/lib/dog_biscuits/indexers/dataset_indexer.rb +25 -0
  29. data/lib/dog_biscuits/indexers/digital_archival_object_indexer.rb +19 -0
  30. data/lib/dog_biscuits/indexers/exam_paper_indexer.rb +10 -0
  31. data/lib/dog_biscuits/indexers/journal_article_indexer.rb +15 -0
  32. data/lib/dog_biscuits/indexers/package_indexer.rb +19 -0
  33. data/lib/dog_biscuits/indexers/published_work_indexer.rb +16 -0
  34. data/lib/dog_biscuits/indexers/thesis_indexer.rb +16 -0
  35. data/lib/dog_biscuits/models/authorities/agent.rb +78 -0
  36. data/lib/dog_biscuits/models/authorities/agents/group.rb +59 -0
  37. data/lib/dog_biscuits/models/authorities/agents/historic_person.rb +55 -0
  38. data/lib/dog_biscuits/models/authorities/agents/organisation.rb +56 -0
  39. data/lib/dog_biscuits/models/authorities/agents/person.rb +75 -0
  40. data/lib/dog_biscuits/models/authorities/concept.rb +91 -0
  41. data/lib/dog_biscuits/models/authorities/concept_scheme.rb +65 -0
  42. data/lib/dog_biscuits/models/authorities/event.rb +74 -0
  43. data/lib/dog_biscuits/models/authorities/place.rb +86 -0
  44. data/lib/dog_biscuits/models/authorities/project.rb +60 -0
  45. data/lib/dog_biscuits/models/authority.rb +42 -0
  46. data/lib/dog_biscuits/models/collections/collection.rb +32 -0
  47. data/lib/dog_biscuits/models/concerns/behaviours/pure_specific_behaviour.rb +17 -0
  48. data/lib/dog_biscuits/models/concerns/behaviours/validate_concept_related.rb +12 -0
  49. data/lib/dog_biscuits/models/concerns/behaviours/validate_concept_scheme.rb +16 -0
  50. data/lib/dog_biscuits/models/concerns/behaviours/validate_label.rb +12 -0
  51. data/lib/dog_biscuits/models/concerns/behaviours/validate_place.rb +12 -0
  52. data/lib/dog_biscuits/models/concerns/behaviours/work_behaviour.rb +21 -0
  53. data/lib/dog_biscuits/models/concerns/extended_solr_document.rb +147 -0
  54. data/lib/dog_biscuits/models/concerns/metadata_properties/archivematica/archivematica.rb +73 -0
  55. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/access_provided_by.rb +14 -0
  56. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/country_code.rb +15 -0
  57. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/hub_dates.rb +17 -0
  58. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/maintenance_agency_code.rb +15 -0
  59. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/awarding_institution.rb +13 -0
  60. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/edition.rb +13 -0
  61. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/identified_by.rb +14 -0
  62. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/part.rb +13 -0
  63. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/part_of.rb +14 -0
  64. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/series.rb +13 -0
  65. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/subtitle.rb +14 -0
  66. data/lib/dog_biscuits/models/concerns/metadata_properties/bibo/presented_at.rb +13 -0
  67. data/lib/dog_biscuits/models/concerns/metadata_properties/bibo/publication_status.rb +13 -0
  68. data/lib/dog_biscuits/models/concerns/metadata_properties/datacite/resource_type_general.rb +13 -0
  69. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/abstract.rb +14 -0
  70. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/access_rights.rb +14 -0
  71. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/bibliographic_citation.rb +13 -0
  72. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/contributor.rb +14 -0
  73. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/creator.rb +14 -0
  74. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date.rb +13 -0
  75. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_accepted.rb +13 -0
  76. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_available.rb +14 -0
  77. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_copyrighted.rb +14 -0
  78. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_created.rb +13 -0
  79. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_issued.rb +14 -0
  80. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/description.rb +14 -0
  81. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/extent.rb +13 -0
  82. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/format.rb +13 -0
  83. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/identifier.rb +13 -0
  84. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/language.rb +17 -0
  85. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/publisher.rb +14 -0
  86. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/resource_type.rb +13 -0
  87. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/rights.rb +17 -0
  88. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/rights_holder.rb +14 -0
  89. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/simple_versions.rb +18 -0
  90. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/source.rb +13 -0
  91. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/subject.rb +13 -0
  92. data/lib/dog_biscuits/models/concerns/metadata_properties/dwc/event_date.rb +14 -0
  93. data/lib/dog_biscuits/models/concerns/metadata_properties/edm/edm_rights.rb +13 -0
  94. data/lib/dog_biscuits/models/concerns/metadata_properties/fabio/date_collected.rb +15 -0
  95. data/lib/dog_biscuits/models/concerns/metadata_properties/foaf/based_near.rb +12 -0
  96. data/lib/dog_biscuits/models/concerns/metadata_properties/foaf/foaf_name.rb +16 -0
  97. data/lib/dog_biscuits/models/concerns/metadata_properties/frapo/output_of.rb +18 -0
  98. data/lib/dog_biscuits/models/concerns/metadata_properties/geo/geo.rb +27 -0
  99. data/lib/dog_biscuits/models/concerns/metadata_properties/geonames/country_code.rb +15 -0
  100. data/lib/dog_biscuits/models/concerns/metadata_properties/geonames/place_properties.rb +66 -0
  101. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/doi.rb +13 -0
  102. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/isbn.rb +13 -0
  103. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/official_url.rb +13 -0
  104. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/orcid.rb +13 -0
  105. data/lib/dog_biscuits/models/concerns/metadata_properties/local/for_indexing.rb +14 -0
  106. data/lib/dog_biscuits/models/concerns/metadata_properties/local/former_identifier.rb +13 -0
  107. data/lib/dog_biscuits/models/concerns/metadata_properties/local/generic_authority_terms.rb +22 -0
  108. data/lib/dog_biscuits/models/concerns/metadata_properties/local/generic_qualifier.rb +16 -0
  109. data/lib/dog_biscuits/models/concerns/metadata_properties/local/last_access.rb +15 -0
  110. data/lib/dog_biscuits/models/concerns/metadata_properties/local/main_file.rb +24 -0
  111. data/lib/dog_biscuits/models/concerns/metadata_properties/local/module_code.rb +13 -0
  112. data/lib/dog_biscuits/models/concerns/metadata_properties/local/number_of_downloads.rb +14 -0
  113. data/lib/dog_biscuits/models/concerns/metadata_properties/local/packaged_by.rb +13 -0
  114. data/lib/dog_biscuits/models/concerns/metadata_properties/local/readme_file.rb +26 -0
  115. data/lib/dog_biscuits/models/concerns/metadata_properties/local/requestor_email.rb +13 -0
  116. data/lib/dog_biscuits/models/concerns/metadata_properties/mads/related_authority.rb +14 -0
  117. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/advisor.rb +14 -0
  118. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/editor.rb +14 -0
  119. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/funder.rb +13 -0
  120. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/place_of_publication.rb +13 -0
  121. data/lib/dog_biscuits/models/concerns/metadata_properties/mods/date_valid.rb +14 -0
  122. data/lib/dog_biscuits/models/concerns/metadata_properties/owl/owl_same_as.rb +13 -0
  123. data/lib/dog_biscuits/models/concerns/metadata_properties/premis/has_restriction.rb +15 -0
  124. data/lib/dog_biscuits/models/concerns/metadata_properties/property_sets/person_properties.rb +92 -0
  125. data/lib/dog_biscuits/models/concerns/metadata_properties/pure/managing_organisation.rb +14 -0
  126. data/lib/dog_biscuits/models/concerns/metadata_properties/pure/pure.rb +28 -0
  127. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/rdf_type.rb +12 -0
  128. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/rdfs_label.rb +14 -0
  129. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/related_url.rb +13 -0
  130. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/alternate_name.rb +13 -0
  131. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/content_version.rb +13 -0
  132. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/date_published.rb +13 -0
  133. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/date_updated.rb +13 -0
  134. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/department.rb +13 -0
  135. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/end_date.rb +13 -0
  136. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/issue_number.rb +13 -0
  137. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/keyword.rb +13 -0
  138. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/location.rb +13 -0
  139. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/pagination.rb +13 -0
  140. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/start_date.rb +13 -0
  141. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/volume_number.rb +13 -0
  142. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_labels.rb +18 -0
  143. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_note.rb +13 -0
  144. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_related.rb +13 -0
  145. data/lib/dog_biscuits/models/concerns/metadata_properties/uketd/date_of_award.rb +13 -0
  146. data/lib/dog_biscuits/models/concerns/metadata_properties/uketd/qualification.rb +17 -0
  147. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/date_submitted.rb +14 -0
  148. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/official_url.rb +13 -0
  149. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/refereed.rb +13 -0
  150. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_labels.rb +9 -0
  151. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_metadata.rb +64 -0
  152. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_rights.rb +10 -0
  153. data/lib/dog_biscuits/models/concerns/model_property_sets/conference_item_metadata.rb +24 -0
  154. data/lib/dog_biscuits/models/concerns/model_property_sets/dataset_metadata.rb +36 -0
  155. data/lib/dog_biscuits/models/concerns/model_property_sets/digital_archival_object_metadata.rb +13 -0
  156. data/lib/dog_biscuits/models/concerns/model_property_sets/exam_paper_metadata.rb +14 -0
  157. data/lib/dog_biscuits/models/concerns/model_property_sets/journal_article_metadata.rb +24 -0
  158. data/lib/dog_biscuits/models/concerns/model_property_sets/package_metadata.rb +13 -0
  159. data/lib/dog_biscuits/models/concerns/model_property_sets/published_work_metadata.rb +26 -0
  160. data/lib/dog_biscuits/models/concerns/model_property_sets/thesis_metadata.rb +17 -0
  161. data/lib/dog_biscuits/models/filesets/file_set.rb +30 -0
  162. data/lib/dog_biscuits/models/to_refactor_or_remove/canvas.rb +15 -0
  163. data/lib/dog_biscuits/models/to_refactor_or_remove/contained_file.rb +13 -0
  164. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_date_certainty.rb +5 -0
  165. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_editorial_note.rb +5 -0
  166. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry.rb +19 -0
  167. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry_date.rb +10 -0
  168. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry_type.rb +5 -0
  169. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_is_referenced_by.rb +5 -0
  170. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_language.rb +5 -0
  171. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_marginalium.rb +5 -0
  172. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_note.rb +5 -0
  173. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_as_written.rb +5 -0
  174. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_descriptor.rb +5 -0
  175. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_descriptor_as_written.rb +5 -0
  176. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_note.rb +5 -0
  177. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_related_person.rb +5 -0
  178. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_related_place.rb +5 -0
  179. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_role.rb +5 -0
  180. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_as_written.rb +5 -0
  181. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_note.rb +5 -0
  182. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_role.rb +5 -0
  183. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_type.rb +5 -0
  184. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_related_agent.rb +20 -0
  185. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_related_place.rb +13 -0
  186. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_section_type.rb +5 -0
  187. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_single_date.rb +10 -0
  188. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_subject.rb +5 -0
  189. data/lib/dog_biscuits/models/to_refactor_or_remove/entry.rb +59 -0
  190. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/entry_date.rb +17 -0
  191. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/related_agent.rb +62 -0
  192. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/related_place.rb +28 -0
  193. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/single_date.rb +19 -0
  194. data/lib/dog_biscuits/models/to_refactor_or_remove/folio.rb +42 -0
  195. data/lib/dog_biscuits/models/to_refactor_or_remove/image.rb +25 -0
  196. data/lib/dog_biscuits/models/to_refactor_or_remove/manifest.rb +15 -0
  197. data/lib/dog_biscuits/models/to_refactor_or_remove/register.rb +21 -0
  198. data/lib/dog_biscuits/models/work.rb +37 -0
  199. data/lib/dog_biscuits/models/works/conference_item.rb +37 -0
  200. data/lib/dog_biscuits/models/works/dataset.rb +42 -0
  201. data/lib/dog_biscuits/models/works/digital_archival_object.rb +28 -0
  202. data/lib/dog_biscuits/models/works/exam_paper.rb +33 -0
  203. data/lib/dog_biscuits/models/works/journal_article.rb +37 -0
  204. data/lib/dog_biscuits/models/works/package.rb +47 -0
  205. data/lib/dog_biscuits/models/works/published_work.rb +38 -0
  206. data/lib/dog_biscuits/models/works/thesis.rb +34 -0
  207. data/lib/dog_biscuits/property_mappings/property_mappings.rb +585 -0
  208. data/lib/dog_biscuits/railtie.rb +13 -0
  209. data/lib/dog_biscuits/services/table_based_authority_extended.rb +10 -0
  210. data/lib/dog_biscuits/services/terms.rb +57 -0
  211. data/lib/dog_biscuits/services/terms_service.rb +162 -0
  212. data/lib/dog_biscuits/solr/index_types.rb +33 -0
  213. data/lib/dog_biscuits/validators/concept_related_validator.rb +13 -0
  214. data/lib/dog_biscuits/validators/concept_scheme_member_validator.rb +10 -0
  215. data/lib/dog_biscuits/validators/label_validator.rb +55 -0
  216. data/lib/dog_biscuits/validators/place_validator.rb +10 -0
  217. data/lib/dog_biscuits/version.rb +5 -0
  218. data/lib/dog_biscuits/vocab/borthwick_registers.rb +321 -0
  219. data/lib/dog_biscuits/vocab/generic.rb +204 -0
  220. data/lib/dog_biscuits/vocab/oais_archivematica.rb +116 -0
  221. data/lib/dog_biscuits/vocab/pure_terms.rb +65 -0
  222. data/lib/dog_biscuits/vocab/uketd.rb +45 -0
  223. data/lib/dog_biscuits/vocab/ulcc_terms.rb +55 -0
  224. data/lib/generators/dog_biscuits/USAGE +50 -0
  225. data/lib/generators/dog_biscuits/authority_generator.rb +55 -0
  226. data/lib/generators/dog_biscuits/catalog_generator.rb +18 -0
  227. data/lib/generators/dog_biscuits/dates_generator.rb +98 -0
  228. data/lib/generators/dog_biscuits/generate_all_generator.rb +29 -0
  229. data/lib/generators/dog_biscuits/imagify_generator.rb +67 -0
  230. data/lib/generators/dog_biscuits/install_generator.rb +82 -0
  231. data/lib/generators/dog_biscuits/locales_generator.rb +20 -0
  232. data/lib/generators/dog_biscuits/schema_org_generator.rb +20 -0
  233. data/lib/generators/dog_biscuits/templates/_date_template.html.erb +7 -0
  234. data/lib/generators/dog_biscuits/templates/app/controllers/catalog_controller.rb +133 -0
  235. data/lib/generators/dog_biscuits/templates/app/helpers/dog_biscuits_helper.rb +43 -0
  236. data/lib/generators/dog_biscuits/templates/app/renderers/package_ids_renderer.rb +13 -0
  237. data/lib/generators/dog_biscuits/templates/app/renderers/packaged_by_ids_renderer.rb +11 -0
  238. data/lib/generators/dog_biscuits/templates/app/renderers/publication_status_renderer.rb +16 -0
  239. data/lib/generators/dog_biscuits/templates/app/services/concerns/file_authority_concern.rb +14 -0
  240. data/lib/generators/dog_biscuits/templates/app/services/concerns/local_authority_concern.rb +18 -0
  241. data/lib/generators/dog_biscuits/templates/app/services/local_form_metadata_service.rb +15 -0
  242. data/lib/generators/dog_biscuits/templates/app/views/hyrax/base/_form_metadata.html.erb +23 -0
  243. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_abstract.html.erb +5 -0
  244. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_default.html.erb +6 -0
  245. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_funder.html.erb +8 -0
  246. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_note.html.erb +5 -0
  247. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_part_of.html.erb +17 -0
  248. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_publication_status.html.erb +6 -0
  249. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_refereed.html.erb +5 -0
  250. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_resource_type_general.html.erb +2 -0
  251. data/lib/generators/dog_biscuits/templates/authority_service.rb.erb +25 -0
  252. data/lib/generators/dog_biscuits/templates/config/authorities/content_versions.yml +25 -0
  253. data/lib/generators/dog_biscuits/templates/config/authorities/publication_statuses.yml +19 -0
  254. data/lib/generators/dog_biscuits/templates/config/authorities/qualification_levels.yml +13 -0
  255. data/lib/generators/dog_biscuits/templates/config/authorities/qualification_names.yml +31 -0
  256. data/lib/generators/dog_biscuits/templates/config/authorities/resource_type_generals.yml +47 -0
  257. data/lib/generators/dog_biscuits/templates/config/dog_biscuits.yml +3 -0
  258. data/lib/generators/dog_biscuits/templates/config/initializers/catalog_search_builder_overrides.rb +18 -0
  259. data/lib/generators/dog_biscuits/templates/config/initializers/dog_biscuits.rb +144 -0
  260. data/lib/generators/dog_biscuits/templates/dog_biscuits.en.yml.erb +11 -0
  261. data/lib/generators/dog_biscuits/templates/schema_org.yml.erb +4 -0
  262. data/lib/generators/dog_biscuits/work/USAGE +35 -0
  263. data/lib/generators/dog_biscuits/work/templates/README +31 -0
  264. data/lib/generators/dog_biscuits/work/templates/_attribute_rows.html.erb +22 -0
  265. data/lib/generators/dog_biscuits/work/templates/actor.rb.erb +25 -0
  266. data/lib/generators/dog_biscuits/work/templates/form.rb.erb +18 -0
  267. data/lib/generators/dog_biscuits/work/templates/indexer.rb.erb +23 -0
  268. data/lib/generators/dog_biscuits/work/templates/model.rb.erb +16 -0
  269. data/lib/generators/dog_biscuits/work/templates/presenter.rb.erb +20 -0
  270. data/lib/generators/dog_biscuits/work/work_generator.rb +102 -0
  271. data/lib/tasks/authorities.rake +22 -0
  272. metadata +476 -0
@@ -0,0 +1,13 @@
1
+ terms:
2
+ - id: masters-pg
3
+ term: Masters (Postgraduate)
4
+ active: true
5
+ - id: diploma-pg
6
+ term: Diploma (Postgraduate)
7
+ active: true
8
+ - id: bachelors-ug
9
+ term: Bachelors (Undergraduate)
10
+ active: true
11
+ - id: doctoral-pg
12
+ term: Doctoral (Postgraduate)
13
+ active: true
@@ -0,0 +1,31 @@
1
+ terms:
2
+ - id: ba
3
+ term: Bachelor of Arts (BA)
4
+ active: true
5
+ - id: bphil
6
+ term: Bachelor of Philosophy (BPhil)
7
+ active: true
8
+ - id: bsc
9
+ term: Bachelor of Science (BSc)
10
+ active: true
11
+ - id: ma
12
+ term: Master of Arts (MA)
13
+ active: true
14
+ - id: mres
15
+ term: Master of Arts by Research (MRes)
16
+ active: true
17
+ - id: mphil
18
+ term: Master of Philosophy (MPhil)
19
+ active: true
20
+ - id: mres
21
+ term: Master of Research (MRes)
22
+ active: true
23
+ - id: msc
24
+ term: Master of Science (MSc)
25
+ active: true
26
+ - id: mres-s
27
+ term: Master of Science by Research (MRes)
28
+ active: true
29
+ - id: phdip
30
+ term: Postgraduate Diploma (PGDip)
31
+ active: true
@@ -0,0 +1,47 @@
1
+ # DataCite Resource Type General
2
+ terms:
3
+ - id: http://www.w3.org/ns/dcat#MovingImage
4
+ term: Audiovisual
5
+ active: true
6
+ - id: http://www.w3.org/ns/dcat#Collection
7
+ term: Collection
8
+ active: true
9
+ - id: https://schema.datacite.org/resource_type_general/DataPaper
10
+ term: Data Paper
11
+ active: true
12
+ - id: http://www.w3.org/ns/dcat#Dataset
13
+ term: Dataset
14
+ active: true
15
+ - id: http://www.w3.org/ns/dcat#Event
16
+ term: Event
17
+ active: true
18
+ - id: http://www.w3.org/ns/dcat#StillImage
19
+ term: Image
20
+ active: true
21
+ - id: http://www.w3.org/ns/dcat#InteractiveResource
22
+ term: Interactive Resource
23
+ active: true
24
+ - id: http://purl.org/spar/fabio/Model
25
+ term: Model
26
+ active: true
27
+ - id: http://www.w3.org/ns/dcat#PhysicalObject
28
+ term: Physical Object
29
+ active: true
30
+ - id: http://www.w3.org/ns/dcat#Service
31
+ term: Service
32
+ active: true
33
+ - id: http://www.w3.org/ns/dcat#Software
34
+ term: Software
35
+ active: true
36
+ - id: http://www.w3.org/ns/dcat#Sound
37
+ term: Sound
38
+ active: true
39
+ - id: http://www.w3.org/ns/dcat#Text
40
+ term: Text
41
+ active: true
42
+ - id: http://purl.org/spar/fabio/Workflow
43
+ term: Workflow
44
+ active: true
45
+ - id: http://purl.org/vocab/frbr/core#Endeavour
46
+ term: Other
47
+ active: true
@@ -0,0 +1,3 @@
1
+ # authorities
2
+
3
+ dog_biscuits: 'true'
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ # ./config/initializers/catalog_search_builder_overrides.rb
3
+ # via https://github.com/samvera/hyrax/issues/707
4
+
5
+ # Unclear how to customize the Sufia::CatalogSearchBuilder, which
6
+ # we need to do for blacklight_range_limit.
7
+ # https://github.com/projecthydra-labs/hyrax/issues/707
8
+
9
+ # to_prepare used in case there's dev-mode class reloading of the
10
+ # thing we're patching. But we try to check to not do it multiple
11
+ # times in case there isn't.
12
+ Rails.application.config.to_prepare do
13
+ # would like to look up the class dynamically in case it changes,
14
+ # Sufia does this weird making this the only way, Hyrax is somewhat
15
+ # less weird.
16
+ klass = CatalogController.new.search_builder_class
17
+ klass.send(:include, BlacklightRangeLimit::RangeLimitBuilder) unless klass.ancestors.include? BlacklightRangeLimit::RangeLimitBuilder
18
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ # load dog_biscuits config
4
+ DOGBISCUITS = YAML.safe_load(File.read(Rails.root.join('config', 'dog_biscuits.yml'))).with_indifferent_access
5
+ # include Terms
6
+
7
+ # Configuration
8
+ DogBiscuits.config do |config|
9
+ # GLOBAL PROPERTIES
10
+
11
+ # Models to be used in the current application.
12
+ # Available models are:
13
+ # Add values in constantized form, eg. 'ConferenceItem'
14
+ # config.selected_models = []
15
+
16
+ # Use the blacklight date range gem to provide a single combined range filter
17
+ # default = false
18
+ # nb. run rails g dog_biscuits:dates_generator to install
19
+ # config.date_range = true
20
+
21
+ # Use the bootstrap date picker for date fields
22
+ # default = false
23
+ # nb. run rails g dog_biscuits:dates_generator to install
24
+ # config.date_picker = true
25
+
26
+ # Date fields on which to apply the date picker
27
+ # default is everything in the date_properties config
28
+ # Add values as symbols (eg. :date_created)
29
+ # config.date_picker_dates += [] # add to the list
30
+ # config.date_picker_dates -= [] # remove from the list
31
+ # config.date_picker_dates += [] # replace the current list
32
+
33
+ # Date fields to be indexed into the date_range facet:
34
+ # Add values as symbols (eg. :date_created)
35
+ # config.date_properties += [] # add to the list
36
+ # config.date_properties -= [] # remove from the list
37
+ # config.date_properties += [] # replace the current list
38
+
39
+ # Solr fields that will be used as facets in the search page.
40
+ # The ordering of the field names is the order of the display
41
+ # The properties must have been indexed as facetable
42
+ # Add values as symbols (eg. :creator)
43
+ # config.facet_properties += [] # add to the end of the current list
44
+ # config.facet_properties -= [] # remove from the current list
45
+ # config.facet_properties = [] # replace the current list
46
+
47
+ # Solr fields to be displayed in the index (search results) view
48
+ # The ordering of the field names is the order of the display
49
+ # Add values as symbols (eg. :creator)
50
+ # config.index_properties += [] # add to the end of the current list
51
+ # config.index_properties -= [] # remove from the current list
52
+ # config.index_properties = [] # replace the current list
53
+
54
+ # Solr fields to exclude from search
55
+ # Add values as symbols (eg. :creator)
56
+ # config.exclude_from_search_properties += [] # add to the end of the current list
57
+ # config.exclude_from_search_properties -= [] # remove from the current list
58
+ # config.exclude_from_search_properties = [] # replace the current list
59
+
60
+ # Fields in the form that should only accept a single value, ie. disable the 'add another' button.
61
+ # Add values as symbols (eg. :creator)
62
+ # config.singular_properties += [] # add to the list
63
+ # config.singular_properties -= [] # remove from the list
64
+ # config.singular_properties += [] # replace the current list
65
+
66
+ # Date properties
67
+ # These will be indexed into the date_picker if present
68
+ # config.date_properties += []
69
+
70
+ # Enable restricted properties in the form.
71
+ # If set to false, no restrictions will be applied
72
+ # Default is false
73
+ # config.restricted_properties_enabled = false
74
+
75
+ # Restrict the following properties in the form to the role specified in
76
+ # restricted_role
77
+ # Restrictions apply to 'below the fold' properties only, they are not
78
+ # applied to required properties
79
+ # Restrictions apply in the form only, properties are still visible in the
80
+ # show page
81
+ # Required current_user to respond to the role ( current_user.admin? )
82
+ # this is provided by the 'hydra-role-management' gem
83
+ # config.restricted_properties_enabled? must be set to true for this to take effect
84
+ # config.restricted_properties = []
85
+
86
+ # Role to use when restricting properties
87
+ # Default is :admin
88
+ # config.restricted_role = :admin
89
+
90
+ # Add values that aren't found in the following table-based authorities to be added on save.
91
+ # This only works in cases where the name of the authority is a pluralized form of
92
+ # the name of the property which uses it, eg. subjects/subject and languages/language
93
+ # Default is :subjects; add authority name as symbol, eg. :subjects
94
+ # config.authorities_add_new = []
95
+
96
+ # WORK PROPERTIES
97
+
98
+ # For each model, there are two configurations available.
99
+ # Both are set to defaults:
100
+ # _required fields defaults to the Hyrax default (title, creator, keyword, rights_statment)
101
+ # _properties defaults to all properties available to that model, alphabetized
102
+ # Example:
103
+ # config.conference_item_properties = []
104
+ # config.conference_item_properties_required = []
105
+
106
+ # PROPERTY MAPPINGS
107
+ # All properties should be included in property_mappings. This is used by generators for building
108
+ # schema_org, locales, catalog_controller and attribute_rows. Adding info here and using
109
+ # generators saves on a lot of manual editing.
110
+ #
111
+ # To add a new local property (new_property below), do:
112
+ # config.property_mappings[:new_property] = {}
113
+ #
114
+ # To change an existing property (existing_property), do:
115
+ # config.property_mappings[:existing_property] = {}
116
+ #
117
+ # The contents of a property_mappings key:
118
+ #
119
+ # config.property_mappings[:existing_property] =
120
+ # {
121
+ # # REQUIRED (if the property will appear in search results): a string formatted as per the example shown
122
+ # index: "('existing_property', :stored_searchable)",
123
+ #
124
+ # # OPTIONAL: label for use in the form, show page, search results and facet
125
+ # label: 'My Property Label',
126
+ #
127
+ # # OPTIONAL: help_text for use in the form
128
+ # help_text: 'Use this to describe something or other',
129
+ #
130
+ # # OPTIONAL: reference to a renderer used to format the display of the text in the show page
131
+ # # in this eg. `app/renderers/existing_property_attribute_renderer.rb` must exist
132
+ # render_as: 'existing_property',
133
+ #
134
+ # # OPTIONAL reference to a helper method used to format the display of the text in the search results
135
+ # # in this eg. the `existing_property_helper` method must exist in app/helpers, eg. in hyrax_helper.rb
136
+ # helper_method: 'existing_property_helper',
137
+ #
138
+ # # OPTIONAL mapping to a schema.org property to be used in embedded metadata
139
+ # schema_org: {
140
+ # # in this eg. we have decided that the closest property match in schema.org is contributor
141
+ # property: 'contributor'
142
+ # }
143
+ # }
144
+ end
@@ -0,0 +1,11 @@
1
+ en:
2
+ dog_biscuits:
3
+ labels:<% DogBiscuits.config.all_properties.sort.each {|prop| if DogBiscuits.config.property_mappings[prop] && DogBiscuits.config.property_mappings[prop][:label] %>
4
+ <%= prop %>: <%= DogBiscuits.config.property_mappings[prop][:label] %><% end } %>
5
+ simple_form:
6
+ hints:
7
+ defaults:<% DogBiscuits.config.all_properties.sort.each {|prop| if DogBiscuits.config.property_mappings[prop] && DogBiscuits.config.property_mappings[prop][:help_text] %>
8
+ <%= prop %>: <%= DogBiscuits.config.property_mappings[prop][:help_text] %><% end } %>
9
+ labels:
10
+ defaults:<% DogBiscuits.config.all_properties.sort.each {|prop| if DogBiscuits.config.property_mappings[prop] && DogBiscuits.config.property_mappings[prop][:label] %>
11
+ <%= prop %>: <%= DogBiscuits.config.property_mappings[prop][:label] %><% end } %>
@@ -0,0 +1,4 @@
1
+ schema_org:<% DogBiscuits.config.all_properties.sort.each { | prop | if DogBiscuits.config.property_mappings[prop] && DogBiscuits.config.property_mappings[prop][:schema_org] %>
2
+ <%= prop.to_s %>:
3
+ <% DogBiscuits.config.property_mappings[prop][:schema_org].each { |k, v| %><%= k %>: <%= v %>
4
+ <% } end } %>
@@ -0,0 +1,35 @@
1
+ Description:
2
+ The DogBiscuits Work generator makes the following changes to your application:
3
+ 1. Checks that the requested Work is supported by DogBiscuits
4
+ 2. Runs the Hyrax generator for the given model
5
+ 3. Creates a new model, form, presenter and indexer to replace the Hyrax one
6
+ 4. Creates views/hyrax/work_name_plural/_attribute_rows.html.erb
7
+ 5. Updates the schema_org config, hyrax (en) locale using the configured properties for the work
8
+
9
+ Example:
10
+ rails generate dog_biscuits:work ConferenceItem
11
+
12
+ Making changes post-generation:
13
+ You can make most of the changes you'll need (property selection, order, required etc.)
14
+ in config/initializers/dog_biscuits.rb. You do not need to re-run the generator
15
+ for these changes to take effect.
16
+ If you have changed labels, help_text or schema_org mappings in the property_mappings config:
17
+ re-run the locales generator with `rails g dog_biscuits:locales`
18
+ re-run the schema_org generator with `rails g dog_biscuits:schema_org`
19
+
20
+ Adding local properties
21
+ Add the local property into the model (in app/models/)
22
+ Add an attribute into the solr_document (app/models/solr_document.rb)
23
+ Add the property to the config (config/initializers/dog_biscuits.rb)
24
+
25
+ Add custom helper methods or renderers (in app/helpers/ and app/renderers)
26
+ and add them to the property_mappings.
27
+
28
+ The generator can be re-run without overwriting the model and indexer files using the --skipmodel option
29
+ although, as noted above, you should not need to re-run the generator
30
+
31
+ Example:
32
+ rails generate dog_biscuits:work ConferenceItem --skipmodel
33
+ or (to update only labels, help_text and schema_org mappings)
34
+ rails g dog_biscuits:locales
35
+ rails g dog_biscuits:schema_org
@@ -0,0 +1,31 @@
1
+ ===============================================================================
2
+
3
+ After creating your work you may wish to:
4
+
5
+ 1. Customize the Work (the 'dog_biscuits way'):
6
+
7
+ in config/initializers/dog_biscuits.rb change the defaults:
8
+
9
+ fields to display in search results:
10
+ config.index_properties
11
+
12
+ fields to display as facets:
13
+ config.facet_properties
14
+
15
+ properties and order in the form and show page:
16
+ config.your_work_properties
17
+
18
+ required fields in the form
19
+ config.your_work_properties_required
20
+
21
+ Restart your application to see changes take effect.
22
+
23
+ 2. Further modify the model, indexer, actor, form or presenter
24
+
25
+ Remember that if you re-run the Work generator, select 'n' if you have made local changes:
26
+ rails g dog_biscuits:work Work
27
+
28
+ You can ensure the model and indexer are not overwritten with the --skipmodel flag
29
+ rails g dog_biscuits:work Work --skipmodel
30
+
31
+ ===============================================================================
@@ -0,0 +1,22 @@
1
+ <% DogBiscuits.config.send("#{presenter.model_name.singular}_properties").each do | prop |
2
+ # skip title, description and license
3
+ next if [:title, :description, :license].include? prop
4
+
5
+ prop = "#{prop}_label".to_sym if presenter.model_name.to_s.constantize.controlled_properties.include? prop
6
+
7
+ if DogBiscuits.config.property_mappings[prop]
8
+ if DogBiscuits.config.property_mappings[prop][:render_as]
9
+ render = DogBiscuits.config.property_mappings[prop][:render_as]
10
+ elsif DogBiscuits.config.facet_properties.include? prop
11
+ render = 'faceted'
12
+ else
13
+ render = nil
14
+ end
15
+ end %>
16
+ <%= presenter.attribute_to_html(prop,
17
+ label: I18n.t("dog_biscuits.labels.#{prop.to_s}"),
18
+ render_as: render,
19
+ html_dl: true)
20
+ %>
21
+ <% end %>
22
+
@@ -0,0 +1,25 @@
1
+ # Generated via
2
+ # `rails generate hyrax:work <%= class_name %>`
3
+ module Hyrax
4
+ module Actors
5
+ class <%= class_name %>Actor < Hyrax::Actors::BaseActor
6
+ include DogBiscuits::Actors::ApplyAuthorities
7
+ include DogBiscuits::Actors::SingularAttributes
8
+
9
+ # @param [Hyrax::Actors::Environment] env
10
+ # @return [Boolean] true if create was successful
11
+ def create(env)
12
+ apply_authorities(env)
13
+ super
14
+ end
15
+
16
+ # @param [Hyrax::Actors::Environment] env
17
+ # @return [Boolean] true if update was successful
18
+ def update(env)
19
+ apply_authorities(env)
20
+ super
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ # Generated via
2
+ # `rails generate dog_biscuits:work <%= class_name %>`
3
+ module Hyrax
4
+ class <%= class_name %>Form < Hyrax::Forms::WorkForm
5
+ self.model_class = <%= class_name %>
6
+
7
+ self.terms -= DogBiscuits.config.base_properties
8
+ self.terms += DogBiscuits.config.<%= file_name %>_properties
9
+
10
+ # Add any local properties here
11
+ self.terms += []
12
+
13
+ self.required_fields = DogBiscuits.config.<%= file_name %>_properties_required
14
+
15
+ # The service that determines the cardinality of each field
16
+ self.field_metadata_service = ::LocalFormMetadataService
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # Generated via
2
+ # `rails generate dog_biscuits:work <%= class_name %>`
3
+ class <%= class_name %>Indexer < DogBiscuits::<%= class_name %>Indexer
4
+ # This indexes the default metadata. You can remove it if you want to
5
+ # provide your own metadata and indexing.
6
+ # include Hyrax::IndexesBasicMetadata
7
+
8
+ # Fetch remote labels for based_near. You can remove this if you don't want
9
+ # this behavior
10
+ # include Hyrax::IndexesLinkedMetadata
11
+
12
+ # Uncomment this block if you want to add custom indexing behavior:
13
+ # def generate_solr_document
14
+ # super.tap do |solr_doc|
15
+ # solr_doc['my_custom_field_ssim'] = object.my_custom_property
16
+ # end
17
+ # end
18
+
19
+ # Fetch remote labels for based_near. Copied from Hyrax::IndexesLinkedMetadata
20
+ def rdf_service
21
+ Hyrax::DeepIndexingService
22
+ end
23
+ end