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
data/lib/iiif_print.rb ADDED
@@ -0,0 +1,136 @@
1
+ require "iiif_print/engine"
2
+ require "iiif_print/errors"
3
+ require "iiif_print/jp2_image_metadata"
4
+ require "iiif_print/image_tool"
5
+ require "iiif_print/text_extraction"
6
+ require "iiif_print/data"
7
+ require "iiif_print/configuration"
8
+ require "iiif_print/base_derivative_service"
9
+ require "iiif_print/jp2_derivative_service"
10
+ require "iiif_print/pdf_derivative_service"
11
+ require "iiif_print/text_extraction_derivative_service"
12
+ require "iiif_print/text_formats_from_alto_service"
13
+ require "iiif_print/tiff_derivative_service"
14
+ require "iiif_print/lineage_service"
15
+ require "iiif_print/metadata"
16
+ require "iiif_print/works_controller_behavior"
17
+ require "iiif_print/jobs/application_job"
18
+ require "iiif_print/blacklight_iiif_search/annotation_decorator"
19
+ require "iiif_print/jobs/child_works_from_pdf_job"
20
+ require "iiif_print/jobs/create_relationships_job"
21
+ require "iiif_print/split_pdfs/pages_into_images_service"
22
+ require "iiif_print/split_pdfs/child_work_creation_from_pdf_service"
23
+
24
+ module IiifPrint
25
+ extend ActiveSupport::Autoload
26
+ autoload :Configuration
27
+ autoload :CatalogSearchBuilder
28
+
29
+ ##
30
+ # @api public
31
+ # Exposes the IiifPrint configuration.
32
+ #
33
+ # @yield [IiifPrint::Configuration] if a block is passed
34
+ # @return [IiifPrint::Configuration]
35
+ # @see IiifPrint::Configuration for configuration options
36
+ def self.config(&block)
37
+ @config ||= IiifPrint::Configuration.new
38
+ yield @config if block
39
+ @config
40
+ end
41
+
42
+ DEFAULT_MODEL_CONFIGURATION = {
43
+ # Split a PDF into individual page images and create a new child work for each image.
44
+ pdf_splitter_job: IiifPrint::Jobs::ChildWorksFromPdfJob,
45
+ pdf_splitter_service: IiifPrint::SplitPdfs::PagesIntoImagesService,
46
+ derivative_service_plugins: [
47
+ IiifPrint::JP2DerivativeService,
48
+ IiifPrint::PDFDerivativeService,
49
+ IiifPrint::TextExtractionDerivativeService,
50
+ IiifPrint::TIFFDerivativeService
51
+ ]
52
+ }.freeze
53
+
54
+ # This is the record level configuration for PDF split handling.
55
+ ModelConfig = Struct.new(:pdf_split_child_model, *DEFAULT_MODEL_CONFIGURATION.keys, keyword_init: true)
56
+
57
+ # This method is responsible for assisting in the configuration of a "model".
58
+ #
59
+ # @example
60
+ # class Book < ActiveFedora::Base
61
+ # include IiifPrint.model_configuration(
62
+ # pdf_split_child_model: Page,
63
+ # derivative_service_plugins: [
64
+ # IiifPrint::TIFFDerivativeService
65
+ # ]
66
+ # )
67
+ # end
68
+ #
69
+ # @param kwargs [Hash<Symbol,Object>] the configuration values that overrides the
70
+ # DEFAULT_MODEL_CONFIGURATION.
71
+ #
72
+ # @return [Module]
73
+ #
74
+ # @see IiifPrint::DEFAULT_MODEL_CONFIGURATION
75
+ # @todo Because not every job will split PDFs and write to a child model. May want to introduce
76
+ # an alternative splitting method to create new filesets on the existing work instead of new child works.
77
+ def self.model_configuration(**kwargs)
78
+ Module.new do
79
+ def iiif_print_config?
80
+ true
81
+ end
82
+
83
+ # We don't know what you may want in your configuration, but from this gems implementation,
84
+ # we're going to provide the defaults to ensure that it works.
85
+ DEFAULT_MODEL_CONFIGURATION.each_pair do |key, default_value|
86
+ kwargs[key] ||= default_value
87
+ end
88
+
89
+ define_method(:iiif_print_config) do
90
+ @iiif_print_config ||= ModelConfig.new(**kwargs)
91
+ end
92
+ end
93
+ end
94
+
95
+ # @api public
96
+ #
97
+ # Map the given work's metadata to the given IIIF version spec's metadata structure. This
98
+ # is intended to be a drop-in replacement for `Hyrax::IiifManifestPresenter#manifest_metadata`.
99
+ #
100
+ # @param work [Object]
101
+ # @param version [Integer]
102
+ # @param fields [Array<IiifPrint::Metadata::Field>, Array<#name, #label>]
103
+ # @return [Array<Hash>]
104
+ #
105
+ # @see specs for expected output
106
+ #
107
+ # @see Hyrax::IiifManifestPresenter#manifest_metadata
108
+ def self.manifest_metadata_for(work:,
109
+ version: config.default_iiif_manifest_version,
110
+ fields: default_fields_for(work),
111
+ current_ability:,
112
+ base_url:)
113
+ Metadata.build_metadata_for(work: work,
114
+ version: version,
115
+ fields: fields,
116
+ current_ability: current_ability,
117
+ base_url: base_url)
118
+ end
119
+
120
+ # Hash is an arbitrary attribute key/value pairs
121
+ # Struct is a defined set of attribute "keys". When we favor defined values,
122
+ # then we are naming the concept and defining the range of potential values.
123
+ Field = Struct.new(:name, :label, :options, keyword_init: true)
124
+
125
+ # @api private
126
+ # @todo Figure out a way to use a custom label, right now it takes it get rendered from the title.
127
+ def self.default_fields_for(_work, fields: config.metadata_fields)
128
+ fields.map do |field|
129
+ Field.new(
130
+ name: field.first,
131
+ label: Hyrax::Renderers::AttributeRenderer.new(field, nil).label,
132
+ options: field.last
133
+ )
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :iiif_print do
4
+ namespace :update do
5
+ desc 'Make sure all child work models have the correct attribute'
6
+ task is_child_attribute: [:environment] do
7
+ Account.find_each do |account|
8
+ switch!(account.cname) if defined? Account
9
+ puts "********************** switched to #{account.cname} **********************"
10
+ Hyrax.config.curation_concerns.each do |cc|
11
+ puts "********************** checking #{cc}s **********************"
12
+ next if cc.count.zero?
13
+
14
+ cc.find_each(&:save)
15
+ end
16
+ rescue StandardError
17
+ puts "********************** failed to update account #{account.cname} **********************"
18
+ next
19
+ end
20
+ end
21
+ end
22
+ end
data/spec/.keep.txt ADDED
@@ -0,0 +1 @@
1
+ spec dir for RSpec
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :ability do
3
+ user
4
+ initialize_with { new(user) }
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # will infer, create a NewspaperIssue object
2
+ FactoryBot.define do
3
+ factory :newspaper_issue do
4
+ title { ['Here and There'] }
5
+ depositor { User.batch_user.user_key }
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # will infer, create a NewspaperPage object
2
+ FactoryBot.define do
3
+ factory :newspaper_page do
4
+ title { ['Here and There'] }
5
+ depositor { User.batch_user.user_key }
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :newspaper_page_solr_document, class: SolrDocument do
3
+ initialize_with do
4
+ new(id: '123456',
5
+ title_tesim: ['Page 1'],
6
+ has_model_ssim: ['NewspaperPage'],
7
+ issue_id_ssi: 'abc123',
8
+ file_set_ids_ssim: ['7891011'],
9
+ thumbnail_path_ss: '/downloads/123456?file=thumbnail')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # will infer, create a NewspaperTitle object
2
+ FactoryBot.define do
3
+ factory :newspaper_title do
4
+ title { ['ACME Press'] }
5
+ lccn { 'sn2036999999' }
6
+ depositor { User.batch_user.user_key }
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :uploaded_pdf_file, class: Hyrax::UploadedFile do
3
+ initialize_with do
4
+ base = File.join(IiifPrint::GEM_PATH, 'spec', 'fixtures', 'files')
5
+ pdf_path = File.join(base, 'minimal-2-page.pdf')
6
+ new(file: File.open(pdf_path), user: create(:user))
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :uploaded_txt_file, class: Hyrax::UploadedFile do
3
+ initialize_with do
4
+ base = File.join(IiifPrint::GEM_PATH, 'spec', 'fixtures', 'files')
5
+ file_path = File.join(base, 'ndnp-sample1-txt.txt')
6
+ new(file: File.open(file_path), user: create(:user))
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :user do
3
+ id { "skroob" }
4
+ email { "spaceballs@example.com" }
5
+ password { "password_is_12345" }
6
+ initialize_with do
7
+ User.find_or_create_by(id: id) do |user|
8
+ user.email = email
9
+ user.password = password
10
+ end
11
+ end
12
+ end
13
+ end
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ ## Sample / fixture file manifest
2
+
3
+ * sample-4page-issue.pdf
4
+ - original: chicopee-weekly-journal_1856-05-24-p1.pdf
5
+ * page1.tiff
6
+ - first page from sample-4page-issue.pdf, converted to CCITT Group 4
7
+ encoded (lossless compressed) TIFF via Ghostscript.