From 1845e3a5738d475c5e51c21e18913f96c4d1cfb6 Mon Sep 17 00:00:00 2001 From: Jon Bracy Date: Tue, 21 Nov 2023 15:19:49 -0600 Subject: [PATCH] Output MuTool Version info --- .github/workflows/ci.yml | 9 ++++--- lib/bob_ross/backends/imagemagick.rb | 4 ++++ lib/bob_ross/backends/libvips.rb | 4 ++++ test/bob_ross/server_test.rb | 11 ++++++++- test/test_helper.rb | 36 +++++++++++++++++++--------- 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0329ad..e7bf438 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,9 @@ jobs: strategy: matrix: vips-version: - - 8.14.5 + - 8.15.0 im-version: - - 7.1.1-17 + - 7.1.1-21 ruby-version: - 3.0.5 backend: @@ -116,8 +116,11 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: | + - env: + VIPS_WARNING: 1 + run: | vips --version identify --version ffmpeg -version + mutool -v bundle exec rake test:${{ matrix.backend }} \ No newline at end of file diff --git a/lib/bob_ross/backends/imagemagick.rb b/lib/bob_ross/backends/imagemagick.rb index 2796f13..4a9e797 100644 --- a/lib/bob_ross/backends/imagemagick.rb +++ b/lib/bob_ross/backends/imagemagick.rb @@ -3,6 +3,10 @@ module BobRoss::ImageMagickBackend class <= 1.19.0' => { + im: { + '>= 7.1.1-21' => '7d5daa0941b10cb47277e954a77413b2' + }, + vips: { + '>= 8.15.0' => '2f4645b128d93f5d9304b79baabb9fdd' + } + } + }, mupdf_version))), Digest::MD5.hexdigest(response.body) response = server.get("/S100/floorplan") assert_equal 'image/jpeg', response.headers['Content-Type'] diff --git a/test/test_helper.rb b/test/test_helper.rb index 570310e..d899632 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -51,7 +51,14 @@ def self.test(name, requires: nil, &block) end end end - + + def mupdf_version + return @version if @version + version_cmd = Terrapin::CommandLine.new("mutool", '-v') + version_cmd.run + @version = version_cmd.output.error_output.match(/version\s+(\S+)/)[1] + end + def wait_until while !yield sleep 0.1 @@ -83,19 +90,26 @@ def assert_geometry(geom, image) assert_equal geom, "#{image.width}x#{image.height}" end + def backend + BobRoss.backend.key + end + + def key_for_backend(hash, backend=nil) + hash[backend || BobRoss.backend.key] + end + + def key_for_version(hash, version=nil) + version ||= BobRoss.backend.version + + hash.find do |k,v| + Gem::Dependency.new('a', k).match?('a', version.gsub('-', '.')) + end&.[](1) + end + # exp is the signature or [IM sig, libvips sig] def assert_signature(expected, image) if expected.is_a?(Hash) - case BobRoss.backend.name - when 'BobRoss::ImageMagickBackend' - expected = expected[:im].find do |k,v| - Gem::Dependency.new('a', k).match?('a', BobRoss.backend.version.gsub('-', '.')) - end&.[](1) - when 'BobRoss::LibVipsBackend' - expected = expected[:vips].find do |k,v| - Gem::Dependency.new('a', k).match?('a', BobRoss.backend.version.gsub('-', '.')) - end&.[](1) - end + expected = key_for_version(key_for_backend(expected)) end signature = `identify -verbose '#{image.path}'`.match(/signature: (\w+)/)[1]