# Maintainter: Aurélien Desbrières <aurelien@cwb.io>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>
# Maintainer (aur): Adam Lloyd <lloyda2@rpi.edu>

_gemname=syntax
pkgname=ruby-$_gemname
pkgver=1.2.2
pkgdesc="A Ruby library for performing simple syntax highlighting"
url="http://syntax.rubyforge.org/"
license=('custom:BSD3')

pkgrel=1
arch=(any)
depends=(ruby)
makedepends=(rubygems)
source=("$pkgname-$pkgver.tar.gz::https://github.com/dblock/syntax/archive/v$pkgver.tar.gz")
sha256sums=('0f4fe45d8dca5cbc6bb0870de5f23aa4d2f518c320dcb38f24b8d603abf16e3a')

build() {
  cd "$srcdir/$_gemname-$pkgver"

  gem build $_gemname.gemspec
}

package() {
  cd "$srcdir/$_gemname-$pkgver"

  local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"
  gem install --no-user-install --ignore-dependencies -i "$pkgdir$_gemdir" -n "$pkgdir/usr/bin" \
    "$_gemname-$pkgver.gem"

  install -Dm644 "$pkgdir$_gemdir"/gems/$_gemname-$pkgver/LICENSE \
                 "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
