From 431d7e167c46f2ad20fe598064f3b53c576d8000 Mon Sep 17 00:00:00 2001 From: Trey Pendragon Date: Thu, 12 Dec 2024 10:48:59 -0800 Subject: [PATCH] VIPS -> Vips. --- app/derivative_services/default_derivative_service.rb | 2 +- app/derivative_services/scanned_map_derivative_service.rb | 2 +- app/derivative_services/vips_derivative_service.rb | 6 +++--- app/jobs/generate_pyramidal_tiff_job.rb | 2 +- config/initializers/inflections.rb | 1 - spec/derivative_services/vips_derivative_service_spec.rb | 8 ++++---- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/derivative_services/default_derivative_service.rb b/app/derivative_services/default_derivative_service.rb index 5ba850e94a..20f595546c 100644 --- a/app/derivative_services/default_derivative_service.rb +++ b/app/derivative_services/default_derivative_service.rb @@ -78,7 +78,7 @@ def hocr_derivative_service(change_set_persister = self.change_set_persister) end def vips_derivative_service(change_set_persister = self.change_set_persister) - VIPSDerivativeService::Factory.new(change_set_persister: pyramidal_change_set_persister(change_set_persister)).new(id: id) + VipsDerivativeService::Factory.new(change_set_persister: pyramidal_change_set_persister(change_set_persister)).new(id: id) end def pyramidal_change_set_persister(change_set_persister) diff --git a/app/derivative_services/scanned_map_derivative_service.rb b/app/derivative_services/scanned_map_derivative_service.rb index 6e088d88b0..fb55b08986 100644 --- a/app/derivative_services/scanned_map_derivative_service.rb +++ b/app/derivative_services/scanned_map_derivative_service.rb @@ -61,7 +61,7 @@ def thumbnail_derivative_service end def vips_derivative_service - VIPSDerivativeService::Factory.new(change_set_persister: pyramidal_change_set_persister(change_set_persister)).new(id: id) + VipsDerivativeService::Factory.new(change_set_persister: pyramidal_change_set_persister(change_set_persister)).new(id: id) end def pyramidal_change_set_persister(change_set_persister) diff --git a/app/derivative_services/vips_derivative_service.rb b/app/derivative_services/vips_derivative_service.rb index ca57b6f8d4..d208757e6d 100644 --- a/app/derivative_services/vips_derivative_service.rb +++ b/app/derivative_services/vips_derivative_service.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class VIPSDerivativeService +class VipsDerivativeService # Pixel width or height at which point it cuts the size in half for # performance. REDUCTION_THRESHOLD = 15_000 @@ -12,7 +12,7 @@ def initialize(change_set_persister:) end def new(id:) - VIPSDerivativeService.new(id: id, change_set_persister: change_set_persister) + VipsDerivativeService.new(id: id, change_set_persister: change_set_persister) end end @@ -110,7 +110,7 @@ def image_from_file(filename) image = begin Vips::Image.new_from_file(filename.to_s) - # If we fail to load a file via VIPS for some reason, load it into vips + # If we fail to load a file via Vips for some reason, load it into vips # via imagemagick. This will be slower, but fixes images with sub-byte # byte values. See https://github.com/libvips/libvips/issues/3948 rescue Vips::Error diff --git a/app/jobs/generate_pyramidal_tiff_job.rb b/app/jobs/generate_pyramidal_tiff_job.rb index e65b9e4681..abb124cd4c 100644 --- a/app/jobs/generate_pyramidal_tiff_job.rb +++ b/app/jobs/generate_pyramidal_tiff_job.rb @@ -4,7 +4,7 @@ class GeneratePyramidalTiffJob < ApplicationJob def perform(file_set_id) change_set_persister = Valkyrie::Derivatives::DerivativeService.for(id: file_set_id).change_set_persister - vips_derivative_factory = VIPSDerivativeService::Factory.new(change_set_persister: change_set_persister.with(storage_adapter: Valkyrie::StorageAdapter.find(:pyramidal_derivatives))) + vips_derivative_factory = VipsDerivativeService::Factory.new(change_set_persister: change_set_persister.with(storage_adapter: Valkyrie::StorageAdapter.find(:pyramidal_derivatives))) vips_derivative_factory.new(id: file_set_id).cleanup_derivatives vips_derivative_factory.new(id: file_set_id).create_derivatives rescue Valkyrie::Persistence::ObjectNotFoundError diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index dc4349ee28..83a4c14177 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -24,7 +24,6 @@ inflect.acronym "CDL" inflect.acronym "IIIF" inflect.acronym "MARC" - inflect.acronym "VIPS" inflect.acronym "JP2" inflect.acronym "CSV" inflect.acronym "MODS" diff --git a/spec/derivative_services/vips_derivative_service_spec.rb b/spec/derivative_services/vips_derivative_service_spec.rb index a95fd5c4a9..1e47df9f50 100644 --- a/spec/derivative_services/vips_derivative_service_spec.rb +++ b/spec/derivative_services/vips_derivative_service_spec.rb @@ -2,12 +2,12 @@ require "rails_helper" require "valkyrie/derivatives/specs/shared_specs" -RSpec.describe VIPSDerivativeService do +RSpec.describe VipsDerivativeService do it_behaves_like "a Valkyrie::Derivatives::DerivativeService" let(:thumbnail) { ::PcdmUse::ThumbnailImage } let(:derivative_service) do - VIPSDerivativeService::Factory.new(change_set_persister: change_set_persister) + VipsDerivativeService::Factory.new(change_set_persister: change_set_persister) end let(:adapter) { Valkyrie::MetadataAdapter.find(:indexing_persister) } let(:storage_adapter) { Valkyrie.config.storage_adapter } @@ -154,7 +154,7 @@ context "tiff source larger than reduction threshold", run_real_derivatives: true do it "resizes it by half" do - stub_const("VIPSDerivativeService::REDUCTION_THRESHOLD", 1) + stub_const("VipsDerivativeService::REDUCTION_THRESHOLD", 1) derivative_service.new(id: valid_change_set.id).create_derivatives reloaded = query_service.find_by(id: valid_resource.id) @@ -166,7 +166,7 @@ end it "uploads it with the appropriate metadata" do allow(storage_adapter).to receive(:upload).and_call_original - stub_const("VIPSDerivativeService::REDUCTION_THRESHOLD", 1) + stub_const("VipsDerivativeService::REDUCTION_THRESHOLD", 1) derivative_service.new(id: valid_change_set.id).create_derivatives expect(storage_adapter).to have_received(:upload).with(file: anything, resource: anything, original_filename: anything, metadata: { "height" => "144", "width" => "100" })