1 # Maintainer: Tim Meusel <tim@bastelfreak.de>
3 pkgname="ruby-${_gemname}"
6 pkgdesc='Log4r, logging framework for ruby'
8 url="https://github.com/colbygk/${_gemname}"
11 makedepends=('git' 'rake' 'ruby-bundler')
12 checkdepends=('ruby-test-unit' 'ruby-builder')
14 source=("git+${url}#commit=40e2c2edd657a21b34f09dec7de238f348b6f428" 'disable-broken-test.patch' 'e64ed5143aae17fef85fe191c967765409061266.patch')
15 noextract=($_gemname-$pkgver.gem)
17 'e5c5a2b587af405b4b434c6db95a615ccb161c7e2f794c20e4c7203c7bace53beb26ba1a1d35b5acbeef71c97c3ecb4fca4354d289275bda6f513c451afb59f8'
18 '7efd5d5eedbc9c94e70180d9e66e73430d3272f3ddad771bca37f1941ca5d2adac150c82680e66963dc0c48af4163034c6beddaedc0915d2de31351d16d59c20')
21 cd "${srcdir}/${_gemname}"
22 sed --in-place 's|~>|>=|g' "${_gemname}.gemspec"
23 # add missing license to gemspec, to please bundler during build
24 sed --in-place '22s/^$/ gem.license = "LGPL-3.0-or-later"/' "${_gemname}.gemspec"
25 # manipulate the broken LOADPATH so the tests can find tests/tests_helper.rb
26 for file in $(find tests/*.rb -type f ! -name '*_*'); do
27 sed --in-place 's|require.*|require "#{File.dirname(__FILE__)}/test_helper"|' "${file}"
29 # remove broken test - https://github.com/colbygk/log4r/issues/37
30 rm tests/testxmlconf.rb
31 # remove deprecated gemcutter to please rubygems
32 sed --in-place 's|:gemcutter|"https://rubygems.org"|' Gemfile
33 # one particular test needs to be disabled.
34 # It assumes that the test is executed with pure ruby, not wrapped with rake
35 # it fails upstream as well
36 patch -p1 -N -i "${srcdir}/disable-broken-test.patch"
37 # fix deprecated YAML lib method name
38 sed --in-place 's|YAML.load_documents|YAML.load_stream|' lib/log4r/yamlconfigurator.rb
39 # create directory where tests can write data
40 # path is hardcoded in the tests, but they don't create the directory
42 # apply commit e64ed5143aae17fef85fe191c967765409061266
43 # it fixes broken tests. the fix is not yet released
44 patch -p1 -N -i "${srcdir}/e64ed5143aae17fef85fe191c967765409061266.patch"
48 cd "${srcdir}/${_gemname}"
49 gem build "${_gemname}.gemspec"
53 cd "${srcdir}/${_gemname}"
58 cd "${srcdir}/${_gemname}"
59 local _gemdir="$(ruby -e'puts Gem.default_dir')"
60 gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}/usr/bin" "${_gemname}-${pkgver}.gem"
61 rm "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem"