iiif_print 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.env +5 -0
  4. data/.fcrepo_wrapper +4 -0
  5. data/.github/release.yml +20 -0
  6. data/.github/workflows/branches.yml +24 -0
  7. data/.github/workflows/build-lint-test-action.yaml +33 -0
  8. data/.github/workflows/release_labels.yml +25 -0
  9. data/.gitignore +52 -0
  10. data/.rubocop.yml +177 -0
  11. data/.solr_wrapper +8 -0
  12. data/.travis.yml +49 -0
  13. data/CONTRIBUTING.md +181 -0
  14. data/Dockerfile +15 -0
  15. data/Gemfile +52 -0
  16. data/LICENSE +203 -0
  17. data/README.md +203 -0
  18. data/Rakefile +38 -0
  19. data/app/actors/iiif_print/actors/file_set_actor_decorator.rb +56 -0
  20. data/app/assets/config/iiif_print_manifest.js +2 -0
  21. data/app/assets/images/iiif_print/.keep +0 -0
  22. data/app/assets/javascripts/iiif_print/autocomplete_fix.js +33 -0
  23. data/app/assets/javascripts/iiif_print/ocr_search.js.erb +6 -0
  24. data/app/assets/javascripts/iiif_print.js +3 -0
  25. data/app/assets/stylesheets/iiif_print/_iiif_print.scss +4 -0
  26. data/app/assets/stylesheets/iiif_print/_issue_search.scss +13 -0
  27. data/app/assets/stylesheets/iiif_print/_issues_calendar.scss +18 -0
  28. data/app/assets/stylesheets/iiif_print/_newspapers_search.scss +38 -0
  29. data/app/assets/stylesheets/iiif_print/_search_results.scss +6 -0
  30. data/app/helpers/hyrax/iiif_helper.rb +22 -0
  31. data/app/helpers/iiif_print/application_helper.rb +5 -0
  32. data/app/helpers/iiif_print_helper.rb +64 -0
  33. data/app/indexers/concerns/iiif_print/child_indexer.rb +34 -0
  34. data/app/indexers/concerns/iiif_print/file_set_indexer.rb +29 -0
  35. data/app/mailers/iiif_print/application_mailer.rb +8 -0
  36. data/app/models/concerns/iiif_print/set_child_flag.rb +29 -0
  37. data/app/models/concerns/iiif_print/solr/document.rb +47 -0
  38. data/app/models/iiif_print/application_record.rb +6 -0
  39. data/app/models/iiif_print/derivative_attachment.rb +8 -0
  40. data/app/models/iiif_print/iiif_search_response_decorator.rb +17 -0
  41. data/app/models/iiif_print/ingest_file_relation.rb +14 -0
  42. data/app/models/iiif_print/pending_relationship.rb +7 -0
  43. data/app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb +10 -0
  44. data/app/presenters/iiif_print/iiif_manifest_presenter_factory_behavior.rb +33 -0
  45. data/app/presenters/iiif_print/work_show_presenter_decorator.rb +29 -0
  46. data/app/renderers/hyrax/renderers/faceted_attribute_renderer_decorator.rb +18 -0
  47. data/app/search_builders/concerns/iiif_print/exclude_models.rb +17 -0
  48. data/app/search_builders/concerns/iiif_print/highlight_search_params.rb +14 -0
  49. data/app/services/iiif_print/manifest_builder_service_behavior.rb +97 -0
  50. data/app/services/iiif_print/pluggable_derivative_service.rb +120 -0
  51. data/app/views/catalog/_snippets_more.html.erb +16 -0
  52. data/app/views/hyrax/base/_representative_media.html.erb +9 -0
  53. data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +8 -0
  54. data/app/views/hyrax/file_sets/_actions.html.erb +45 -0
  55. data/bin/rails +13 -0
  56. data/config/fcrepo_wrapper_test.yml +5 -0
  57. data/config/initializers/assets.rb +2 -0
  58. data/config/locales/iiif_print.de.yml +148 -0
  59. data/config/locales/iiif_print.en.yml +119 -0
  60. data/config/locales/iiif_print.es.yml +148 -0
  61. data/config/locales/iiif_print.fr.yml +149 -0
  62. data/config/locales/iiif_print.it.yml +142 -0
  63. data/config/locales/iiif_print.pt-BR.yml +148 -0
  64. data/config/locales/iiif_print.zh.yml +142 -0
  65. data/config/solr_wrapper_test.yml +9 -0
  66. data/config/test-fixture/solr-config/_rest_managed.json +3 -0
  67. data/config/test-fixture/solr-config/admin-extra.html +31 -0
  68. data/config/test-fixture/solr-config/elevate.xml +36 -0
  69. data/config/test-fixture/solr-config/mapping-ISOLatin1Accent.txt +246 -0
  70. data/config/test-fixture/solr-config/protwords.txt +21 -0
  71. data/config/test-fixture/solr-config/schema.xml +366 -0
  72. data/config/test-fixture/solr-config/scripts.conf +24 -0
  73. data/config/test-fixture/solr-config/solrconfig.xml +322 -0
  74. data/config/test-fixture/solr-config/spellings.txt +2 -0
  75. data/config/test-fixture/solr-config/stopwords.txt +58 -0
  76. data/config/test-fixture/solr-config/stopwords_en.txt +58 -0
  77. data/config/test-fixture/solr-config/synonyms.txt +31 -0
  78. data/config/test-fixture/solr-config/xslt/example.xsl +132 -0
  79. data/config/test-fixture/solr-config/xslt/example_atom.xsl +67 -0
  80. data/config/test-fixture/solr-config/xslt/example_rss.xsl +66 -0
  81. data/config/test-fixture/solr-config/xslt/luke.xsl +337 -0
  82. data/config/vendor/fits.xml +55 -0
  83. data/config/vendor/imagemagick-6-policy.xml +76 -0
  84. data/db/migrate/20181214181358_create_iiif_print_derivative_attachments.rb +12 -0
  85. data/db/migrate/20190107165909_create_iiif_print_ingest_file_relations.rb +11 -0
  86. data/db/migrate/20230109000000_create_iiif_print_pending_relationships.rb +11 -0
  87. data/docker-compose.yml +129 -0
  88. data/iiif_print.gemspec +43 -0
  89. data/lib/generators/iiif_print/assets_generator.rb +29 -0
  90. data/lib/generators/iiif_print/catalog_controller_generator.rb +32 -0
  91. data/lib/generators/iiif_print/install_generator.rb +52 -0
  92. data/lib/generators/iiif_print/templates/config/initializers/iiif_print.rb +22 -0
  93. data/lib/generators/iiif_print/templates/iiif_print.scss +1 -0
  94. data/lib/iiif_print/base_derivative_service.rb +113 -0
  95. data/lib/iiif_print/blacklight_iiif_search/annotation_decorator.rb +84 -0
  96. data/lib/iiif_print/catalog_search_builder.rb +31 -0
  97. data/lib/iiif_print/configuration.rb +99 -0
  98. data/lib/iiif_print/data/fileset_helper.rb +25 -0
  99. data/lib/iiif_print/data/path_helper.rb +40 -0
  100. data/lib/iiif_print/data/work_derivatives.rb +323 -0
  101. data/lib/iiif_print/data/work_file.rb +92 -0
  102. data/lib/iiif_print/data/work_files.rb +199 -0
  103. data/lib/iiif_print/data.rb +35 -0
  104. data/lib/iiif_print/engine.rb +77 -0
  105. data/lib/iiif_print/errors.rb +9 -0
  106. data/lib/iiif_print/image_tool.rb +119 -0
  107. data/lib/iiif_print/jobs/application_job.rb +8 -0
  108. data/lib/iiif_print/jobs/child_works_from_pdf_job.rb +107 -0
  109. data/lib/iiif_print/jobs/create_relationships_job.rb +78 -0
  110. data/lib/iiif_print/jp2_derivative_service.rb +118 -0
  111. data/lib/iiif_print/jp2_image_metadata.rb +81 -0
  112. data/lib/iiif_print/lineage_service.rb +41 -0
  113. data/lib/iiif_print/metadata.rb +125 -0
  114. data/lib/iiif_print/pdf_derivative_service.rb +42 -0
  115. data/lib/iiif_print/split_pdfs/child_work_creation_from_pdf_service.rb +75 -0
  116. data/lib/iiif_print/split_pdfs/pages_into_images_service.rb +130 -0
  117. data/lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb +85 -0
  118. data/lib/iiif_print/text_extraction/alto_reader.rb +123 -0
  119. data/lib/iiif_print/text_extraction/hocr_reader.rb +172 -0
  120. data/lib/iiif_print/text_extraction/page_ocr.rb +87 -0
  121. data/lib/iiif_print/text_extraction/render_alto.rb +84 -0
  122. data/lib/iiif_print/text_extraction/word_coords_builder.rb +38 -0
  123. data/lib/iiif_print/text_extraction.rb +11 -0
  124. data/lib/iiif_print/text_extraction_derivative_service.rb +47 -0
  125. data/lib/iiif_print/text_formats_from_alto_service.rb +77 -0
  126. data/lib/iiif_print/tiff_derivative_service.rb +50 -0
  127. data/lib/iiif_print/version.rb +3 -0
  128. data/lib/iiif_print/works_controller_behavior.rb +9 -0
  129. data/lib/iiif_print.rb +136 -0
  130. data/lib/tasks/set_child_works.rake +22 -0
  131. data/spec/.keep.txt +1 -0
  132. data/spec/factories/ability.rb +6 -0
  133. data/spec/factories/newspaper_issue.rb +7 -0
  134. data/spec/factories/newspaper_page.rb +7 -0
  135. data/spec/factories/newspaper_page_solr_document.rb +12 -0
  136. data/spec/factories/newspaper_title.rb +8 -0
  137. data/spec/factories/uploaded_pdf_file.rb +9 -0
  138. data/spec/factories/uploaded_txt_file.rb +9 -0
  139. data/spec/factories/user.rb +13 -0
  140. data/spec/fixtures/files/4.1.07.jp2 +0 -0
  141. data/spec/fixtures/files/4.1.07.tiff +0 -0
  142. data/spec/fixtures/files/README.md +7 -0
  143. data/spec/fixtures/files/alto-2-0.xsd +714 -0
  144. data/spec/fixtures/files/broken-truncated.pdf +0 -0
  145. data/spec/fixtures/files/credits.md +16 -0
  146. data/spec/fixtures/files/lowres-gray-via-ndnp-sample.tiff +0 -0
  147. data/spec/fixtures/files/minimal-1-page.pdf +0 -0
  148. data/spec/fixtures/files/minimal-2-page.pdf +0 -0
  149. data/spec/fixtures/files/minimal-alto.xml +31 -0
  150. data/spec/fixtures/files/ndnp-alto-sample.xml +24 -0
  151. data/spec/fixtures/files/ndnp-sample1-json.json +1 -0
  152. data/spec/fixtures/files/ndnp-sample1-txt.txt +1 -0
  153. data/spec/fixtures/files/ndnp-sample1.pdf +0 -0
  154. data/spec/fixtures/files/ocr_alto.xml +202 -0
  155. data/spec/fixtures/files/ocr_alto_scaled_4pts_per_px.xml +202 -0
  156. data/spec/fixtures/files/ocr_color.tiff +0 -0
  157. data/spec/fixtures/files/ocr_gray.jp2 +0 -0
  158. data/spec/fixtures/files/ocr_gray.tiff +0 -0
  159. data/spec/fixtures/files/ocr_mono.tiff +0 -0
  160. data/spec/fixtures/files/ocr_mono_text_hocr.html +78 -0
  161. data/spec/fixtures/files/page1.tiff +0 -0
  162. data/spec/fixtures/files/sample-4page-issue.pdf +0 -0
  163. data/spec/fixtures/files/sample-color-newsletter.pdf +0 -0
  164. data/spec/fixtures/files/thumbnail.jpg +0 -0
  165. data/spec/helpers/hyrax/iiif_helper_spec.rb +65 -0
  166. data/spec/helpers/iiif_print_helper_spec.rb +43 -0
  167. data/spec/iiif_print/base_derivative_service_spec.rb +11 -0
  168. data/spec/iiif_print/blacklight_iiif_search/annotation_decorator_spec.rb +51 -0
  169. data/spec/iiif_print/catalog_search_builder_spec.rb +60 -0
  170. data/spec/iiif_print/configuration_spec.rb +67 -0
  171. data/spec/iiif_print/data/work_derivatives_spec.rb +245 -0
  172. data/spec/iiif_print/data/work_file_spec.rb +99 -0
  173. data/spec/iiif_print/data/work_files_spec.rb +237 -0
  174. data/spec/iiif_print/image_tool_spec.rb +109 -0
  175. data/spec/iiif_print/jobs/child_works_from_pdf_job_spec.rb +30 -0
  176. data/spec/iiif_print/jobs/create_relationships_job_spec.rb +17 -0
  177. data/spec/iiif_print/jp2_image_metadata_spec.rb +37 -0
  178. data/spec/iiif_print/lineage_service_spec.rb +13 -0
  179. data/spec/iiif_print/metadata_spec.rb +115 -0
  180. data/spec/iiif_print/split_pdfs/pages_into_images_service_spec.rb +6 -0
  181. data/spec/iiif_print/text_extraction/alto_reader_spec.rb +49 -0
  182. data/spec/iiif_print/text_extraction/hocr_reader_spec.rb +45 -0
  183. data/spec/iiif_print/text_extraction/page_ocr_spec.rb +84 -0
  184. data/spec/iiif_print/text_extraction/render_alto_spec.rb +54 -0
  185. data/spec/iiif_print/text_extraction/word_coords_builder_spec.rb +44 -0
  186. data/spec/iiif_print_spec.rb +51 -0
  187. data/spec/misc_shared.rb +111 -0
  188. data/spec/models/iiif_print/derivative_attachment_spec.rb +37 -0
  189. data/spec/models/iiif_print/ingest_file_relation_spec.rb +56 -0
  190. data/spec/models/solr_document_spec.rb +14 -0
  191. data/spec/presenters/iiif_print/iiif_manifest_presenter_behavior_spec.rb +19 -0
  192. data/spec/presenters/iiif_print/iiif_manifest_presenter_factory_behavior_spec.rb +49 -0
  193. data/spec/services/iiif_print/jp2_derivative_service_spec.rb +59 -0
  194. data/spec/services/iiif_print/pdf_derivative_service_spec.rb +66 -0
  195. data/spec/services/iiif_print/pluggable_derivative_service_spec.rb +178 -0
  196. data/spec/services/iiif_print/text_extraction_derivative_service_spec.rb +82 -0
  197. data/spec/services/iiif_print/text_formats_from_alto_service_spec.rb +127 -0
  198. data/spec/services/iiif_print/tiff_derivative_service_spec.rb +65 -0
  199. data/spec/spec_helper.rb +181 -0
  200. data/spec/support/controller_level_helpers.rb +28 -0
  201. data/spec/support/iiif_print_models.rb +127 -0
  202. data/spec/test_app_templates/blacklight.yml +9 -0
  203. data/spec/test_app_templates/fedora.yml +15 -0
  204. data/spec/test_app_templates/lib/generators/test_app_generator.rb +40 -0
  205. data/spec/test_app_templates/redis.yml +9 -0
  206. data/spec/test_app_templates/solr/conf/schema.xml +362 -0
  207. data/spec/test_app_templates/solr/conf/solrconfig.xml +322 -0
  208. data/spec/test_app_templates/solr.yml +7 -0
  209. data/tasks/iiif_print_dev.rake +34 -0
  210. data/tmp/.keep +0 -0
  211. metadata +605 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 42c50b5d98cf0600631b822085a97d517cdd1fd227711d1e87f03cc70fa5f190
