# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-net-ldap
_gemname=net-ldap
pkgver=0.19.0
pkgrel=0
pkgdesc="Pure Ruby LDAP library"
url="https://github.com/ruby-ldap/ruby-net-ldap"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-bundler ruby-dev"
source="https://github.com/ruby-ldap/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	"

build() {
	gem build $_gemname.gemspec
}

check() {
	# TODO: Install from aports after we create aport for flexmock.
	export GEM_HOME="$(pwd)/.gems"
	bundle install

	# XXX: This test is probably broken.
	export TESTOPTS="--ignore-testcase=/^TestSSLBER$/"

	"$GEM_HOME"/bin/rake test
}

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 empty directories.
	cd "$gemdir"
	rm -r cache build_info doc
}

sha512sums="
4e8a8b8e33109a884ab320db8e34a5331e4c6559b891e35e52e0ad4edb879f4bbe2e63e181ea27eedc4009faf3055a19ce77dc4adb0b7cdf88b73f3d9410a8b5  ruby-net-ldap-0.19.0.tar.gz
acb62bf90b1ad54dbad8da4d9b15d1c01b81d5d4cbaf7959ea895f6517daca41ef0cf859ad1cbb6b97cdd7e2da26f97b94702187dbd0997f050ce0505569ae53  gemspec.patch
"
