# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-csv
_gemname=${pkgname#ruby-}
pkgver=3.3.0
pkgrel=0
pkgdesc="The CSV library provides a complete interface to CSV files and data."
url="https://rubygems.org/gems/csv"
arch="noarch"
license="BSD-2-Clause"
checkdepends="ruby-rake ruby-bundler ruby-test-unit ruby-rdoc"
depends="ruby"
source="$pkgname-$pkgver.tar.gz::https://github.com/ruby/csv/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

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

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

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

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

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$geminstdir"/doc \
		"$geminstdir"/*.md
}

sha512sums="
676f6c34c1466c0edb412aeba9e955cc0070c201a21e6ffe2fd47a3ad4bd7322d561c612695317e5ef34195bcc8bc7a63f3de8c55fbdcb116890a59b867c20d9  ruby-csv-3.3.0.tar.gz
"
