hydra-derivatives 3.8.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b9642a74101fb1b816e9b1a6e994065991930c6d3fe51a48f698275b11291c8
4
- data.tar.gz: 3b4f2505d50372b3d52318deefaab4586028e48d3f6820c9179c1c747a7e4c2b
3
+ metadata.gz: 0320cb9c40c7d32320a33c09092567f69176ef7ba09d0e3eb85a4d8a59e9324d
4
+ data.tar.gz: 84689d529bc702a13c067cead22b253de5982c185850032186c7d0ba72683b10
5
5
  SHA512:
6
- metadata.gz: e9cdbf207aca051db6a3d281e7e019df5be05f4fa0b5f6e1c65b64cb6e3388c8838d9cd13991e7b1f740b1c79dbbd65b782dea3d7e5661a5bcdcd07c40bd540b
7
- data.tar.gz: d96492b3804b2f19effc7aa5c0de247080324c036efea58e34c7db7e1888ff14af9010654da8afd0ffbf9b62262359f208cb1458faef18785f40f9fbc9d25758
6
+ metadata.gz: 2138cc83cfa2bd0db1825831f4d4a70a4112ce0b728d957df5119c4af55163e932653758f06035c0734a6b284e1be6b0428ebaf71289b94e8108328f2ef12bfc
7
+ data.tar.gz: ff20e72fcd91fda4a9b52aad791af7c467b893a3ae1df79fef818a4606be8c3ec507598ab20f0afc3ec1477b5621f14c2a0538d890ec4ba3125ff38df6972b5c
data/.circleci/config.yml CHANGED
@@ -27,8 +27,9 @@ jobs:
27
27
  - run:
28
28
  name: Install dependencies
29
29
  command: |
30
+ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
30
31
  sudo apt-get update
31
- sudo apt-get install ghostscript libpng-dev imagemagick ffmpeg libreoffice dcraw
32
+ sudo apt-get install ghostscript libpng-dev imagemagick graphicsmagick ffmpeg libreoffice dcraw
32
33
  - restore_cache:
33
34
  name: Restore Kakadu Cache
34
35
  keys:
@@ -38,7 +39,7 @@ jobs:
38
39
  command: |
39
40
  if [ ! -f ~/downloads/kakadu.zip ]; then
40
41
  mkdir -p ~/downloads
41
- wget http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip -O ~/downloads/kakadu.zip
42
+ wget http://kakadusoftware.com/wp-content/uploads/KDU841_Demo_Apps_for_Linux-x86-64_231117.zip -O ~/downloads/kakadu.zip
42
43
  fi
43
44
  - save_cache:
44
45
  name: Save Kakadu Cache
@@ -49,7 +50,7 @@ jobs:
49
50
  name: Install Kakadu
50
51
  command: |
51
52
  unzip ~/downloads/kakadu.zip
52
- mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kakadu
53
+ mv KDU841_Demo_Apps_for_Linux-x86-64_231117 kakadu
53
54
  sudo cp kakadu/*.so /usr/lib
54
55
  sudo cp kakadu/* /usr/bin
55
56
  kdu_compress -version
@@ -63,7 +64,7 @@ jobs:
63
64
  - samvera/bundle:
64
65
  ruby_version: << parameters.ruby_version >>
65
66
  bundler_version: << parameters.bundler_version >>
66
- cache_version: "2"
67
+ cache_version: "3"
67
68
 
68
69
  - samvera/install_solr_core
69
70
 
@@ -74,18 +75,15 @@ jobs:
74
75
  workflows:
75
76
  ci:
76
77
  jobs:
78
+ - bundle_lint_test:
79
+ name: ruby3-3
80
+ ruby_version: 3.3.5
77
81
  - bundle_lint_test:
78
82
  name: ruby3-2
79
- ruby_version: 3.2.0
83
+ ruby_version: 3.2.5
80
84
  - bundle_lint_test:
81
85
  name: ruby3-1
82
- ruby_version: 3.1.3
83
- - bundle_lint_test:
84
- name: ruby3-0
85
- ruby_version: 3.0.3
86
- - bundle_lint_test:
87
- name: ruby2-7
88
- ruby_version: 2.7.7
86
+ ruby_version: 3.1.6
89
87
 
90
88
  nightly:
91
89
  triggers:
@@ -96,15 +94,12 @@ workflows:
96
94
  only:
97
95
  - main
98
96
  jobs:
97
+ - bundle_lint_test:
98
+ name: ruby3-3
99
+ ruby_version: 3.3.5
99
100
  - bundle_lint_test:
100
101
  name: ruby3-2
101
- ruby_version: 3.2.0
102
+ ruby_version: 3.2.5
102
103
  - bundle_lint_test:
103
104
  name: ruby3-1
104
- ruby_version: 3.1.3
105
- - bundle_lint_test:
106
- name: ruby3-0
107
- ruby_version: 3.0.3
108
- - bundle_lint_test:
109
- name: ruby2-7
110
- ruby_version: 2.7.7
105
+ ruby_version: 3.1.6
data/Dockerfile ADDED
@@ -0,0 +1,33 @@
1
+ ARG RUBY_VERSION=3.2.2
2
+
3
+ FROM rubylang/ruby:$RUBY_VERSION-dev-jammy
4
+
5
+ RUN apt update && apt -y install \
6
+ imagemagick \
7
+ zip \
8
+ ghostscript \
9
+ libpng-dev \
10
+ graphicsmagick \
11
+ ffmpeg \
12
+ libreoffice \
13
+ git \
14
+ dcraw \
15
+ libyaml-dev
16
+
17
+ RUN mkdir -p /opt/kakadu/downloads
18
+ RUN wget http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip -O /opt/kakadu/downloads/kakadu.zip \
19
+ && unzip /opt/kakadu/downloads/kakadu.zip \
20
+ && mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kakadu \
21
+ && cp kakadu/*.so /usr/lib \
22
+ && cp kakadu/* /usr/bin
23
+
24
+ RUN sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml
25
+ RUN sed -i 's/decode="dng:decode" command=".*"\/>$/decode="dng:decode" command="\&quot\;dcraw\&quot\; -c -q 3 -H 5 -w \&quot\;\%i\&quot\; \| \&quot\;convert\&quot\; - \&quot\;\%u\.png\&quot\;"\/>/' /etc/ImageMagick-6/delegates.xml
26
+
27
+ RUN addgroup --system --gid 1001 app && \
28
+ adduser --system --ingroup app --uid 1001 --shell /bin/sh --home /app app
29
+
30
+ RUN mkdir -p /app/samvera/hydra-derviatives
31
+ WORKDIR /app/samvera/hydra-derivatives
32
+ COPY ./ /app/samvera/hydra-derivatives
33
+ RUN gem install bundler && bundle install --jobs=3 --retry=3
data/Gemfile CHANGED
@@ -3,8 +3,6 @@ source 'https://rubygems.org'
3
3
  # Please see hydra-derivatives.gemspec for dependency information.
4
4
  gemspec
5
5
 
6
- gem 'sprockets', '~> 3.7'
7
-
8
6
  group :development, :test do
9
7
  gem 'bixby'
10
8
  gem 'rspec_junit_formatter'
data/README.md CHANGED
@@ -253,6 +253,32 @@ If you don't want to run the whole suite all at once like CI, do the following:
253
253
  1. Run the test servers with `rake derivatives:test_server`
254
254
  2. Run the tests.
255
255
 
256
+ ## Running tests with Docker
257
+
258
+ First, make sure you have installed [Docker](https://www.docker.com/).
259
+
260
+ Within your cloned repository, tell Docker to get started installing your development environment:
261
+
262
+ ```sh
263
+ docker compose build
264
+ docker compose up
265
+ ```
266
+
267
+ This starts containers for:
268
+
269
+ - Fedora
270
+ - Solr
271
+
272
+ It also builds an image containing all dependencies needed for the tests.
273
+
274
+ To stop the containers, type <kbd>Ctrl</kbd>+<kbd>c</kbd>. To restart the containers you need only run `docker compose up`.
275
+
276
+ You can run the full test suite using the following command:
277
+
278
+ ```sh
279
+ docker compose run -w /app/samvera/hydra-derivatives test sh -c "bundle exec rspec"
280
+ ```
281
+
256
282
  # Acknowledgments
257
283
 
258
284
  This software has been developed by and is brought to you by the Samvera community. Learn more at the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.8.0
1
+ 4.0.0
@@ -0,0 +1,46 @@
1
+ version: '2.2'
2
+
3
+ volumes:
4
+ solr:
5
+ fcrepo:
6
+
7
+ networks:
8
+ internal:
9
+
10
+ services:
11
+
12
+ solr:
13
+ image: solr:8
14
+ ports:
15
+ - 8985:8983
16
+ command:
17
+ - bash
18
+ - "-c"
19
+ - "precreate-core hydra-test /opt/solr/server/configsets/hydra-test; exec solr -f"
20
+ volumes:
21
+ - .:/app
22
+ - ./solr/config:/opt/solr/server/configsets/hydra-test
23
+ - solr:/opt/solr/server/solr
24
+ networks:
25
+ internal:
26
+
27
+ fcrepo:
28
+ image: ghcr.io/samvera/fcrepo4:4.7.5
29
+ volumes:
30
+ - fcrepo:/data:cached
31
+ ports:
32
+ - 8986:8080
33
+ networks:
34
+ internal:
35
+
36
+ test:
37
+ build: .
38
+ env_file:
39
+ - test.env
40
+ volumes:
41
+ - .:/app/samvera/hydra-derivatives # Volume mounted
42
+ networks:
43
+ internal:
44
+ depends_on:
45
+ - fcrepo
46
+ - solr
@@ -18,15 +18,15 @@ Gem::Specification.new do |spec|
18
18
  spec.add_development_dependency 'bundler', '~> 2.1'
19
19
  spec.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
20
20
  spec.add_development_dependency 'pry-byebug'
21
- spec.add_development_dependency 'rails', '> 5.1', '< 7.1'
21
+ spec.add_development_dependency 'rails', '> 5.1', '< 8.0'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec', '~> 3.1'
24
24
  spec.add_development_dependency "solr_wrapper"
25
25
 
26
- spec.add_dependency 'active_encode', '~> 0.1'
26
+ spec.add_dependency 'active_encode', '~> 1.2'
27
27
  spec.add_dependency 'active-fedora', '>= 14.0'
28
28
  spec.add_dependency 'active-triples', '>= 1.2'
29
- spec.add_dependency 'activesupport', '>= 4.0', '< 7.1'
29
+ spec.add_dependency 'activesupport', '>= 4.0', '< 8.0'
30
30
  spec.add_dependency 'addressable', '~> 2.5'
31
31
  spec.add_dependency 'deprecation'
32
32
  spec.add_dependency 'mime-types', '> 2.0', '< 4.0'
@@ -20,16 +20,38 @@ module Hydra::Derivatives::Processors
20
20
  # When resizing images, it is necessary to flatten any layers, otherwise the background
21
21
  # may be completely black. This happens especially with PDFs. See #110
22
22
  def create_resized_image
23
- create_image do |xfrm|
23
+ if Hydra::Derivatives::ImageService.processor == :graphicsmagick
24
+ create_resized_image_with_graphicsmagick
25
+ else
26
+ create_resized_image_with_imagemagick
27
+ end
28
+ end
29
+
30
+ def create_resized_image_with_graphicsmagick
31
+ Hydra::Derivatives::Logger.debug('[ImageProcessor] Using GraphicsMagick image resize method')
32
+ create_image do |temp_file|
24
33
  if size
25
- xfrm.combine_options do |i|
26
- i.flatten
27
- i.resize(size)
34
+ # remove layers and resize using convert instead of mogrify
35
+ MiniMagick::Tool::Convert.new do |cmd|
36
+ cmd << temp_file.path # input
37
+ cmd.flatten
38
+ cmd.resize(size)
39
+ cmd << temp_file.path # output
28
40
  end
29
41
  end
30
42
  end
31
43
  end
32
44
 
45
+ def create_resized_image_with_imagemagick
46
+ Hydra::Derivatives::Logger.debug('[ImageProcessor] Using ImageMagick image resize method')
47
+ create_image do |temp_file|
48
+ if size
49
+ temp_file.flatten
50
+ temp_file.resize(size)
51
+ end
52
+ end
53
+ end
54
+
33
55
  def create_image
34
56
  xfrm = selected_layers(load_image_transformer)
35
57
  yield(xfrm) if block_given?
@@ -21,7 +21,7 @@ module Hydra::Derivatives::Processors::Video
21
21
 
22
22
  def mpeg4
23
23
  audio_encoder = Hydra::Derivatives::AudioEncoder.new
24
- @mpeg4 ||= CodecConfig.new("-vcodec libx264 -acodec #{audio_encoder.audio_encoder}")
24
+ @mpeg4 ||= CodecConfig.new("-vcodec libx264 -profile:v high -pix_fmt yuv420p -acodec #{audio_encoder.audio_encoder}")
25
25
  end
26
26
 
27
27
  def webm
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ module Hydra::Derivatives
3
+ module ImageService
4
+ def self.default_processor
5
+ :imagemagick
6
+ end
7
+
8
+ def self.processor
9
+ case ENV['IMAGE_PROCESSOR']
10
+ when 'imagemagick'
11
+ Hydra::Derivatives::Logger.debug('[ImageProcessor] Using ImageMagick as image processor')
12
+ :imagemagick
13
+ when 'graphicsmagick'
14
+ Hydra::Derivatives::Logger.debug('[ImageProcessor] Using GraphicsMagick as image processor')
15
+ :graphicsmagick
16
+ else
17
+ Hydra::Derivatives::Logger.debug("[ImageProcessor] The environment variable IMAGE_PROCESSOR should be set to either 'imagemagick' or 'graphicsmagick'. It is currently set to: #{ENV['IMAGE_PROCESSOR']}. Defaulting to using #{default_processor}")
18
+ default_processor
19
+ end
20
+ end
21
+ end
22
+ end
@@ -38,6 +38,7 @@ module Hydra
38
38
  autoload :PersistExternalFileOutputFileService
39
39
  autoload :TempfileService
40
40
  autoload :MimeTypeService
41
+ autoload :ImageService
41
42
  end
42
43
 
43
44
  # Raised if the timout elapses
data/test.env ADDED
@@ -0,0 +1,9 @@
1
+ FCREPO_HOST=fcrepo
2
+ FCREPO_PORT=8080
3
+ FCREPO_REST_PATH=rest
4
+ FCREPO_TEST_BASE_PATH=/test
5
+ SOLR_HOST=solr
6
+ SOLR_PORT=8983
7
+ SOLR_TEST_URL=http://solr:8983/solr/hydra-test
8
+ SOLR_URL=http://solr:8983/solr/
9
+ FCREPO_CONFIG_PATH=spec/support/config/fedora.yml
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-derivatives
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '5.1'
62
62
  - - "<"
63
63
  - !ruby/object:Gem::Version
64
- version: '7.1'
64
+ version: '8.0'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '5.1'
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
- version: '7.1'
74
+ version: '8.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.1'
123
+ version: '1.2'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.1'
130
+ version: '1.2'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: active-fedora
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,7 @@ dependencies:
165
165
  version: '4.0'
166
166
  - - "<"
167
167
  - !ruby/object:Gem::Version
168
- version: '7.1'
168
+ version: '8.0'
169
169
  type: :runtime
170
170
  prerelease: false
171
171
  version_requirements: !ruby/object:Gem::Requirement
@@ -175,7 +175,7 @@ dependencies:
175
175
  version: '4.0'
176
176
  - - "<"
177
177
  - !ruby/object:Gem::Version
178
- version: '7.1'
178
+ version: '8.0'
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: addressable
181
181
  requirement: !ruby/object:Gem::Requirement
@@ -261,6 +261,7 @@ files:
261
261
  - ".solr_wrapper"
262
262
  - CODE_OF_CONDUCT.md
263
263
  - CONTRIBUTING.md
264
+ - Dockerfile
264
265
  - Gemfile
265
266
  - History.md
266
267
  - LICENSE.txt
@@ -273,6 +274,7 @@ files:
273
274
  - config/jetty.yml
274
275
  - config/solr_wrapper_test.yml
275
276
  - doc/amazon_elastic_transcoder.md
277
+ - docker-compose.yml
276
278
  - hydra-derivatives.gemspec
277
279
  - lib/color_profiles/license.txt
278
280
  - lib/color_profiles/sRGB_IEC61966-2-1_no_black_scaling.icc
@@ -305,6 +307,7 @@ files:
305
307
  - lib/hydra/derivatives/runners/runner.rb
306
308
  - lib/hydra/derivatives/runners/video_derivatives.rb
307
309
  - lib/hydra/derivatives/services/capability_service.rb
310
+ - lib/hydra/derivatives/services/image_service.rb
308
311
  - lib/hydra/derivatives/services/mime_type_service.rb
309
312
  - lib/hydra/derivatives/services/persist_basic_contained_output_file_service.rb
310
313
  - lib/hydra/derivatives/services/persist_external_file_output_file_service.rb
@@ -328,6 +331,7 @@ files:
328
331
  - solr/config/xslt/example_atom.xsl
329
332
  - solr/config/xslt/example_rss.xsl
330
333
  - solr/config/xslt/luke.xsl
334
+ - test.env
331
335
  homepage: https://github.com/projecthydra/hydra-derivatives
332
336
  licenses:
333
337
  - APACHE2
@@ -348,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
348
352
  - !ruby/object:Gem::Version
349
353
  version: '0'
350
354
  requirements: []
351
- rubygems_version: 3.1.6
355
+ rubygems_version: 3.5.3
352
356
  signing_key:
353
357
  specification_version: 4
354
358
  summary: Derivative generation plugin for hydra