summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <graaff@gentoo.org>2024-01-10 08:44:03 +0100
committerHans de Graaff <graaff@gentoo.org>2024-01-10 08:44:03 +0100
commit31a04b1f6db9e839bb6240d2878829292cdc790a (patch)
tree197ca4ae5e74308c3f1d49b2758c7109e55d5c58
parentdev-ruby/sshkit: add 1.22.0 (diff)
downloadgentoo-31a04b1f6db9e839bb6240d2878829292cdc790a.tar.gz
gentoo-31a04b1f6db9e839bb6240d2878829292cdc790a.tar.bz2
gentoo-31a04b1f6db9e839bb6240d2878829292cdc790a.zip
dev-ruby/shoulda-context: add ruby33, fix tests
Signed-off-by: Hans de Graaff <graaff@gentoo.org>
-rw-r--r--dev-ruby/shoulda-context/files/shoulda-context-2.0.0-file-exists.patch26
-rw-r--r--dev-ruby/shoulda-context/shoulda-context-2.0.0-r1.ebuild42
2 files changed, 68 insertions, 0 deletions
diff --git a/dev-ruby/shoulda-context/files/shoulda-context-2.0.0-file-exists.patch b/dev-ruby/shoulda-context/files/shoulda-context-2.0.0-file-exists.patch
new file mode 100644
index 000000000000..78f7dfc3f0b5
--- /dev/null
+++ b/dev-ruby/shoulda-context/files/shoulda-context-2.0.0-file-exists.patch
@@ -0,0 +1,26 @@
+From ee3aeb239ea69c9a855d64e8c1cfda87958c833d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
+Date: Thu, 22 Dec 2022 15:03:17 +0100
+Subject: [PATCH] Use File.exist?
+
+`File.exists?` was deprecated while ago and removed in Ruby 3.2.
+
+https://bugs.ruby-lang.org/issues/17391
+https://github.com/ruby/ruby/pull/5352
+---
+ exe/convert_to_should_syntax | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/exe/convert_to_should_syntax b/exe/convert_to_should_syntax
+index d1264d07..ebdda984 100755
+--- a/exe/convert_to_should_syntax
++++ b/exe/convert_to_should_syntax
+@@ -31,7 +31,7 @@ usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to
+
+ file = ARGV.shift
+ tmpfile = File.join(TMP, File.basename(file))
+-usage("File '#{file}' doesn't exist") unless File.exists?(file)
++usage("File '#{file}' doesn't exist") unless File.exist?(file)
+
+ FileUtils.cp(file, tmpfile)
+ contents = File.read(tmpfile)
diff --git a/dev-ruby/shoulda-context/shoulda-context-2.0.0-r1.ebuild b/dev-ruby/shoulda-context/shoulda-context-2.0.0-r1.ebuild
new file mode 100644
index 000000000000..61cc12eb8528
--- /dev/null
+++ b/dev-ruby/shoulda-context/shoulda-context-2.0.0-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby31 ruby32 ruby33"
+
+RUBY_FAKEGEM_EXTRADOC="CONTRIBUTING.md README.md"
+
+RUBY_FAKEGEM_EXTRAINSTALL="tasks"
+
+# Don't install the conversion script to avoid collisions with older
+# shoulda.
+RUBY_FAKEGEM_BINWRAP=""
+
+inherit ruby-fakegem
+
+DESCRIPTION="Context framework extracted from Shoulda"
+HOMEPAGE="https://github.com/thoughtbot/shoulda-context"
+
+LICENSE="MIT"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="doc test"
+
+PATCHES=( "${FILESDIR}/${P}-file-exists.patch" )
+
+ruby_add_bdepend "test? ( dev-ruby/test-unit:2
+ >=dev-ruby/mocha-1.0 )"
+
+all_ruby_prepare() {
+ sed -e '/\(current_bundle\|CurrentBundle\)/ s:^:#:' \
+ -e '/pry-byebug/ s:^:#:' \
+ -e '/warnings_logger/ s:^:#: ; /WarningsLogger/,/^)/ s:^:#:' \
+ -e '/rails_application_with_shoulda_context/ s:^:#:' \
+ -i test/test_helper.rb || die
+ rm -f test/shoulda/{railtie,rerun_snippet,test_framework_detection}_test.rb || die
+}
+
+each_ruby_test() {
+ ${RUBY} -Ilib:test:. -e 'Dir["test/shoulda/*_test.rb"].each { require _1 }' || die
+}