# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=luacheck
pkgver=0.21.2
pkgrel=0
pkgdesc="A tool for linting and static analysis of Lua code"
url="https://github.com/mpeterv/luacheck"
arch="noarch"
license="MIT"
depends="lua lua-filesystem"
checkdepends="lua-busted"
source="$pkgname-$pkgver.tar.gz::https://github.com/mpeterv/$pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

check() {
	cd "$builddir"
	busted .
}

package() {
	local lver=$(lua -e 'print(_VERSION:match("[%d%.]+"))')
	local lmod_dir="$pkgdir/usr/share/lua/$lver"

	cd "$builddir"

	mkdir -p "$lmod_dir"
	cp -r src/$pkgname "$lmod_dir"/

	install -D -m 755 bin/$pkgname.lua "$pkgdir"/usr/bin/$pkgname
}

sha512sums="f2edcd9463b4af3ea1cbe3652c395196ff21dc371ddcbec6d19ff64017d0fc541f5cbd642661ec2064502e61680c556deb186259d27b2294743152fb4e69dbb3  luacheck-0.21.2.tar.gz"
