diff options
author | Naohiro Aota <naota@gentoo.org> | 2021-05-23 13:47:54 +0900 |
---|---|---|
committer | Naohiro Aota <naota@gentoo.org> | 2021-05-24 01:43:07 +0900 |
commit | 64311645f0de918f259c11e4b7ce9cc613a43518 (patch) | |
tree | f6b1412ccbcbd466644b72bffd6b88d5c3cf4ec9 /dev-ruby | |
parent | dev-util/apitrace: bump to python 3.9, 3.10 (diff) | |
download | gentoo-64311645f0de918f259c11e4b7ce9cc613a43518.tar.gz gentoo-64311645f0de918f259c11e4b7ce9cc613a43518.tar.bz2 gentoo-64311645f0de918f259c11e4b7ce9cc613a43518.zip |
dev-ruby/twitter-text: add ruby27 support
Add ruby27 support by applying a patch to fix frozen string problem.
Signed-off-by: Naohiro Aota <naota@gentoo.org>
Diffstat (limited to 'dev-ruby')
-rw-r--r-- | dev-ruby/twitter-text/files/twitter-text-3.1.0-frozen-string.patch | 69 | ||||
-rw-r--r-- | dev-ruby/twitter-text/twitter-text-3.1.0-r1.ebuild | 38 |
2 files changed, 107 insertions, 0 deletions
diff --git a/dev-ruby/twitter-text/files/twitter-text-3.1.0-frozen-string.patch b/dev-ruby/twitter-text/files/twitter-text-3.1.0-frozen-string.patch new file mode 100644 index 000000000000..02959cafb983 --- /dev/null +++ b/dev-ruby/twitter-text/files/twitter-text-3.1.0-frozen-string.patch @@ -0,0 +1,69 @@ +# https://github.com/twitter/twitter-text/pull/337 +diff --git a/lib/twitter-text/deprecation.rb b/lib/twitter-text/deprecation.rb +index b377abf9..bc66d60f 100644 +--- a/lib/twitter-text/deprecation.rb ++++ b/lib/twitter-text/deprecation.rb +@@ -8,7 +8,7 @@ module Deprecation + def deprecate(method, new_method = nil) + deprecated_method = :"deprecated_#{method}" + message = "Deprecation: `#{method}` is deprecated." +- message << " Please use `#{new_method}` instead." if new_method ++ message += " Please use `#{new_method}` instead." if new_method + + alias_method(deprecated_method, method) + define_method method do |*args, &block| + +diff --git a/lib/twitter-text/autolink.rb b/lib/twitter-text/autolink.rb +index 82f35302..9b243ec6 100644 +--- a/lib/twitter-text/autolink.rb ++++ b/lib/twitter-text/autolink.rb +@@ -325,10 +326,10 @@ def link_url_with_entity(entity, options) + # <span style='font-size:0'> </span> + # … + # </span> +- %(<span class="tco-ellipsis">#{preceding_ellipsis}<span #{invisible_tag_attrs}> </span></span>) << +- %(<span #{invisible_tag_attrs}>#{html_escape(before_display_url)}</span>) << +- %(<span class="js-display-url">#{html_escape(display_url_sans_ellipses)}</span>) << +- %(<span #{invisible_tag_attrs}>#{html_escape(after_display_url)}</span>) << ++ %(<span class="tco-ellipsis">#{preceding_ellipsis}<span #{invisible_tag_attrs}> </span></span>) + ++ %(<span #{invisible_tag_attrs}>#{html_escape(before_display_url)}</span>) + ++ %(<span class="js-display-url">#{html_escape(display_url_sans_ellipses)}</span>) + ++ %(<span #{invisible_tag_attrs}>#{html_escape(after_display_url)}</span>) + + %(<span class="tco-ellipsis"><span #{invisible_tag_attrs}> </span>#{following_ellipsis}</span>) + else + html_escape(display_url) +@@ -444,7 +445,7 @@ def tag_attrs(attributes) + else + value + end +- attrs << %( #{html_escape(key)}="#{html_escape(value)}") ++ attrs = attrs + %( #{html_escape(key)}="#{html_escape(value)}") + end + + attrs +diff --git a/lib/twitter-text/deprecation.rb b/lib/twitter-text/deprecation.rb +index bc66d60f..cfc4858c 100644 +--- a/lib/twitter-text/deprecation.rb ++++ b/lib/twitter-text/deprecation.rb +@@ -8,7 +9,7 @@ module Deprecation + def deprecate(method, new_method = nil) + deprecated_method = :"deprecated_#{method}" + message = "Deprecation: `#{method}` is deprecated." +- message += " Please use `#{new_method}` instead." if new_method ++ message = "#{message} Please use `#{new_method}` instead." if new_method + + alias_method(deprecated_method, method) + define_method method do |*args, &block| +diff --git a/lib/twitter-text/extractor.rb b/lib/twitter-text/extractor.rb +index a2fd7db7..c96ec200 100644 +--- a/lib/twitter-text/extractor.rb ++++ b/lib/twitter-text/extractor.rb +@@ -19,7 +20,7 @@ def codepoint_length + + # Helper function to convert this string into an array of unicode code points. + def to_codepoint_a +- @to_codepoint_a ||= if chars.kind_of?(Enumerable) ++ if chars.kind_of?(Enumerable) + chars.to_a + else + codepoint_array = [] diff --git a/dev-ruby/twitter-text/twitter-text-3.1.0-r1.ebuild b/dev-ruby/twitter-text/twitter-text-3.1.0-r1.ebuild new file mode 100644 index 000000000000..ec9980d121a6 --- /dev/null +++ b/dev-ruby/twitter-text/twitter-text-3.1.0-r1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +USE_RUBY="ruby24 ruby25 ruby26 ruby27" + +RUBY_FAKEGEM_RECIPE_TEST="rspec3" + +RUBY_FAKEGEM_EXTRADOC="README.md" + +RUBY_FAKEGEM_EXTRAINSTALL="config" + +inherit ruby-fakegem + +DESCRIPTION="Text handling for Twitter" +HOMEPAGE="https://github.com/twitter/twitter-text" + +LICENSE="MIT" +SLOT="$(ver_cut 1-2)" +KEYWORDS="~amd64" +IUSE="" + +ruby_add_rdepend " + dev-ruby/idn-ruby + =dev-ruby/unf-0.1* +" + +ruby_add_bdepend "test? ( >=dev-ruby/multi_json-1.3 + >=dev-ruby/nokogiri-1.8.0 )" + +PATCHES=( + "${FILESDIR}/${PN}-3.1.0-frozen-string.patch" +) + +all_ruby_prepare() { + #sed -i -e 's/2.14.0/2.14/' twitter-text.gemspec || die + sed -i -e '/simplecov/,/end/ s:^:#:' spec/spec_helper.rb || die +} |