1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
4 pkgname="ruby-${_gemname}"
7 pkgdesc='Provides three abilities to delegate method calls to an object'
9 url="https://github.com/ruby/${_gemname}"
10 license=('BSD' 'RUBY')
12 checkdepends=('ruby-rake')
13 options=('!emptydirs')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('55fb39909a8500329118c918d24dee211e2c0cf3a36bd6dba1d61049b2233029c19f7a44332fb7c1f5fc5cf41f9e9aed048cfcfe1c6fb9a95db192b9ef74a415')
18 cd "${_gemname}-${pkgver}"
20 # update gemspec/Gemfile to allow newer version of the dependencies
21 sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
23 # we build based on a tar archive, not a git repo
24 sed --in-place --regexp-extended 's|git ls-files -z|find . -type f -not -path "*/\.git/*" -printf "%P\\\\0"|' "${_gemname}.gemspec"
28 cd "${_gemname}-${pkgver}"
30 local _gemdir="$(gem env gemdir)"
31 local _platform="$(gem env platform | cut -d':' -f2)"
32 local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"
34 install --verbose --directory --mode=0755 \
35 "tmp_install_default/gemspec/specifications/gems/${_gemname}-${pkgver}" \
36 "tmp_install/usr/lib/ruby/${_extension_api_version}/${_platform}" \
37 "tmp_install${_gemdir}/specifications/default"
39 gem build "${_gemname}.gemspec"
44 --ignore-dependencies \
46 --install-dir "tmp_install/${_gemdir}" \
47 --bindir "tmp_install/usr/bin" \
48 "${_gemname}-${pkgver}.gem"
54 --ignore-dependencies \
56 --install-dir "tmp_install_default/gemspec" \
57 --bindir "tmp_install_default/usr/bin" \
58 "${_gemname}-${pkgver}.gem"
60 mv --verbose "tmp_install_default/gemspec/specifications/default/${_gemname}-${pkgver}.gemspec" "tmp_install${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
61 mv --verbose "tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "tmp_install/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
63 # remove unrepreducible files
64 rm --force --recursive --verbose \
65 "tmp_install${_gemdir}/cache/" \
66 "tmp_install${_gemdir}/build_info/" \
67 "tmp_install${_gemdir}/extensions/" \
68 "tmp_install${_gemdir}/gems/" \
69 "tmp_install${_gemdir}/plugins/" \
70 "tmp_install${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" \
71 "tmp_install${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
75 cd "${_gemname}-${pkgver}"
77 local _gemdir="$(gem env gemdir)"
79 GEM_HOME="tmp_install/${_gemdir}" rake test
83 cd "${_gemname}-${pkgver}"
85 cp --archive --verbose tmp_install/* "${pkgdir}"
87 install --verbose -D --mode=0644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
88 install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"