archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / ruby-reline / trunk / PKGBUILD
blobe09f37ee245ef2bf613c48cda09e0d5b5678748e
1 # Maintainer: Anatol Pomozov
2 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
4 _gemname='reline'
5 pkgname="ruby-${_gemname}"
6 pkgver=0.3.1
7 pkgrel=2
8 pkgdesc='Alternative GNU Readline or Editline implementation by pure Ruby.'
9 arch=('any')
10 url="https://github.com/ruby/${_gemname}"
11 license=('RUBY')
12 depends=('ruby')
13 checkdepends=('ruby-rake')
14 options=('!emptydirs')
15 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
16 sha512sums=('d17fcd082134ca03877e1e3fb93d9f8581e788d4d95982118ae11fd69dccec4e28f0520bc52755c68b00e01399515dc1d415bb7cdd441f3c3c82f8554bfa44d7')
18 prepare() {
19   cd "${_gemname}-${pkgver}"
21   # update gemspec/Gemfile to allow newer version of the dependencies
22   sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
25 build() {
26   cd "${_gemname}-${pkgver}"
28   gem build "${_gemname}.gemspec"
31 check() {
32   cd "${_gemname}-${pkgver}"
34   rake test
37 package() {
38   cd "${_gemname}-${pkgver}"
40   local _gemdir="$(gem env gemdir)"
41   local _platform="$(gem env platform | cut -d':' -f2)"
42   local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"
44   gem install \
45     --local \
46     --verbose \
47     --ignore-dependencies \
48     --no-user-install \
49     --install-dir "${pkgdir}/${_gemdir}" \
50     --bindir "${pkgdir}/usr/bin" \
51     "${_gemname}-${pkgver}.gem"
53   install --verbose --directory --mode=0755 \
54     "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}" \
55     "${pkgdir}${_gemdir}/specifications/default"
57   mv --verbose "${pkgdir}${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" "${pkgdir}${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
58   mv --verbose "${pkgdir}${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
59   mv --verbose "${pkgdir}${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}" "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_gemname}"
61   # remove unrepreducible files
62   rm --force --recursive --verbose \
63     "${pkgdir}${_gemdir}/cache/" \
64     "${pkgdir}${_gemdir}/build_info/" \
65     "${pkgdir}${_gemdir}/extensions/" \
66     "${pkgdir}${_gemdir}/gems/" \
67     "${pkgdir}${_gemdir}/plugins/" \
68     "${pkgdir}${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
70   install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
71   install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"