# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-zabbix_sender
_gemname=${pkgname#ruby-}
pkgver=0.1.4
pkgrel=0
pkgdesc="A gem to push data into Zabbix using Zabbix Send & Zabbix Trapper."
url="https://rubygems.org/gems/zabbix_sender"
arch="noarch"
license="UNLICENSED"
checkdepends="ruby-rake ruby-rspec rspec-its ruby-bundler"
depends="ruby"
source="$pkgname-$pkgver.tar.gz::https://github.com/nownabe/zabbix_sender/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
options="!check" #skip due to missing dependency on rspec-its

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="
45c73d477f69e2b070999509258cc75b368a43c372e2bf96d17a8cfc76055d8a6fd96064640ce8f1f549d2f719c118eb5af1b69eccf5b9a8f22c5476ef5b3762  ruby-zabbix_sender-0.1.4.tar.gz
45f9f7011e0038c53b7f0f88536c9e137a1692120050663a858d00cff97832123f73ec95f21b29c14c6dfbf997bf8b4f09ead51cbd2a69e75f3f6f3f3f558d6b  gemspec.patch
"
