# Contributor: omni <omni+alpine@hack.org>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-xmlrpc
_gemname=xmlrpc
pkgver=0.3.3
pkgrel=1
pkgdesc="XMLRPC library for Ruby"
url="https://github.com/ruby/xmlrpc"
arch="noarch"
license="BSD-2-Clause"
depends="ruby ruby-webrick"
checkdepends="ruby-rake ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/xmlrpc/archive/v$pkgver/ruby-xmlrpc-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	# FIXME: Tests are broken: Errno::EADDRINUSE.
	rake test || true
}

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="
4f9872d820ba87f04b6f7ccfd0646397d19361d27f6c3103963b274eb71668f038596a66e99e2379d2bb0f636d5f6b7f34adc57289e537efa702a116b45c7644  ruby-xmlrpc-0.3.3.tar.gz
b624f493152690b35e8426b87de63f8c26720e1770d3581d018fcd15c3480455784f39a7ee05291bdb052b0766dd325dfda96f12ad5c0823880320a1b2a2eef2  gemspec.patch
"
