diff options
Diffstat (limited to 'dev-ruby')
| -rw-r--r-- | dev-ruby/crack/crack-0.4.4-r2.ebuild | 42 | ||||
| -rw-r--r-- | dev-ruby/crack/files/crack-0.4.4-psych4.patch | 30 | ||||
| -rw-r--r-- | dev-ruby/http/http-4.4.1-r1.ebuild | 52 | ||||
| -rw-r--r-- | dev-ruby/http_parser_rb/http_parser_rb-0.6.0-r2.ebuild | 11 | ||||
| -rw-r--r-- | dev-ruby/twitter/twitter-7.0.0-r2.ebuild | 58 | ||||
| -rw-r--r-- | dev-ruby/webmock/webmock-3.14.0-r1.ebuild | 67 |
6 files changed, 257 insertions, 3 deletions
diff --git a/dev-ruby/crack/crack-0.4.4-r2.ebuild b/dev-ruby/crack/crack-0.4.4-r2.ebuild new file mode 100644 index 000000000000..2610de8a296f --- /dev/null +++ b/dev-ruby/crack/crack-0.4.4-r2.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +USE_RUBY="ruby27 ruby30 ruby31" + +RUBY_FAKEGEM_EXTRADOC="README.md History" + +RUBY_FAKEGEM_GEMSPEC="crack.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="Really simple JSON and XML parsing, ripped from Merb and Rails" +HOMEPAGE="https://github.com/jnunemaker/crack" +SRC_URI="https://github.com/jnunemaker/crack/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +PATCHES=( "${FILESDIR}/${P}-psych4.patch" ) + +ruby_add_rdepend "dev-ruby/rexml" + +ruby_add_bdepend "test? ( dev-ruby/minitest )" + +all_ruby_prepare() { + sed -i -e 's/git ls-files --/find/' ${RUBY_FAKEGEM_GEMSPEC} || die +} + +each_ruby_prepare() { + # Remove tests which fail when run by portage but pass when run by hand + sed -i -e '/{"regex": \/foo.*\/}/d' test/json_test.rb || die + sed -i -e '/{"regex": \/foo.*\/i}/d' test/json_test.rb || die + sed -i -e '/{"regex": \/foo.*\/mix}/d' test/json_test.rb || die +} + +each_ruby_test() { + ${RUBY} -Itest -Ilib -e 'Dir["test/*_test.rb"].each { |f| load f }' || die +} diff --git a/dev-ruby/crack/files/crack-0.4.4-psych4.patch b/dev-ruby/crack/files/crack-0.4.4-psych4.patch new file mode 100644 index 000000000000..4c4e96661ba9 --- /dev/null +++ b/dev-ruby/crack/files/crack-0.4.4-psych4.patch @@ -0,0 +1,30 @@ +From 7fa8d8aea4a041969e433debef7f4d5d59881ae2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> +Date: Fri, 11 Mar 2022 18:29:43 +0100 +Subject: [PATCH] Use named parameters for `safe_load`. + +This is available since Psych 3.1 [[1], [2]], but mandatory since Psych +4.0 [[3]]. + +Fixes #72 + +[1]: https://github.com/ruby/psych/pull/358 +[2]: https://github.com/ruby/psych/pull/378 +[3]: https://github.com/ruby/psych/commit/0767227051dbddf1f949eef512c174deabf22891 +--- + lib/crack/json.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/crack/json.rb b/lib/crack/json.rb +index 1a27ac7..528aad6 100644 +--- a/lib/crack/json.rb ++++ b/lib/crack/json.rb +@@ -13,7 +13,7 @@ def self.parser_exceptions + + def self.parse(json) + yaml = unescape(convert_json_to_yaml(json)) +- YAML.safe_load(yaml, [Regexp, Date, Time]) ++ YAML.safe_load(yaml, permitted_classes: [Regexp, Date, Time]) + rescue *parser_exceptions + raise ParseError, "Invalid JSON string" + rescue Psych::DisallowedClass diff --git a/dev-ruby/http/http-4.4.1-r1.ebuild b/dev-ruby/http/http-4.4.1-r1.ebuild new file mode 100644 index 000000000000..6c81069704f9 --- /dev/null +++ b/dev-ruby/http/http-4.4.1-r1.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30 ruby31" + +RUBY_FAKEGEM_RECIPE_TEST="rspec3" + +RUBY_FAKEGEM_EXTRADOC="CHANGES.md README.md" + +inherit ruby-fakegem + +DESCRIPTION="An easy-to-use client library for making requests from Ruby" +HOMEPAGE="https://github.com/tarcieri/http" + +LICENSE="MIT" +SLOT="4" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" +IUSE="" + +ruby_add_rdepend " + >=dev-ruby/addressable-2.3:0 + >=dev-ruby/http-cookie-1.0:0 + >=dev-ruby/http-form_data-2.2:2 + =dev-ruby/http-parser-1.2*" + +ruby_add_bdepend " + test? ( dev-ruby/certificate_authority dev-ruby/rspec-its )" + +all_ruby_prepare() { + sed -i -e '/simplecov/,/end/ s:^:#:' \ + -e '1irequire "cgi"' spec/spec_helper.rb || die + + # Avoid specs that require network access + sed -i -e '/.persistent/,/^ end/ s:^:#:' \ + spec/lib/http_spec.rb || die + sed -i -e '/with non-ASCII URLs/,/^ end/ s:^:#:' \ + spec/lib/http/client_spec.rb || die + + # Avoid spec that may fail with a running web server + sed -i -e '/unifies socket errors into HTTP::ConnectionError/,/^ end/ s:^:#:' spec/lib/http_spec.rb || die + + # Fix spec for production release + sed -i -e '/User-Agent:/ s/.dev//' spec/lib/http/features/logging_spec.rb || die + + # Avoid specs also failing upstream due to some certificate issue + sed -i -e '/context "ssl"/,/^ end/ s:^:#:' spec/lib/http_spec.rb || die + sed -i -e '/describe "working with SSL"/,/^ end/ s:^:#:' spec/lib/http/client_spec.rb || die + + # Fix spec failing due to kwargs confusion on ruby30 + sed -i -e '196 s/:foo => "bar"/{:foo => "bar"}/' spec/lib/http/client_spec.rb || die +} diff --git a/dev-ruby/http_parser_rb/http_parser_rb-0.6.0-r2.ebuild b/dev-ruby/http_parser_rb/http_parser_rb-0.6.0-r2.ebuild index 26c7f9681990..c8083353aa1e 100644 --- a/dev-ruby/http_parser_rb/http_parser_rb-0.6.0-r2.ebuild +++ b/dev-ruby/http_parser_rb/http_parser_rb-0.6.0-r2.ebuild @@ -1,10 +1,10 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -USE_RUBY="ruby26 ruby27" +USE_RUBY="ruby26 ruby27 ruby30 ruby31" -RUBY_FAKEGEM_RECIPE_TEST="rspec" +RUBY_FAKEGEM_RECIPE_TEST="rspec3" RUBY_FAKEGEM_RECIPE_DOC="rdoc" RUBY_FAKEGEM_EXTRADOC="README.md" @@ -22,3 +22,8 @@ LICENSE="MIT" SLOT="0" KEYWORDS="amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc x86" IUSE="" + +all_ruby_prepare() { + # rspec 3 compatibility + sed -i -e 's/be_true/be true/; s/be_false/be false/' spec/parser_spec.rb || die +} diff --git a/dev-ruby/twitter/twitter-7.0.0-r2.ebuild b/dev-ruby/twitter/twitter-7.0.0-r2.ebuild new file mode 100644 index 000000000000..6f9c0eb2ee14 --- /dev/null +++ b/dev-ruby/twitter/twitter-7.0.0-r2.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30" + +RUBY_FAKEGEM_RECIPE_DOC="yard" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.md" + +RUBY_FAKEGEM_GEMSPEC="twitter.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="Ruby wrapper around the Twitter API" +HOMEPAGE="https://github.com/sferik/twitter/" +SRC_URI="https://github.com/sferik/twitter/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="$(ver_cut 1)" +KEYWORDS="~amd64" +IUSE="" + +ruby_add_rdepend " + >=dev-ruby/addressable-2.3 + =dev-ruby/buftok-0.2.0* + >=dev-ruby/equalizer-0.0.11 + =dev-ruby/equalizer-0.0* + dev-ruby/http:4 + dev-ruby/http-form_data:2 + >=dev-ruby/http_parser_rb-0.6.0 + >=dev-ruby/memoizable-0.4.2 + =dev-ruby/multipart-post-2* + >=dev-ruby/naught-1.1 + =dev-ruby/simple_oauth-0.3* +" + +ruby_add_bdepend "test? ( + dev-ruby/rspec:3 + dev-ruby/webmock:3 + >=dev-ruby/timecop-0.6.1 + ) + doc? ( dev-ruby/yard )" + +all_ruby_prepare() { +# rm Gemfile || die + sed -i -e '/[Bb]undler/d' Rakefile || die "Unable to remove bundler code." + + sed -i -e '/simplecov/,/^end/ s:^:#:' \ + -e '1igem "webmock", "~>3.0"' spec/helper.rb || die + + # Avoid a spec that fails due to changes in dependencies. + sed -i -e '/#reverse_token/,/^ end/ s:^:#:' \ + spec/twitter/rest/oauth_spec.rb +} + +each_ruby_test() { + CI=true RSPEC_VERSION=3 ruby-ng_rspec || die +} diff --git a/dev-ruby/webmock/webmock-3.14.0-r1.ebuild b/dev-ruby/webmock/webmock-3.14.0-r1.ebuild new file mode 100644 index 000000000000..d5b431fb5dd2 --- /dev/null +++ b/dev-ruby/webmock/webmock-3.14.0-r1.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +USE_RUBY="ruby27 ruby30" + +RUBY_FAKEGEM_TASK_TEST="test spec NO_CONNECTION=true" + +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.md" + +inherit ruby-fakegem + +DESCRIPTION="Allows stubbing HTTP requests and setting expectations on HTTP requests" +HOMEPAGE="https://github.com/bblimke/webmock" + +LICENSE="GPL-2" +SLOT="3" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" +IUSE="" + +ruby_add_rdepend " + >=dev-ruby/addressable-2.8.0 + >=dev-ruby/crack-0.3.2 + >=dev-ruby/hashdiff-0.4.0:0 +" + +ruby_add_bdepend "test? ( + dev-ruby/minitest:5 + dev-ruby/rspec:3 + >=dev-ruby/test-unit-3.0.0 + dev-ruby/rack +)" + +all_ruby_prepare() { + # Remove bundler support + rm Gemfile || die + sed -i -e '/[Bb]undler/d' Rakefile || die + sed -i -e '/simplecov/I s:^:#:' spec/spec_helper.rb || die + sed -i -e '1igem "test-unit"' test/test_helper.rb || die + + # There is now optional support for curb and typhoeus which we don't + # have in Gentoo yet. em_http_request is available in Gentoo but its + # version is too old. patron's latest version is not compatible. + # httpclient is no longer maintained and has various test failures. + sed -i -e '/\(curb\|typhoeus\|em-http\|patron\|httpclient\)/ s:^:#:' spec/spec_helper.rb || die + rm -f spec/acceptance/{typhoeus,curb,excon,em_http_request,patron,async_http_client,httpclient}/* || die + + # Drop tests for dev-ruby/http for now since this package only works with ruby26 + sed -i -e '/http_rb/ s:^:#:' spec/spec_helper.rb || die + rm -f spec/acceptance/http_rb/* || die + + # Avoid specs that require network access + sed -i -e '/when request is not stubbed/,/^ end/ s:^:#:' spec/acceptance/shared/callbacks.rb + + # Fix specs with kwargs confusion on ruby30 + sed -i -e "21 s/'A' => 'a'/{'A' => 'a'}/" spec/unit/request_signature_spec.rb || die + sed -i -e "34 s/'A' => 'a'/{'A' => 'a'}/" spec/unit/response_spec.rb || die +} + +each_ruby_test() { + ${RUBY} -S rake test NO_CONNECTION=true || die + ${RUBY} -S rspec-3 spec || die + + einfo "Delay to allow the test server to stop" + sleep 10 +} |
