arch-pkgs/ruby-rubocop/PKGBUILD
2021-10-05 06:47:53 +00:00

66 lines
1.9 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Mario Finelli <mario at finel dot li>
# Contributor: farwayer <farwayer at gmail dot com>
_gemname=rubocop
pkgname=ruby-$_gemname
pkgver=1.22.1
pkgrel=1
pkgdesc="A Ruby static code analyzer and formatter"
arch=('any')
url="https://rubocop.org"
license=('MIT')
depends=(
'ruby'
'ruby-parallel'
'ruby-parser'
'ruby-rainbow'
'ruby-regexp_parser'
'ruby-rexml'
'ruby-rubocop-ast'
'ruby-ruby-progressbar'
'ruby-unicode-display_width'
)
makedepends=('ruby-rdoc')
options=('!emptydirs')
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('7fd160bd5a6c70babd6f4a217506fb94eb1f447715acff8994005428eb8b1bc94f4ec079bd0ef005024d6d7c97cac08e2cfc8c342364b1292cec1216da704e59')
b2sums=('3705696481c5041a28bbea3cf95efdb3e5f82ef5e902fe3d595881f97278e074c11fdec9aa68741ddc3f2ce74ae45373d46f6800bdeed9bcd88cdc2928bf7e40')
package() {
local _gemdir="$(ruby -e'puts Gem.default_dir')"
gem install \
--verbose \
--ignore-dependencies \
--no-document \
--no-user-install \
--install-dir "$pkgdir/$_gemdir" \
--bindir "$pkgdir/usr/bin" \
"$_gemname-$pkgver.gem"
# delete cache
cd "$pkgdir/$_gemdir"
rm -vrf cache
cd "gems/$_gemname-$pkgver"
# move documentation
install -vd "$pkgdir/usr/share/doc/$pkgname"
mv -vt "$pkgdir/usr/share/doc/$pkgname" README.md
# move license
install -vd "$pkgdir/usr/share/licenses/$pkgname"
mv -vt "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
# generate reproducible documentation
install -vd "$pkgdir/$_gemdir/doc/$_gemname-$pkgver"
cd "$pkgdir/$_gemdir/gems/$_gemname-$pkgver"
rdoc \
--format ri \
--output "$pkgdir$_gemdir/doc/$_gemname-$pkgver/ri" \
./lib
# delete unnecessary rdoc metadata file
rm -f "$pkgdir$_gemdir/doc/$_gemname-$pkgver/ri/created.rid"
}