# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bernhard Landauer <oberon@manjaro.org>
# Contributor: Alexsandr Pavlov <kidoz at mail dot ru>

_gemname=hoe
pkgname=ruby-${_gemname}
pkgver=4.2.1
pkgrel=2.1
pkgdesc='Hoe is a rake/rubygems helper for project Rakefiles'
url='https://www.zenspider.com/projects/hoe.html'
arch=(any)
license=('MIT')
depends=('ruby')
makedepends=('git' 'ruby-rdoc' 'ruby-rake' 'ruby-minitest')
options=('!emptydirs')
source=("git+https://github.com/seattlerb/hoe#tag=v${pkgver}")
sha512sums=('bc036703f4d0c564c9da520e2d97c166c01f27216cab88c487c2ecdaae28951da1b600589e77cef73a8e68db3bd1f570343591c7f38ca111c32df23cc8368ac4')

pkgver() {
  cd ${_gemname}
  grep 'VERSION = "' lib/hoe.rb|sed -E 's|.*"(.+)"|\1|'
}

build() {
  cd ${_gemname}
  rake gem
}

check() {
  cd ${_gemname}
  rake test
}

package() {
  cd ${_gemname}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" \
    -n "${pkgdir}/usr/bin" pkg/${_gemname}-${pkgver}.gem
  install -Dm 644 README.rdoc -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 README.rdoc -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm -rf cache gems/${_gemname}-${pkgver}/{ext,lib/*/*.so} \
    extensions/*/*/${_gemname}-${pkgver}/{mkmf.log,gem_make.out}
}

# vim: ts=2 sw=2 et:
