public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-ruby/contracts/, dev-ruby/contracts/files/
@ 2023-03-25  7:12 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-03-25  7:12 UTC (permalink / raw
  To: gentoo-commits

commit:     4f43c5a9bc8382632708cee6ba838f21e9ca625d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 25 06:51:54 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 25 07:11:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f43c5a9

dev-ruby/contracts: EAPI 8, enable ruby32

This needs a minor patch for ruby32 but it's merged upstream &
the patch only actually touches tests/examples.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-ruby/contracts/contracts-0.17-r1.ebuild        |  31 ++++++
 .../contracts/files/contracts-0.17-ruby32.patch    | 120 +++++++++++++++++++++
 2 files changed, 151 insertions(+)

diff --git a/dev-ruby/contracts/contracts-0.17-r1.ebuild b/dev-ruby/contracts/contracts-0.17-r1.ebuild
new file mode 100644
index 000000000000..6232037c76e4
--- /dev/null
+++ b/dev-ruby/contracts/contracts-0.17-r1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby30 ruby31 ruby32"
+
+RUBY_FAKEGEM_RECIPE_TEST="rspec3"
+
+RUBY_FAKEGEM_EXTRADOC="CHANGELOG.markdown README.md TODO.markdown TUTORIAL.md"
+
+inherit ruby-fakegem
+
+DESCRIPTION="provides contracts for Ruby"
+HOMEPAGE="https://github.com/egonSchiele/contracts.ruby"
+
+LICENSE="MIT"
+SLOT="$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-ruby32.patch
+)
+
+each_ruby_test() {
+	# COLUMNS needed for:
+	# ./spec/contracts_spec.rb:654 # Contracts: Contracts to_s formatting in expected should wrap and pretty print for long return contracts
+	# ./spec/contracts_spec.rb:643 # Contracts: Contracts to_s formatting in expected should wrap and pretty print for long param contracts
+	local -x COLUMNS=80
+	each_fakegem_test
+}

diff --git a/dev-ruby/contracts/files/contracts-0.17-ruby32.patch b/dev-ruby/contracts/files/contracts-0.17-ruby32.patch
new file mode 100644
index 000000000000..0f28e763ddac
--- /dev/null
+++ b/dev-ruby/contracts/files/contracts-0.17-ruby32.patch
@@ -0,0 +1,120 @@
+https://github.com/egonSchiele/contracts.ruby/issues/300
+https://github.com/egonSchiele/contracts.ruby/commit/88fd1d841615e59c873d7da64d050d3a251634dd
+
+From 88fd1d841615e59c873d7da64d050d3a251634dd Mon Sep 17 00:00:00 2001
+From: PikachuEXE <pikachuexe@gmail.com>
+Date: Wed, 5 Oct 2022 10:27:41 +0800
+Subject: [PATCH] * Update all references to Fixnum to Integer
+
+Deprecated in ruby 2.4
+--- a/lib/contracts/builtin_contracts.rb
++++ b/lib/contracts/builtin_contracts.rb
+@@ -95,7 +95,7 @@ def self.[](*vals)
+ 
+     # Takes a variable number of contracts.
+     # The contract passes if any of the contracts pass.
+-    # Example: <tt>Or[Fixnum, Float]</tt>
++    # Example: <tt>Or[Integer, Float]</tt>
+     class Or < CallableClass
+       def initialize(*vals)
+         super()
+@@ -120,7 +120,7 @@ def to_s
+ 
+     # Takes a variable number of contracts.
+     # The contract passes if exactly one of those contracts pass.
+-    # Example: <tt>Xor[Fixnum, Float]</tt>
++    # Example: <tt>Xor[Integer, Float]</tt>
+     class Xor < CallableClass
+       def initialize(*vals)
+         super()
+@@ -146,7 +146,7 @@ def to_s
+ 
+     # Takes a variable number of contracts.
+     # The contract passes if all contracts pass.
+-    # Example: <tt>And[Fixnum, Float]</tt>
++    # Example: <tt>And[Integer, Float]</tt>
+     class And < CallableClass
+       def initialize(*vals)
+         super()
+--- a/spec/builtin_contracts_spec.rb
++++ b/spec/builtin_contracts_spec.rb
+@@ -30,7 +30,7 @@ def passes(&some)
+   end
+ 
+   describe "Num:" do
+-    it "should pass for Fixnums" do
++    it "should pass for Integers" do
+       passes { @o.double(2) }
+     end
+ 
+--- a/spec/fixtures/fixtures.rb
++++ b/spec/fixtures/fixtures.rb
+@@ -100,11 +100,11 @@ def sum_three(vals)
+     end
+   end
+ 
+-  Contract ({ :name => String, :age => Fixnum }) => nil
++  Contract ({ :name => String, :age => Integer }) => nil
+   def person(data)
+   end
+ 
+-  Contract C::StrictHash[{ :name => String, :age => Fixnum }] => nil
++  Contract C::StrictHash[{ :name => String, :age => Integer }] => nil
+   def strict_person(data)
+   end
+ 
+@@ -119,7 +119,7 @@ def hash_complex_contracts(data)
+   def nested_hash_complex_contracts(data)
+   end
+ 
+-  Contract C::KeywordArgs[:name => String, :age => Fixnum] => nil
++  Contract C::KeywordArgs[:name => String, :age => Integer] => nil
+   def person_keywordargs(name: "name", age: 10)
+   end
+ 
+@@ -529,30 +529,30 @@ def initialize(day, month)
+     @month = month
+   end
+ 
+-  Contract C::None => Fixnum
++  Contract C::None => Integer
+   def silly_next_day!
+     self.day += 1
+   end
+ 
+-  Contract C::None => Fixnum
++  Contract C::None => Integer
+   def silly_next_month!
+     self.month += 1
+   end
+ 
+-  Contract C::None => Fixnum
++  Contract C::None => Integer
+   def clever_next_day!
+     return clever_next_month! if day == 31
+     self.day += 1
+   end
+ 
+-  Contract C::None => Fixnum
++  Contract C::None => Integer
+   def clever_next_month!
+     return next_year! if month == 12
+     self.month += 1
+     self.day = 1
+   end
+ 
+-  Contract C::None => Fixnum
++  Contract C::None => Integer
+   def next_year!
+     self.month = 1
+     self.day = 1
+@@ -610,7 +610,7 @@ def on_response(status, body)
+       body + "!"
+     end
+ 
+-    Contract Fixnum, String => String
++    Contract Integer, String => String
+     def on_response(status, body)
+       "error #{status}: #{body}"
+     end
+


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-25  7:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-25  7:12 [gentoo-commits] repo/gentoo:master commit in: dev-ruby/contracts/, dev-ruby/contracts/files/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox