# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>

pkgname=ruby3.0-test-unit
_gemname=test-unit
# Keep version in sync with "Bundled gems" (https://stdgems.org) for the
# packaged Ruby version.
pkgver=3.3.8
pkgrel=1
pkgdesc="An xUnit family unit testing framework for Ruby"
url="https://test-unit.github.io"
arch="noarch"
license="BSD-2-Clause AND Python-2.0 AND Ruby"
depends="ruby3.0 ruby3.0-power_assert"
makedepends="ruby3.0-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/test-unit/test-unit/archive/$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	ruby test/run-test.rb
}

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

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

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
91df9e76f49998239e72428f9373403f53773c69bd033dcaed5f6fddd40a014e5c70b2cee28f430089da19b73b96d8fe4687e88d807387ace41cf21c0ccc5a56  test-unit-3.3.8.tar.gz
97429f9cb86f7bc989c03531466f1443171ac3835a4738601fe4d52b81a408e1504a26c1ed7d84ae3e07b263600d12f89298af27626219df1d7fd0612b26e466  gemspec.patch
"
