# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-treetop
_gemname=treetop
pkgver=1.6.12
pkgrel=2
pkgdesc="A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby"
url="https://github.com/cjheath/treetop"
arch="noarch"
license="MIT"
depends="
	ruby
	ruby-polyglot
	"
checkdepends="
	ruby-activesupport
	ruby-i18n
	ruby-rr
	ruby-rspec
	"
source="https://github.com/cjheath/treetop/archive/v$pkgver/ruby-treetop-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec .
}

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

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions plugins
}

sha512sums="
210a2225a83f10ce6d79f2eb4d5937e7fa805384767f4e2d1ca91fe8408436560ad062b8d6c69209651fdf304e6a850e14b9d0a509dc25fe13ab9225d2ca7bdc  ruby-treetop-1.6.12.tar.gz
1d24c8aa0de6a3309253706144bbc1bf850a10bf16cb038edfd06f292842e9422b8b29c77723841360caa33c9eeddd9d83fa0900bc62e1b3289e4dcf699a8e34  gemspec.patch
"
