# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-resolv
_gemname=${pkgname#ruby-}
pkgver=0.4.0
pkgrel=0
pkgdesc="A thread-aware DNS resolver library written in Ruby"
url="https://rubygems.org/gems/resolv"
arch="noarch"
license="BSD-2-Clause"
checkdepends="ruby-rake ruby-bundler ruby-test-unit ruby-test-unit-ruby-core"
depends="ruby"
source="$pkgname-$pkgver.tar.gz::https://github.com/ruby/resolv/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake
}

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

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

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc
}

sha512sums="
c1157d086a4d72cc48a6e264bea4e95217b4c4146a103143a7e4a0cea800b60eb7d2e32947449a93f616a9908ed76c0d2b2ae61745940641464089f0c58471a3  ruby-resolv-0.4.0.tar.gz
ed64dbce3e78f63f90ff6a49ec046448b406fa52de3d0c5932c474342868959169d8e353628648cbc4042ee55d7f0d4babf6f929b2f8d71ba7bb12eb9f9fb1ff  gemspec.patch
"
