# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-minitest-around
_gemname=minitest-around
pkgver=0.5.0
pkgrel=4
pkgdesc="Around block for minitest"
url="https://github.com/splattael/minitest-around"
# s390x: ruby segfaults
arch="noarch !s390x"
license="MIT"
depends="ruby ruby-minitest"
source="https://github.com/splattael/minitest-around/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	sed -i "/require 'bundler/d" test/helper.rb
}

build() {
	gem build $_gemname.gemspec
}

check() {
	RUBYOPT='-Ilib' ruby -e 'Dir.glob("./test/*_{test,spec}.rb", &method(:require))'
}

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

	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
}

sha512sums="
1964cd4cd17957234004eff8c466acf72de259f1d5ae0bb992bb6ba0854ec138a31ae2c68ea39a5f795ba275fb06267b9010c44a0e3d79345e212f9db6fa5272  ruby-minitest-around-0.5.0.tar.gz
baed0d3156f6ded9d651857b8f9093896505f3d1e80e5271a677923dd0cc1450de3c6f7197f2348c708a761a237d54de7b7a0b002f27f3c335d0fe86ccb21396  gemspec.patch
"
