From 274299a7e1d5d5e1f918e072fe09f23de1816a58 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:35:14 -0400 Subject: [PATCH 1/8] shush older ruby warnings about uninitialized ivar @detect_host --- lib/mini_portile2/mini_portile.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index deb2c8c..d44ab77 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -554,6 +554,8 @@ def detect_host output = `#{gcc_cmd} -v 2>&1` if m = output.match(/^Target\: (.*)$/) @detect_host = m[1] + else + @detect_host = nil end @detect_host From 1de9d40099c15091830c093847e4a1943de577cc Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 17:59:44 -0400 Subject: [PATCH 2/8] test: shush the webrick server --- test/helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/helper.rb b/test/helper.rb index b549964..f0e3eef 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -9,6 +9,7 @@ require 'fileutils' require 'erb' require 'mini_portile2' +require 'logger' puts "#{__FILE__}:#{__LINE__}: relevant RbConfig::CONFIG values:" %w[target_os target_cpu CC CXX].each do |key| @@ -23,7 +24,12 @@ class TestCase < Minitest::Test attr_accessor :webrick def start_webrick(path) - @webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot => path).tap do |w| + @webrick = WEBrick::HTTPServer.new( + :Port => HTTP_PORT, + :DocumentRoot => path, + :Logger => Logger.new(File::NULL), + :AccessLog => [], + ).tap do |w| Thread.new do w.start end From 8f56cfd7f17a6a573c7e71fa8b17e40d1d5662d7 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 21:54:06 -0400 Subject: [PATCH 3/8] test: shush recipe building with a null logger --- lib/mini_portile2/mini_portile.rb | 4 ++-- test/test_cmake.rb | 5 +++++ test/test_cook.rb | 9 +++++++++ test/test_digest.rb | 3 ++- test/test_download.rb | 3 ++- test/test_execute.rb | 3 ++- test/test_proxy.rb | 13 +++++++------ 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index d44ab77..e5573e0 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -103,7 +103,7 @@ def initialize(name, version, **kwargs) @files = [] @patch_files = [] @log_files = {} - @logger = STDOUT + @logger = kwargs[:logger] || STDOUT @source_directory = nil @cc_command = kwargs[:cc_command] || kwargs[:gcc_command] @@ -705,7 +705,7 @@ def download_file_http(url, full_path, count = 3) return download_file(redirect.url, full_path, count-1) rescue => e count = count - 1 - puts "#{count} retrie(s) left for #{filename} (#{e.message})" + @logger.puts "#{count} retrie(s) left for #{filename} (#{e.message})" if count > 0 sleep 1 return download_file_http(url, full_path, count) diff --git a/test/test_cmake.rb b/test/test_cmake.rb index e180877..667ad34 100644 --- a/test/test_cmake.rb +++ b/test/test_cmake.rb @@ -14,12 +14,16 @@ def before_all create_tar(@tar_path, @assets_path, "test-cmake-1.0") start_webrick(File.dirname(@tar_path)) + @logger = StringIO.new # IO to keep recipe logs in case we need to debug @recipe = init_recipe git_dir = File.join(@assets_path, "git") with_custom_git_dir(git_dir) do recipe.cook end + rescue => e + puts @logger.string + raise e end def after_all @@ -58,6 +62,7 @@ def test_install def init_recipe MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe| + recipe.logger = @logger recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}" recipe.patch_files << File.join(@assets_path, "patch 1.diff") end diff --git a/test/test_cook.rb b/test/test_cook.rb index fd5d3b8..6a51c75 100644 --- a/test/test_cook.rb +++ b/test/test_cook.rb @@ -13,7 +13,9 @@ def before_all create_tar(@tar_path, @assets_path, "test mini portile-1.0.0") start_webrick(File.dirname(@tar_path)) + @logger = StringIO.new # IO to keep recipe logs in case we need to debug @recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe| + recipe.logger = @logger recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}" recipe.patch_files << File.join(@assets_path, "patch 1.diff") recipe.configure_options << "--option=\"path with 'space'\"" @@ -22,6 +24,9 @@ def before_all recipe.cook end end + rescue => e + puts @logger.string + raise e end def after_all @@ -136,7 +141,9 @@ def before_all create_tar(@tar_path, @assets_path, "test mini portile-1.0.0") + @logger = StringIO.new # IO to keep recipe logs in case we need to debug @recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe| + recipe.logger = @logger recipe.files << "file://#{@tar_path}" recipe.patch_files << File.join(@assets_path, "patch 1.diff") recipe.configure_options << "--option=\"path with 'space'\"" @@ -166,7 +173,9 @@ class TestCookAgainstSourceDirectory < TestCase def setup super + @logger = StringIO.new # IO to keep recipe logs in case we need to debug @recipe ||= MiniPortile.new("test mini portile", "1.0.0").tap do |recipe| + recipe.logger = @logger recipe.source_directory = File.expand_path("../assets/test mini portile-1.0.0", __FILE__) end end diff --git a/test/test_digest.rb b/test/test_digest.rb index c7c272e..32124fc 100644 --- a/test/test_digest.rb +++ b/test/test_digest.rb @@ -24,7 +24,8 @@ def after_all def setup super FileUtils.rm_rf("ports/archives") - @recipe = MiniPortile.new("test-digest", "1.0.0") + @logger = StringIO.new # IO to keep recipe logs in case we need to debug + @recipe = MiniPortile.new("test-digest", "1.0.0", logger: @logger) end def download_with_digest(key, klass) diff --git a/test/test_download.rb b/test/test_download.rb index cf3e47d..2bca430 100644 --- a/test/test_download.rb +++ b/test/test_download.rb @@ -30,7 +30,8 @@ def server_must_receive_connection(connections = 3, &block) before do @request_count = 0 - @recipe = MiniPortile.new("test-download", "1.1.1") + @logger = StringIO.new + @recipe = MiniPortile.new("test-download", "1.1.1", logger: @logger) end describe "urls" do diff --git a/test/test_execute.rb b/test/test_execute.rb index 1564d53..225ab1d 100644 --- a/test/test_execute.rb +++ b/test/test_execute.rb @@ -4,7 +4,8 @@ class TestExecute < TestCase def setup super @env = {"TEST_ENV_VAR1" => "VAR1_VALUE", "TEST_ENV_VAR2" => "VAR2_VALUE"} - @recipe = MiniPortile.new("test_execute", "1.0.0") + @logger = StringIO.new + @recipe = MiniPortile.new("test_execute", "1.0.0", logger: @logger) @log_path = @recipe.send(:tmp_path) FileUtils.mkdir_p File.join(@log_path, "subdir") # normally created by `download` end diff --git a/test/test_proxy.rb b/test/test_proxy.rb index 3bb4739..3448da7 100644 --- a/test/test_proxy.rb +++ b/test/test_proxy.rb @@ -37,6 +37,7 @@ def with_dummy_proxy(username=nil, password=nil) def setup # remove any download files FileUtils.rm_rf("port/archives") + @logger = StringIO.new end def assert_proxy_auth(expected, request) @@ -48,7 +49,7 @@ def assert_proxy_auth(expected, request) end def test_http_proxy - recipe = MiniPortile.new("test http_proxy", "1.0.0") + recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger) recipe.files << "http://myserver/path/to/tar.gz" request = with_dummy_proxy do |url, thread| ENV['http_proxy'] = url @@ -59,7 +60,7 @@ def test_http_proxy end def test_http_proxy_with_basic_auth - recipe = MiniPortile.new("test http_proxy", "1.0.0") + recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger) recipe.files << "http://myserver/path/to/tar.gz" request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread| ENV['http_proxy'] = url @@ -72,7 +73,7 @@ def test_http_proxy_with_basic_auth end def test_https_proxy - recipe = MiniPortile.new("test https_proxy", "1.0.0") + recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger) recipe.files << "https://myserver/path/to/tar.gz" request = with_dummy_proxy do |url, thread| ENV['https_proxy'] = url @@ -83,7 +84,7 @@ def test_https_proxy end def test_https_proxy_with_basic_auth - recipe = MiniPortile.new("test https_proxy", "1.0.0") + recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger) recipe.files << "https://myserver/path/to/tar.gz" request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread| ENV['https_proxy'] = url @@ -96,7 +97,7 @@ def test_https_proxy_with_basic_auth end def test_ftp_proxy - recipe = MiniPortile.new("test ftp_proxy", "1.0.0") + recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger) recipe.files << "ftp://myserver/path/to/tar.gz" request = with_dummy_proxy do |url, thread| ENV['ftp_proxy'] = url @@ -107,7 +108,7 @@ def test_ftp_proxy end def test_ftp_proxy_with_basic_auth - recipe = MiniPortile.new("test ftp_proxy", "1.0.0") + recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger) recipe.files << "ftp://myserver/path/to/tar.gz" request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread| ENV['ftp_proxy'] = url From 6e19ea13e93ccd085c2be72a9694d3ebbb0cdc77 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:01:49 -0400 Subject: [PATCH 4/8] test: shush minitest deprecation warnings --- test/test_download.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_download.rb b/test/test_download.rb index 2bca430..69113c8 100644 --- a/test/test_download.rb +++ b/test/test_download.rb @@ -25,7 +25,7 @@ def server_must_receive_connection(connections = 3, &block) server.close end - request_count.must_be :>, 0 + assert_operator(request_count, :>, 0) end before do @@ -63,12 +63,12 @@ def server_must_receive_connection(connections = 3, &block) @recipe.files << "file://#{path}" @recipe.download assert File.exist?(dest) - Digest::MD5.file(dest).hexdigest.must_equal "ee0e9f44e72213015ef976d5ac23931d" + assert_equal("ee0e9f44e72213015ef976d5ac23931d", Digest::MD5.file(dest).hexdigest) end it "other" do @recipe.files << "foo://foo" - proc { @recipe.download }.must_raise ArgumentError + assert_raises(ArgumentError) { @recipe.download } end end end From 9919cf115ecc4a515b958f37fc4af410239d7810 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:02:10 -0400 Subject: [PATCH 5/8] test: shush debug messages accidentally left on --- test/test_digest.rb | 1 - test/test_execute.rb | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test_digest.rb b/test/test_digest.rb index 32124fc..b70b0df 100644 --- a/test/test_digest.rb +++ b/test/test_digest.rb @@ -149,7 +149,6 @@ def test_with_invalid_key end def test_with_different_key_than_one_used_to_sign - puts "################" key = <<-KEY -----BEGIN PGP PUBLIC KEY BLOCK----- diff --git a/test/test_execute.rb b/test/test_execute.rb index 225ab1d..c53daa2 100644 --- a/test/test_execute.rb +++ b/test/test_execute.rb @@ -15,7 +15,7 @@ class << @recipe def execute_with_env(env) execute("testenv1", %Q(ruby -e "puts ENV['TEST_ENV_VAR1'].inspect ; exit 0"), - {:env => env, :initial_message => false, :debug => true}) + {:env => env, :initial_message => false}) end end @@ -29,7 +29,7 @@ class << @recipe def execute_with_env(env) execute("testenv2", ["ruby", "-e", "puts ENV['TEST_ENV_VAR2'].inspect"], - {:env => env, :initial_message => false, :debug => true}) + {:env => env, :initial_message => false}) end end From 3d68f33df784294bf46c6b3d767e76ddffd8e70c Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:11:23 -0400 Subject: [PATCH 6/8] feat: gpg verification error messages are captured in the exception previously these error messages went to stderr --- CHANGELOG.md | 3 ++- lib/mini_portile2/mini_portile.rb | 32 ++++++++++++++++++------------- test/test_digest.rb | 7 +++---- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd05487..c0f0e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ #### Added -- When setting the C compiler through the `MiniPortile` constructor, the preferred keyword argument is now `:cc_command`. The original `:gcc_command` is still supported. +- When setting the C compiler through the `MiniPortile` constructor, the preferred keyword argument is now `:cc_command`. The original `:gcc_command` is still supported. @flavorjones +- GPG file verification error messages are captured in the raised exception. Previously these errors went to `stderr`. @flavorjones ### 2.8.6 / 2024-04-14 diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index e5573e0..662a4e4 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -8,6 +8,7 @@ require 'cgi' require 'rbconfig' require 'shellwords' +require 'open3' # Monkey patch for Net::HTTP by ruby open-uri fix: # https://github.com/ruby/ruby/commit/58835a9 @@ -463,24 +464,29 @@ def verify_file(file) gpg_exe = which('gpg2') || which('gpg') || raise("Neither GPG nor GPG2 is installed") # import the key into our own keyring - gpg_status = IO.popen([gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--import"], "w+") do |io| - io.write gpg[:key] - io.close_write - io.read + gpg_error = nil + gpg_status = Open3.popen3(gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--import") do |gpg_in, gpg_out, gpg_err, _thread| + gpg_in.write gpg[:key] + gpg_in.close + gpg_error = gpg_err.read + gpg_out.read end key_ids = gpg_status.scan(/\[GNUPG:\] IMPORT_OK \d+ (?[0-9a-f]+)/i).map(&:first) - raise "invalid gpg key provided" if key_ids.empty? + raise "invalid gpg key provided:\n#{gpg_error}" if key_ids.empty? - # verify the signature against our keyring - gpg_status = IO.popen([gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--verify", signature_file, file[:local_path]], &:read) - - # remove the key from our keyring - key_ids.each do |key_id| - IO.popen([gpg_exe, "--batch", "--yes", "--no-default-keyring", "--keyring", KEYRING_NAME, "--delete-keys", key_id], &:read) - raise "unable to delete the imported key" unless $?.exitstatus==0 + begin + # verify the signature against our keyring + gpg_status, gpg_error, _status = Open3.capture3(gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--verify", signature_file, file[:local_path]) + + raise "signature mismatch:\n#{gpg_error}" unless gpg_status.match(/^\[GNUPG:\] VALIDSIG/) + ensure + # remove the key from our keyring + key_ids.each do |key_id| + IO.popen([gpg_exe, "--batch", "--yes", "--no-default-keyring", "--keyring", KEYRING_NAME, "--delete-keys", key_id], &:read) + raise "unable to delete the imported key" unless $?.exitstatus==0 + end end - raise "signature mismatch" unless gpg_status.match(/^\[GNUPG:\] VALIDSIG/) else digest = case diff --git a/test/test_digest.rb b/test/test_digest.rb index b70b0df..87c873a 100644 --- a/test/test_digest.rb +++ b/test/test_digest.rb @@ -131,7 +131,7 @@ def test_with_invalid_gpg_signature exception = assert_raises(RuntimeError){ @recipe.download } - assert_equal("signature mismatch", exception.message) + assert_includes(exception.message, "signature mismatch") end def test_with_invalid_key @@ -145,7 +145,7 @@ def test_with_invalid_key } } exception = assert_raises(RuntimeError){ @recipe.download } - assert_equal("invalid gpg key provided", exception.message) + assert_includes(exception.message, "invalid gpg key provided") end def test_with_different_key_than_one_used_to_sign @@ -209,7 +209,6 @@ def test_with_different_key_than_one_used_to_sign } } exception = assert_raises(RuntimeError){ @recipe.download } - assert_equal("signature mismatch", exception.message) + assert_includes(exception.message, "signature mismatch") end end - From f1fcc7b82124da5334dcb5269c81fc4fa8caa50a Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:15:26 -0400 Subject: [PATCH 7/8] test(style): indent test keys with <<~ --- test/test_digest.rb | 141 ++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 71 deletions(-) diff --git a/test/test_digest.rb b/test/test_digest.rb index 87c873a..548d895 100644 --- a/test/test_digest.rb +++ b/test/test_digest.rb @@ -69,28 +69,28 @@ def test_wrong_md5 end def public_key - <<-KEY ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mI0EVwUhJQEEAMYxFhgaAdM2Ul5r+XfpqAaI7SOxB14eRjhFjhchy4ylgVxetyLq -di3zeANXBIHsLBl7quYTlnmhJr/+GQRkCnXWiUp0tJsBVzGM3puK7c534gakEUH6 -AlDtj5p3IeygzSyn8u7KORv+ainXfhwkvTO04mJmxAb2uT8ngKYFdPa1ABEBAAG0 -J1Rlc3QgTWluaXBvcnRp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YVCAIJCgsEFgIDAQIeAQIXgAAKCRBl6D5JZMNwswAK + A/90Cdb+PX21weBR2Q6uR06M/alPexuXXyJL8ZcwbQMJ/pBBgcS5/h1+rQkBI/CN + qpXdDlw2Xys2k0sNwdjIw3hmYRzBrddXlCSW3Sifq/hS+kfPZ1snQmIjCgy1Xky5 + QGCcPUxBUxzmra88LakkDO+euKK3hcrfeFIi611lTum1NLiNBFcFISUBBADoyY6z + 2PwH3RWUbqv0VX1s3/JO3v3xMjCRKPlFwsNwLTBtZoWfR6Ao1ajeCuZKfzNKIQ2I + rn86Rcqyrq4hTj+7BTWjkIPOBthjiL1YqbEBtX7jcYRkYvdQz/IG2F4zVV6X4AAR + Twx7qaXNt67ArzbHCe5gLNRUK6e6OArkahMv7QARAQABiJ8EGAECAAkFAlcFISUC + GwwACgkQZeg+SWTDcLNFiwP/TR33ClqWOz0mpjt0xPEoZ0ORmV6fo4sjjzgQoHH/ + KTdsabJbGp8oLQGW/mx3OxgbsAkyZymb5H5cjaF4HtSd4cxI5t1C9ZS/ytN8pqfR + e29SBje8DAAJn2l57s2OddXLPQ0DUwCcdNEaqgHwSk/Swxc7K+IpfvjLKHKUZZBP + 4Ko= + =SVWi + -----END PGP PUBLIC KEY BLOCK----- + KEY end def test_with_valid_gpg_signature @@ -149,55 +149,54 @@ def test_with_invalid_key end def test_with_different_key_than_one_used_to_sign - - key = <<-KEY ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR -0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf -hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1Qj/OA/WmLLc -m6BMTqI7IBlYW2vyIOIHasISGiAwZfp0ucMeXXvTtt14LGa8qXVcFnJTdwbf03AS -ljhYrQnKnpl3Vp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qWbwqXhkVs0nkWxnOIidTHSXvBZfDFA4Idwte94Thrzf8Pn8UESud -TiqrWoCBXk2UyVsl03gJblSJAeJGYPPeo+Yj6m63OWe2+/S2VTgmbPS/RObn0Aeg -7yuff0n5+ytEt2KL51gOQE2uIxTCawHr12PsllPkbqPk/PagIttfEJqn9b0CrqPC -3HREePb2aMJ/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw= -=4JAR ------END PGP PUBLIC KEY BLOCK----- -KEY + key = <<~KEY + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: GnuPG v1 + + mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR + 0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf + hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1Qj/OA/WmLLc + m6BMTqI7IBlYW2vyIOIHasISGiAwZfp0ucMeXXvTtt14LGa8qXVcFnJTdwbf03AS + ljhYrQnKnpl3VpDAoQt8C68YCwjaNJW59hKqWB+XeIJ9CW98+EOAxLAFszSyGanp + rCqPd0numj9TIddjcRkTA/ZbmCWK+xjpVBGXABEBAAG0IU1heGltIERvdW5pbiA8 + bWRvdW5pbkBtZG91bmluLnJ1PohGBBARAgAGBQJO01Y/AAoJEOzw6QssFyCDVyQA + n3qwTZlcZgyyzWu9Cs8gJ0CXREaSAJ92QjGLT9DijTcbB+q9OS/nl16Z/IhGBBAR + AgAGBQJO02JDAAoJEKk3YTmlJMU+P64AnjCKEXFelSVMtgefJk3+vpyt3QX1AKCH + 9M3MbTWPeDUL+MpULlfdyfvjj4heBBARCAAGBQJRCTwgAAoJEFGFCWhsfl6CzF0B + AJsQ3DJbtGcZ+0VIcM2a06RRQfBvIHqm1A/1WSYmObLGAP90lxWlNjSugvUUlqTk + YEEgRTGozgixSyMWGJrNwqgMYok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mSe8uoRf + 6nYd/TPvXV2Zw0YhjvBzlIfkl5MlJ+j4AZy1hn7Mqe1O//bRd0KKLjjhMQ6tjR6Y + sbUJgKqfgA+W9qxUcLkBDQRO0irvAQgA0LjCc8S6oZzjiap2MjRNhRFA5BYjXZRZ + BdKF2VP74avt2/RELq8GW0n7JWmKn6vvrXabEGLyfkCngAhTq9tJ/K7LPx/bmlO5 + +jboO/1inH2BTtLiHjAXvicXZk3oaZt2Sotx5mMI3yzpFQRVqZXsi0LpUTPJEh3o + S8IdYRjslQh1A7P5hfCZwtzwb/hKm8upODe/ITUMuXeWfLuQj/uEU6wMzmfMHb+j + lYMWtb+v98aJa2FODeKPmWCXLa7bliXp1SSeBOEfIgEAmjM6QGlDx5sZhr2Ss2xS + PRdZ8DqD7oiRVzmstX1YoxEzC0yXfaefC7SgM0nMnaTvYEOYJ9CH3wARAQABiQEf + BBgBAgAJBQJO0irvAhsMAAoJEFIKmZOhwFL4844H/jo8icCcS6eOWvnen7lg0FcC + o1fIm4wW3tEmkQdchSHECJDq7pgTloN65pwB5tBoT47cyYNZA9eTfJVgRc74q5ce + xKOYrMC3KuAqWbwqXhkVs0nkWxnOIidTHSXvBZfDFA4Idwte94Thrzf8Pn8UESud + TiqrWoCBXk2UyVsl03gJblSJAeJGYPPeo+Yj6m63OWe2+/S2VTgmbPS/RObn0Aeg + 7yuff0n5+ytEt2KL51gOQE2uIxTCawHr12PsllPkbqPk/PagIttfEJqn9b0CrqPC + 3HREePb2aMJ/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw= + =4JAR + -----END PGP PUBLIC KEY BLOCK----- + KEY data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data')) From 8d1bab99b4908cff1b2d02a45e81d5e023ca58ae Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 29 May 2024 22:30:31 -0400 Subject: [PATCH 8/8] test: use Rake::TestTask instead of a custom rake task I would have used Minitest::TestTask but we're still running CI on Ruby 2.3. --- Rakefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 87949ad..c1bd83c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,10 @@ require "rake/clean" require "bundler/gem_tasks" +require "rake/testtask" -namespace :test do - desc "Test MiniPortile by running unit tests" - task :unit do - sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map { |f| "require '#{f}';" }.join}\" -- #{ENV["TESTOPTS"]} -v" - end +Rake::TestTask.new("test:unit") +namespace :test do desc "Test MiniPortile by compiling examples" task :examples do Dir.chdir("examples") do