# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-unicode-display_width
_gemname=unicode-display_width
# NOTE: Before bumping, check version required by jekyll.
pkgver=2.5.0
pkgrel=1
pkgdesc="Monospace Unicode character width in Ruby"
url="https://github.com/janlelis/unicode-display_width"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rspec"
source="https://github.com/janlelis/unicode-display_width/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	tests-skip-emoji.patch
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec .
}

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 rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions plugins
}

sha512sums="
cd6302136e5d61e6209bd9c6eb432c09d562b59a6a02868a3343a5968c56239cff0f547ed5bed15d5a6a06265385a6a499b148e59f9b84778241c9f8c5efa2be  unicode-display_width-2.5.0.tar.gz
9c77096c0f942119a863239a5abb8e0bde20f865b61706038d753ad20dbfe408d1d0d08256ab9c03561e6966e442a85b1a8ed9b049ab1bce924e3a5545624ac2  tests-skip-emoji.patch
95a5769602c1f06e76c73896367db972fea2cb5bbeb8ddcf70e12097563f6651f52eb1ab2482cea69c16fab03bfc71bf5dc33481dfd8974d5f725a19b8519c45  gemspec.patch
"
