# Maintainer: George Rawlinson <grawlinson@archlinux.org>

_gemname=notiffany
pkgname=ruby-$_gemname
pkgver=0.1.3
pkgrel=1
pkgdesc="Wrapper library for most popular notification libraries"
arch=('any')
url="https://github.com/guard/notiffany"
license=('MIT')
depends=(
  'ruby'
  'ruby-nenv'
  'ruby-shellany'
)
makedepends=('ruby-rdoc')
options=('!emptydirs')
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
b2sums=('2f93513c2fc09b379117112dae0cef93637cb2820f91fa6473bdbb016ec0c17f1fb4bd824e8b1f20ae9327c3f033d9d0506ea2ab9def95442695acf00eec8027')

package() {
  local _gemdir="$(ruby -e'puts Gem.default_dir')"

  gem install \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "$pkgdir/$_gemdir" \
    --bindir "$pkgdir/usr/bin" \
    "$_gemname-$pkgver.gem"

  # delete cache
  cd "$pkgdir/$_gemdir"
  rm -vrf cache

  cd "gems/$_gemname-$pkgver"

  # move documentation
  install -vd "$pkgdir/usr/share/doc/$pkgname"
  mv -vt "$pkgdir/usr/share/doc/$pkgname" README.md

  # move license
  install -vd "$pkgdir/usr/share/licenses/$pkgname"
  mv -vt "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
}