aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-escape_utils
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-02-18 03:10:27 +0100
committerJakub Jirutka <jakub@jirutka.cz>2018-02-18 03:10:27 +0100
commita1fea74ed3d013128a95296086c73b3ab89a2304 (patch)
treef0b23dc45c4ee932315f0ec715ffbe41602b3948 /community/ruby-escape_utils
parent90f21dbf57b8ce1cd15c672ec114697d865853d0 (diff)
downloadaports-a1fea74ed3d013128a95296086c73b3ab89a2304.tar.bz2
aports-a1fea74ed3d013128a95296086c73b3ab89a2304.tar.xz
community/ruby-escape_utils: move from testing
Diffstat (limited to 'community/ruby-escape_utils')
-rw-r--r--community/ruby-escape_utils/APKBUILD49
-rw-r--r--community/ruby-escape_utils/fix-tests-for-ruby-2.5.patch27
-rw-r--r--community/ruby-escape_utils/gemspec.patch30
3 files changed, 106 insertions, 0 deletions
diff --git a/community/ruby-escape_utils/APKBUILD b/community/ruby-escape_utils/APKBUILD
new file mode 100644
index 0000000000..ff7a8ec7f7
--- /dev/null
+++ b/community/ruby-escape_utils/APKBUILD
@@ -0,0 +1,49 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+# TODO: Fix to not compile .so lib twice (in build and test).
+pkgname=ruby-escape_utils
+_gemname=${pkgname#ruby-}
+pkgver=1.2.1
+pkgrel=1
+pkgdesc="Faster string escaping routines for your Ruby apps"
+url="https://github.com/brianmario/escape_utils"
+arch="all"
+license="MIT"
+checkdepends="ruby ruby-bundler ruby-minitest ruby-rake-compiler"
+makedepends="ruby-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/brianmario/escape_utils/archive/$pkgver.tar.gz
+ gemspec.patch
+ fix-tests-for-ruby-2.5.patch"
+builddir="$srcdir/$_gemname-$pkgver"
+
+build() {
+ cd "$builddir"
+
+ gem build $_gemname.gemspec
+ gem install --local \
+ --install-dir dist \
+ --ignore-dependencies \
+ --no-document \
+ --verbose \
+ $_gemname
+}
+
+check() {
+ cd "$builddir"
+ rake test
+}
+
+package() {
+ local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
+ cd "$builddir"/dist
+
+ mkdir -p "$gemdir"
+ cp -r extensions gems specifications "$gemdir"/
+
+ # Remove unnecessary files.
+ rm -r "$gemdir"/gems/$_gemname-$pkgver/ext
+}
+
+sha512sums="c2af40a2a3c0cc083a55771e2ed813992391c833b6d64cb9255ec5741c2da6980ddf34331256b73f18617cf8df6b745e81bdd6c1632d63936ccd3a655758b083 ruby-escape_utils-1.2.1.tar.gz
+8cb3c26b46304899b2d200208c18650ab28da81ea42d8479a89b06802d252757df537c997fe5f640122a4521016f0676c267c691bc6be33ce066fe4be0c504d5 gemspec.patch
+06de5f7afcc3b7461d9e915d62ae0405d2161c37759c6868c9b550998995935b90e2865d30b1c9c9a0a5a474d96c5f94762114cda7b2c0b825717c8066115b62 fix-tests-for-ruby-2.5.patch"
diff --git a/community/ruby-escape_utils/fix-tests-for-ruby-2.5.patch b/community/ruby-escape_utils/fix-tests-for-ruby-2.5.patch
new file mode 100644
index 0000000000..0579a99ab6
--- /dev/null
+++ b/community/ruby-escape_utils/fix-tests-for-ruby-2.5.patch
@@ -0,0 +1,27 @@
+CGI.escape does not escape "~" since Ruby 2.5.
+
+--- a/test/uri_component/escape_test.rb
++++ b/test/uri_component/escape_test.rb
+@@ -10,8 +10,9 @@
+ (0..127).each do |i|
+ c = i.chr
+ # Escaping URI path components should match CGI parameter escaping, except
+- # spaces should be escaped as "%20" instead of "+"
+- assert_equal CGI.escape(c).sub("+", "%20"), EscapeUtils.escape_uri_component(c)
++ # spaces should be escaped as "%20" instead of "+" and "~" should be
++ # escaped as "%7E".
++ assert_equal CGI.escape(c).sub("+", "%20").sub("~", "%7E"), EscapeUtils.escape_uri_component(c)
+ end
+ end
+
+--- a/test/url/escape_test.rb
++++ b/test/url/escape_test.rb
+@@ -9,7 +9,7 @@
+ def test_cgi_stdlib_compatibility
+ (0..127).each do |i|
+ c = i.chr
+- assert_equal CGI.escape(c), EscapeUtils.escape_url(c)
++ assert_equal CGI.escape(c).sub("~", "%7E"), EscapeUtils.escape_url(c)
+ end
+ end
+
diff --git a/community/ruby-escape_utils/gemspec.patch b/community/ruby-escape_utils/gemspec.patch
new file mode 100644
index 0000000000..a9be5a90eb
--- /dev/null
+++ b/community/ruby-escape_utils/gemspec.patch
@@ -0,0 +1,30 @@
+--- a/escape_utils.gemspec
++++ b/escape_utils.gemspec
+@@ -6,7 +6,7 @@
+ s.authors = ["Brian Lopez"]
+ s.email = %q{seniorlopez@gmail.com}
+ s.extensions = ["ext/escape_utils/extconf.rb"]
+- s.files = `git ls-files`.split("\n")
++ s.files = Dir["lib/**/*", "ext/**/*"]
+ s.homepage = %q{https://github.com/brianmario/escape_utils}
+ s.license = %q{MIT}
+ s.rdoc_options = ["--charset=UTF-8"]
+@@ -14,18 +14,10 @@
+ s.rubygems_version = %q{1.4.2}
+ s.summary = %q{Faster string escaping routines for your web apps}
+ s.description = %q{Quickly perform HTML, URL, URI and Javascript escaping/unescaping}
+- s.test_files = `git ls-files test`.split("\n")
+
+ s.required_ruby_version = ">= 1.9.3"
+
+ # tests
+ s.add_development_dependency 'rake-compiler', ">= 0.7.5"
+ s.add_development_dependency 'minitest', ">= 5.0.0"
+- # benchmarks
+- s.add_development_dependency 'benchmark-ips'
+- s.add_development_dependency 'rack'
+- s.add_development_dependency 'haml'
+- s.add_development_dependency 'fast_xs'
+- s.add_development_dependency 'actionpack'
+- s.add_development_dependency 'url_escape'
+ end