diff options
author | Sam James <sam@gentoo.org> | 2023-04-03 03:35:10 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-04-03 04:02:58 +0100 |
commit | 873608c1ca25d045b7068ab2a25063d920be3001 (patch) | |
tree | f6a35ac872646aaa8979c0815d0a674217becaee /dev-ruby/rack-cache | |
parent | dev-ruby/rack-cache: update upstream metadata (diff) | |
download | gentoo-873608c1ca25d045b7068ab2a25063d920be3001.tar.gz gentoo-873608c1ca25d045b7068ab2a25063d920be3001.tar.bz2 gentoo-873608c1ca25d045b7068ab2a25063d920be3001.zip |
dev-ruby/rack-cache: enable ruby32, fix tests, use modern mocha
- Enable ruby32
- Fix test failure which shows up for some folks (missing timeout require)
- Update mocha dep & patch mocha require accordingly (upstream patch)
Closes: https://bugs.gentoo.org/723920
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-ruby/rack-cache')
3 files changed, 99 insertions, 0 deletions
diff --git a/dev-ruby/rack-cache/files/rack-cache-1.13.0-mocha2.patch b/dev-ruby/rack-cache/files/rack-cache-1.13.0-mocha2.patch new file mode 100644 index 000000000000..62bd028eedf7 --- /dev/null +++ b/dev-ruby/rack-cache/files/rack-cache-1.13.0-mocha2.patch @@ -0,0 +1,20 @@ +https://github.com/rack/rack-cache/commit/8b22b6e532ed21ba30fdfbc62907f58db052e767 + +From 8b22b6e532ed21ba30fdfbc62907f58db052e767 Mon Sep 17 00:00:00 2001 +From: Peter Goldstein <peter.m.goldstein@gmail.com> +Date: Mon, 2 Jan 2023 06:32:20 -0500 +Subject: [PATCH] Adds Ruby 3.2 to the CI matrix (#12) + +* Update mocha require for modern version of mocha +--- a/test/test_helper.rb ++++ b/test/test_helper.rb +@@ -7,7 +7,7 @@ + + require 'maxitest/global_must' + require 'maxitest/autorun' +-require 'mocha/setup' ++require 'mocha/minitest' + + # Set the MEMCACHED environment variable as follows to enable testing + # of the MemCached meta and entity stores. + diff --git a/dev-ruby/rack-cache/files/rack-cache-1.13.0-test-require.patch b/dev-ruby/rack-cache/files/rack-cache-1.13.0-test-require.patch new file mode 100644 index 000000000000..3d7d04deaa25 --- /dev/null +++ b/dev-ruby/rack-cache/files/rack-cache-1.13.0-test-require.patch @@ -0,0 +1,28 @@ +https://github.com/rack/rack-cache/pull/14 + +From db34e2b5ab7b16051f7158b2896e56502992c33e Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Mon, 3 Apr 2023 03:31:31 +0100 +Subject: [PATCH] test: Add explicit 'timeout' require + +Fixes the following when running tests individually: +``` + 1) Error: +Rack::Cache::Context#test_0078_passes if there was a metastore exception: +NameError: uninitialized constant Timeout + test/context_test.rb:981:in `block (3 levels) in <top (required)>' + test/test_helper.rb:170:in `request' + test/test_helper.rb:177:in `get' + test/context_test.rb:980:in `block (2 levels) in <top (required)>' +``` + +Signed-off-by: Sam James <sam@gentoo.org> +--- a/test/context_test.rb ++++ b/test/context_test.rb +@@ -1,4 +1,5 @@ + require_relative 'test_helper' ++require 'timeout' + require 'rack/cache/context' + + describe Rack::Cache::Context do + diff --git a/dev-ruby/rack-cache/rack-cache-1.13.0-r1.ebuild b/dev-ruby/rack-cache/rack-cache-1.13.0-r1.ebuild new file mode 100644 index 000000000000..a816afabdb35 --- /dev/null +++ b/dev-ruby/rack-cache/rack-cache-1.13.0-r1.ebuild @@ -0,0 +1,51 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30 ruby31 ruby32" + +# no documentation is generable, it needs hanna, which is broken +RUBY_FAKEGEM_RECIPE_DOC="none" + +RUBY_FAKEGEM_TASK_TEST="none" + +RUBY_FAKEGEM_EXTRADOC="CHANGES README.md doc/*" + +RUBY_FAKEGEM_GEMSPEC="rack-cache.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="Enable HTTP caching for Rack-based applications that produce freshness info" +HOMEPAGE="https://github.com/rtomayko/rack-cache" +SRC_URI="https://github.com/rtomayko/rack-cache/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="1.2" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +ruby_add_rdepend "dev-ruby/rack:*" + +ruby_add_bdepend "test? ( + >=dev-ruby/maxitest-3.4.0 + >=dev-ruby/minitest-5.7.0:5 + >=dev-ruby/mocha-2 )" + +PATCHES=( + "${FILESDIR}"/${PN}-1.13.0-test-require.patch + "${FILESDIR}"/${PN}-1.13.0-mocha2.patch +) + +all_ruby_prepare() { + sed -i -e '/bundler/ s:^:#:' \ + test/test_helper.rb || die +} + +all_ruby_prepare() { + sed -i -e 's/git ls-files/find/' ${RUBY_FAKEGEM_GEMSPEC} || die + sed -i -e '/bundler/ s:^:#:' test/test_helper.rb || die +} + +each_ruby_test() { + ${RUBY} -I.:lib:test -e 'Dir["test/*_test.rb"].each{|f| require f}' || die +} |