4
+ data.tar.gz: 40dbba530fc35e795e318bcc0c721c5cfe74b64cd6a779735f00992ef7d6e7d7
5
+ SHA512:
6
+ metadata.gz: b7b962d06ec2a9fd377420d5961513119cd1164265a3f4f9cd7f7d8dd4a030ab87b65afd977c93bfd2072d1e87a16ce77b2da6ae29e1b4fc7221d2d7aeda4754
7
+ data.tar.gz: e1406a351b67b7715ac5b924b999724a3e626356b8a7b8f88798dffd6a671c217e2d317b755511b1a214a781587791ede8450a62494cb153ebd34fbae4b79a79
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+
data/.env ADDED
@@ -0,0 +1,5 @@
1
+ ENGINE_CART_DESTINATION='.internal_test_app'
2
+ SOLR_URL=http://solr:8983/solr
3
+ FCREPO_URL=http://fcrepo:8080
4
+ REDIS_HOST=redis
5
+ IN_DOCKER=true
data/.fcrepo_wrapper ADDED
@@ -0,0 +1,4 @@
1
+ # Place any default configuration for solr_wrapper here
2
+ port: 8984
3
+ enable_jms: false
4
+ fcrepo_home_dir: tmp/fcrepo4-development-data
@@ -0,0 +1,20 @@
1
+ changelog:
2
+ exclude:
3
+ labels:
4
+ - ignore-for-release
5
+ categories:
6
+ - title: Breaking Changes 🛠
7
+ labels:
8
+ - major-ver
9
+ - title: Exciting New Features 🎉
10
+ labels:
11
+ - minor-ver
12
+ - title: Bug Fixes 🐞
13
+ labels:
14
+ - patch-ver
15
+ - title: Database Changes
16
+ labels:
17
+ - database-changes
18
+ - title: Other Changes
19
+ labels:
20
+ - "*"
@@ -0,0 +1,24 @@
1
+ name: Verify
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - '**'
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ jobs:
11
+ branches:
12
+ runs-on: ubuntu-latest
13
+ name: Disallow "master" branch name
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+
17
+ - name: Check branch names
18
+ run: |
19
+ git fetch --all --quiet --prune --prune-tags
20
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
21
+ echo "A branch named 'master' was found. Please remove it."
22
+ echo "$(git branch --all --list master */master)"
23
+ fi
24
+ [[ -z "$(git branch --all --list master */master)" ]]
@@ -0,0 +1,33 @@
1
+ name: "Build Lint Test"
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ workflow_dispatch:
10
+ inputs:
11
+ debug_enabled:
12
+ type: boolean
13
+ description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
14
+ required: false
15
+ default: false
16
+
17
+ jobs:
18
+ build:
19
+ uses: scientist-softserv/actions/.github/workflows/build.yaml@v0.0.7
20
+ secrets: inherit
21
+ with:
22
+ platforms: "linux/amd64"
23
+ target: hyku-base
24
+ worker: false
25
+ test:
26
+ needs: build
27
+ uses: scientist-softserv/actions/.github/workflows/test.yaml@v0.0.7
28
+ with:
29
+ setup_db_cmd: rake engine_cart:generate
30
+ lint:
31
+ needs: build
32
+ uses: scientist-softserv/actions/.github/workflows/lint.yaml@v0.0.7
33
+
@@ -0,0 +1,25 @@
1
+ name: Verify
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - '**'
6
+ types:
7
+ - opened
8
+ - synchronize
9
+ - reopened
10
+ - labeled
11
+ - unlabeled
12
+
13
+ jobs:
14
+ check_pr_labels:
15
+ runs-on: ubuntu-latest
16
+ name: PR has required labels
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+
20
+ # https://github.com/marketplace/actions/label-checker-for-pull-requests
21
+ - name: Check PR for Release Notes labels
22
+ uses: docker://agilepathway/pull-request-label-checker:latest
23
+ with:
24
+ one_of: patch-ver,minor-ver,major-ver,ignore-for-release
25
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore Gemfile.lock
8
+ Gemfile.lock
9
+
10
+ # Ignore coverage reports
11
+ coverage/*
12
+
13
+ # Ignore bundler config.
14
+ .bundle
15
+
16
+ # Ignore JetBrains IDE folder
17
+ .idea/*
18
+
19
+ # Ignore the default SQLite database.
20
+ /db/*.sqlite3
21
+ /db/*.sqlite3-journal
22
+
23
+ # Ignore all logfiles and tempfiles.
24
+ /log/*
25
+ /tmp/*
26
+ !/log/.keep
27
+ !/tmp/.keep
28
+ fits.log
29
+
30
+ # Ignore Byebug command history file.
31
+ .byebug_history
32
+
33
+ # Ignore generated engine_cart testing app:
34
+ .internal_test_app
35
+
36
+ # Ignore all RubyMine temp files
37
+ .idea/
38
+
39
+ # Ignore Gemfile.lock
40
+ Gemfile.lock
41
+
42
+ # Ignore wrapper downloads
43
+ fcrepo-webapp-*
44
+
45
+ # ignore gem builds
46
+ *.gem
47
+ pkg/
48
+ *~undo-tree~
49
+ .DS_Store
50
+
51
+ # ignore local config settings
52
+ .vscode/settings.json
data/.rubocop.yml ADDED
@@ -0,0 +1,177 @@
1
+ inherit_gem:
2
+ bixby: bixby_default.yml
3
+
4
+ Style/FrozenStringLiteralComment:
5
+ Enabled: false
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.7
9
+ DisplayCopNames: true
10
+ Exclude:
11
+ - 'db/**/*'
12
+ - 'script/**/*'
13
+ - 'spec/test_app_templates/**/*'
14
+ - 'vendor/**/*'
15
+ # Resole the issues below
16
+ - 'app/helpers/iiif_print/breadcrumb_helper.rb'
17
+ - 'app/helpers/iiif_print/iiif_print_helper_behavior.rb'
18
+ - 'app/helpers/iiif_print/iiif_print_helper_behavior.rb'
19
+ - 'app/models/newspaper_article.rb'
20
+ - 'app/validators/iiif_print/publication_date_start_end_validator.rb'
21
+ - 'app/validators/iiif_print/publication_date_validator.rb'
22
+ - 'lib/iiif_print/data/work_derivatives.rb'
23
+ - 'lib/iiif_print/data/work_files.rb'
24
+ - 'lib/iiif_print/ingest.rb'
25
+ - 'lib/iiif_print/ingest/ndnp/batch_ingester.rb'
26
+ - 'app/indexers/newspaper_issue_indexer.rb'
27
+ - 'lib/iiif_print/ingest/pdf_pages.rb'
28
+ - 'lib/iiif_print/text_extraction/hocr_reader.rb'
29
+ - 'lib/tasks/iiif_print_tasks.rake'
30
+ - 'spec/lib/iiif_print/data/work_derivatives_spec.rb'
31
+ - 'spec/lib/iiif_print/data/work_files_spec.rb'
32
+ - 'spec/lib/iiif_print/ingest/ndnp/container_ingester_spec.rb'
33
+ - 'tasks/newspaperworks_dev.rake'
34
+
35
+ Layout/HashAlignment:
36
+ Enabled: false
37
+
38
+ Layout/LineLength:
39
+ Exclude:
40
+ - 'spec/lib/iiif_print/data/work_derivatives_spec.rb'
41
+ - 'spec/lib/iiif_print/ingest/ndnp/issue_ingester_spec.rb'
42
+ - 'lib/generators/iiif_print/catalog_controller_generator.rb'
43
+
44
+ Lint/ImplicitStringConcatenation:
45
+ Exclude:
46
+ - 'lib/generators/iiif_print/**/*'
47
+
48
+ Metrics/AbcSize:
49
+ Exclude:
50
+ - 'spec/model_shared.rb'
51
+
52
+ Metrics/BlockLength:
53
+ ExcludedMethods: ['included']
54
+ Exclude:
55
+ - 'iiif_print.gemspec'
56
+ - 'lib/tasks/*.rake'
57
+ - 'spec/**/*.rb'
58
+
59
+ Metrics/CyclomaticComplexity:
60
+ Exclude:
61
+ - 'spec/model_shared.rb'
62
+
63
+ Metrics/ClassLength:
64
+ Exclude:
65
+ - 'lib/iiif_print/data/work_derivatives.rb'
66
+ - 'lib/iiif_print/ingest/ndnp/page_ingester.rb'
67
+ - 'lib/iiif_print/ingest/lc_publication_info.rb'
68
+
69
+ Metrics/MethodLength:
70
+ Exclude:
71
+ - 'app/helpers/iiif_print/breadcrumb_helper.rb'
72
+ - 'lib/generators/iiif_print/catalog_controller_generator.rb'
73
+ - 'lib/iiif_print/ingest/ndnp/ndnp_mets_helper.rb'
74
+ - 'lib/iiif_print/ingest/pdf_issue_ingester.rb'
75
+ - 'spec/model_shared.rb'
76
+
77
+ Naming/PredicateName:
78
+ Exclude:
79
+ - ''
80
+
81
+ # The guidance is to use find, but that may not be what we're after. This is a
82
+ # quick adjustment to appease rubocop.
83
+ Performance/Detect:
84
+ Enabled: false
85
+
86
+ Performance/StringReplacement:
87
+ Exclude:
88
+ - 'app/indexers/concerns/iiif_print/indexes_full_text.rb'
89
+
90
+ Style/AsciiComments:
91
+ Enabled: false
92
+
93
+ Style/CollectionMethods:
94
+ PreferredMethods:
95
+ collect: 'map'
96
+ collect!: 'map!'
97
+ inject: 'reduce'
98
+ detect: 'find'
99
+ find_all: 'select'
100
+
101
+ Style/SymbolArray:
102
+ Enabled: false
103
+
104
+ Style/ClassAndModuleChildren:
105
+ Enabled: false
106
+
107
+ Style/SingleLineBlockParams:
108
+ Enabled: false
109
+
110
+ Rails/ApplicationJob:
111
+ Enabled: false
112
+
113
+ Rails/ApplicationRecord:
114
+ Enabled: false
115
+
116
+ # We define custom methods like `find_by_user_key`,
117
+ # `find_by_created_date`, etc
118
+ Rails/DynamicFindBy:
119
+ Enabled: false
120
+
121
+ Rails/FilePath:
122
+ Exclude:
123
+ - 'spec/abilities/**/*'
124
+
125
+ Rails/OutputSafety:
126
+ Exclude:
127
+ - 'lib/generators/iiif_print/templates/config/initializers/patch_blacklight_advanced_search.rb'
128
+ - 'spec/helpers/iiif_print_helper_spec.rb'
129
+
130
+ RSpec/DescribeClass:
131
+ Exclude:
132
+ - 'spec/abilities/**/*'
133
+ - 'spec/conversions/**/*'
134
+ - 'spec/features/**/*'
135
+ - 'spec/inputs/**/*'
136
+ - 'spec/views/**/*'
137
+ - 'spec/lib/tasks/**/*'
138
+
139
+ # # By default RSpec/MessageSpies has the following:
140
+ # # Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
141
+ # # The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
142
+ RSpec/MessageSpies:
143
+ Enabled: false
144
+
145
+ RSpec/InstanceVariable:
146
+ Exclude:
147
+ - 'spec/**/*'
148
+
149
+ RSpec/ExpectActual:
150
+ Enabled: false
151
+
152
+ RSpec/LetSetup:
153
+ Enabled: false
154
+
155
+ RSpec/MessageExpectation:
156
+ Enabled: false
157
+
158
+ RSpec/NamedSubject:
159
+ Enabled: false
160
+
161
+ RSpec/NestedGroups:
162
+ Enabled: false
163
+
164
+ RSpec/LeadingSubject:
165
+ Enabled: false
166
+
167
+ RSpec/VerifiedDoubles:
168
+ Enabled: false
169
+
170
+ RSpec/ExampleLength:
171
+ Max: 19
172
+
173
+ Rails/RakeEnvironment:
174
+ Enabled: false
175
+
176
+ Style/IdenticalConditionalBranches:
177
+ Enabled: false
data/.solr_wrapper ADDED
@@ -0,0 +1,8 @@
1
+ # Place any default configuration for solr_wrapper here
2
+ version: 7.7.2
3
+ # port: 8983
4
+ instance_dir: tmp/solr-development
5
+ collection:
6
+ persist: true
7
+ dir: .internal_test_app/solr/config/
8
+ name: hydra-development
data/.travis.yml ADDED
@@ -0,0 +1,49 @@
1
+ language: ruby
2
+ dist: xenial
3
+
4
+ jdk:
5
+ - openjdk8
6
+
7
+ addons:
8
+ chrome: stable
9
+ apt:
10
+ packages:
11
+ - ghostscript
12
+ - graphicsmagick
13
+ - imagemagick
14
+ - libreoffice
15
+ - poppler-utils
16
+ - tesseract-ocr
17
+ - libopenjp2-7
18
+ - libopenjp2-tools
19
+ cache:
20
+ bundler: true
21
+
22
+ before_install:
23
+ - sudo apt-get update -q
24
+ - gem update --system
25
+ - gem install bundler
26
+ - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &
27
+ - sudo wget -P /opt/install https://brussels.lib.utah.edu/FITS/fits-1.4.1.zip
28
+ - sudo unzip /opt/install/fits-1.4.1.zip -d /opt/install/fits-1.4.1
29
+ - sudo chmod +x /opt/install/fits-1.4.1/*.sh
30
+ - sudo ln -s /opt/install/fits-1.4.1/fits.sh /usr/local/bin/fits.sh
31
+ - sudo wget -q -O /etc/ImageMagick-6/policy.xml https://raw.githubusercontent.com/samvera-labs/newspaper_works/master/config/vendor/imagemagick-6-policy.xml
32
+ - sudo wget -q -O /opt/install/fits-1.4.1/xml/fits.xml https://raw.githubusercontent.com/samvera-labs/newspaper_works/82d0c18d1679696a762fd7083db83dac49de9b35/config/vendor/fits.xml
33
+ rvm:
34
+ - 2.5.5
35
+
36
+ env:
37
+ global:
38
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
39
+ #- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-puma --skip-test'
40
+ # Travis should check every minor version in a range of supported versions, because
41
+ # rails does not follow sem-ver conventions, see http://guides.rubyonrails.org/maintenance_policy.html
42
+ # It should be sufficient to test only the latest of the patch versions for a minor version, they
43
+ # should be compatible across patch versions (only bug fixes are released in patch versions).
44
+ matrix:
45
+ - "RAILS_VERSION=5.1.7"
46
+ - "RAILS_VERSION=5.2"
47
+
48
+ services:
49
+ - redis
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,181 @@
1
+ # How to Contribute
2
+
3
+ We want your help to make the Samvera community great. There are a few guidelines
4
+ that we need contributors to follow so that we can have a chance of
5
+ keeping on top of things.
6
+
7
+ ## Code of Conduct
8
+
9
+ The Samvera Community is dedicated to providing a welcoming and positive
10
+ experience for all its members, whether they are at a formal gathering, in
11
+ a social setting, or taking part in activities online. Please see our
12
+ [Code of Conduct](CODE_OF_CONDUCT.md) for more information.
13
+
14
+ ## Language
15
+
16
+ The language we use matters. Today, tomorrow, and for years to come
17
+ people will read the code we write. They will judge us for our
18
+ design, logic, and the words we use to describe the system.
19
+
20
+ Our words should be accessible. Favor descriptive words that give
21
+ meaning while avoiding reinforcing systemic inequities. For example,
22
+ in the Samvera community, we should favor using allowed_list instead
23
+ of whitelist, denied_list instead of blacklist, or source/copy
24
+ instead of master/slave.
25
+
26
+ We're going to get it wrong, but this is a call to keep working to
27
+ make it right. View our code and the words we choose as a chance to
28
+ have a conversation. A chance to grow an understanding of the systems
29
+ we develop as well as the systems in which we live.
30
+
31
+ See [“Blacklists” and “whitelists”: a salutary warning concerning the
32
+ prevalence of racist language in discussions of predatory
33
+ publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
34
+ further details.
35
+
36
+ ## Contribution Tasks
37
+
38
+ - Reporting Issues
39
+ - Making Changes
40
+ - Documenting Code
41
+ - Committing Changes
42
+ - Submitting Changes
43
+ - Reviewing and Merging Changes
44
+
45
+ ### Reporting Issues
46
+
47
+ - Make sure you have a [GitHub account](https://github.com/signup/free)
48
+ - Submit a [Github issue](https://github.com/scientist-softserv/iiif_print/issues/) by:
49
+ - Clearly describing the issue
50
+ - Provide a descriptive summary
51
+ - Explain the expected behavior
52
+ - Explain the actual behavior
53
+ - Provide steps to reproduce the actual behavior
54
+
55
+ ### Making Changes
56
+
57
+ - Fork the repository on GitHub
58
+ - Create a topic branch from where you want to base your work.
59
+ - This is usually the `main` branch.
60
+ - To quickly create a topic branch based on `main`; `git branch fix/main/my_contribution main`
61
+ - Then checkout the new branch with `git checkout fix/main/my_contribution`.
62
+ - Please avoid working directly on the `main` branch.
63
+ - Please do not create a branch called `master`. (See note below.)
64
+ - You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
65
+ - Make sure you have added sufficient tests and documentation for your changes.
66
+ - Test functionality with RSpec; Test features / UI with Capybara.
67
+ - Run _all_ the tests to assure nothing else was accidentally broken.
68
+
69
+ NOTE: This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct)
70
+ and [language recommendations](#language).
71
+ Please **_do not_** create a branch called `master` for this repository or as part of
72
+ your pull request; the branch will either need to be removed or renamed before it can
73
+ be considered for inclusion in the code base and history of this repository.
74
+
75
+ ### Documenting Code
76
+
77
+ - All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
78
+ - Documentation should seek to answer the question "why does this code exist?"
79
+ - Document private / protected methods as desired.
80
+ - If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
81
+ - If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
82
+ - This work greatly increases the usability of the code base and supports the on-ramping of new committers.
83
+ - We will all be understanding of one another's time constraints in this area.
84
+ - [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
85
+
86
+ ### Committing changes
87
+
88
+ - Make commits of logical units.
89
+ - Check for unnecessary whitespace with `git diff --check` before committing.
90
+ - Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
91
+ - If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
92
+
93
+ ```
94
+ Present tense short summary (50 characters or less)
95
+
96
+ More detailed description, if necessary. It should be wrapped to 72
97
+ characters. Try to be as descriptive as you can, even if you think that
98
+ the commit content is obvious, it may not be obvious to others. You
99
+ should add such description also if it's already present in bug tracker,
100
+ it should not be necessary to visit a webpage to check the history.
101
+
102
+ Include Closes #<issue-number> when relavent.
103
+
104
+ Description can have multiple paragraphs and you can use code examples
105
+ inside, just indent it with 4 spaces:
106
+
107
+ class PostsController
108
+ def index
109
+ respond_to do |wants|
110
+ wants.html { render 'index' }
111
+ end
112
+ end
113
+ end
114
+
115
+ You can also add bullet points:
116
+
117
+ - you can use dashes or asterisks
118
+
119
+ - also, try to indent next line of a point for readability, if it's too
120
+ long to fit in 72 characters
121
+ ```
122
+
123
+ - Make sure you have added the necessary tests for your changes.
124
+ - Run _all_ the tests to assure nothing else was accidentally broken.
125
+ - When you are ready to submit a pull request
126
+
127
+ ### Submitting Changes
128
+
129
+ - Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
130
+ - Make sure your branch is up to date with its parent branch (i.e. main)
131
+ - `git checkout main`
132
+ - `git pull --rebase`
133
+ - `git checkout <your-branch>`
134
+ - `git rebase main`
135
+ - It is a good idea to run your tests again.
136
+ - If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
137
+ - [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
138
+ - `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
139
+ - Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
140
+ - Push your changes to a topic branch in your fork of the repository.
141
+ - Submit a pull request from your fork to the project.
142
+
143
+ ### Reviewing and Merging Changes
144
+
145
+ We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
146
+ Common checks that may occur in our repositories:
147
+
148
+ 1. [CircleCI](https://circleci.com/gh/samvera) - where our automated tests are running
149
+ 2. RuboCop/Bixby - where we check for style violations
150
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
151
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
152
+
153
+ If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
154
+
155
+ _Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (CI tests are usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request._
156
+
157
+ #### Things to Consider When Reviewing
158
+
159
+ First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
160
+
161
+ - Ask clarifying questions
162
+ - State your understanding and expectations
163
+ - Provide example code or alternate solutions, and explain why
164
+
165
+ This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
166
+
167
+ - Does the commit message explain what is going on?
168
+ - Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
169
+ - Do new or changed methods, modules, and classes have documentation?
170
+ - Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
171
+ - Does the description of the new/changed specs match your understanding of what the spec is doing?
172
+ - Did the Continuous Integration tests complete successfully?
173
+
174
+ If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
175
+
176
+ # Additional Resources
177
+
178
+ - [General GitHub documentation](http://help.github.com/)
179
+ - [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
180
+ - [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
181
+ - [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
data/Dockerfile ADDED
@@ -0,0 +1,15 @@
1
+ FROM ghcr.io/scientist-softserv/dev-ops/samvera:e9200061 as hyku-base
2
+ USER root
3
+ RUN apk add --no-cache sqlite
4
+ USER app
5
+
6
+ RUN sh -l -c " \
7
+ git config --global --add safe.directory /app/samvera/hyrax-webapp && \
8
+ bundle config set --global force_ruby_platform ruby"
9
+
10
+ COPY --chown=1001:101 $APP_PATH/Gemfile* /app/samvera/hyrax-webapp/
11
+ COPY --chown=1001:101 $APP_PATH/*.gemspec /app/samvera/hyrax-webapp/
12
+ COPY --chown=1001:101 $APP_PATH/lib/iiif_print/version.rb /app/samvera/hyrax-webapp/lib/iiif_print/
13
+ RUN bundle install --jobs "$(nproc)"
14
+
15
+ COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
data/Gemfile ADDED
@@ -0,0 +1,52 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Please see iiif_print.gemspec for dependency information.
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'coveralls', require: false
8
+ end
9
+
10
+ # BEGIN ENGINE_CART BLOCK
11
+ # engine_cart: 2.5.0
12
+ # engine_cart stanza: 2.5.0
13
+ # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
14
+ file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
15
+ if File.exist?(file)
16
+ begin
17
+ eval_gemfile file
18
+ rescue Bundler::GemfileError => e
19
+ Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
20
+ Bundler.ui.warn e.message
21
+ end
22
+ else
23
+ Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
24
+
25
+ if ENV['RAILS_VERSION']
26
+ if ENV['RAILS_VERSION'] == 'edge'
27
+ gem 'rails', github: 'rails/rails'
28
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
29
+ else
30
+ gem 'rails', ENV['RAILS_VERSION']
31
+ end
32
+
33
+ case ENV['RAILS_VERSION']
34
+ when /^6.0/
35
+ gem 'sass-rails', '>= 6'
36
+ gem 'webpacker', '~> 4.0'
37
+ when /^5.[12]/
38
+ gem 'sass-rails', '~> 5.0'
39
+ gem 'sprockets', '~> 3.7'
40
+ gem 'thor', '~> 0.20'
41
+ when /^4.2/
42
+ gem 'coffee-rails', '~> 4.1.0'
43
+ gem 'responders', '~> 2.0'
44
+ gem 'sass-rails', '>= 5.0'
45
+ when /^4.[01]/
46
+ # rubocop:disable Bundler/DuplicatedGem
47
+ gem 'sass-rails', '< 5.0'
48
+ # rubocop:enable Bundler/DuplicatedGem
49
+ end
50
+ end
51
+ end
52
+ # END ENGINE_CART BLOCK