arch-pkgs/ruby-rubocop/PKGBUILD

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>
pkgname=ruby-rubocop
_gemname="${pkgname#ruby-}"
pkgver=1.34.0
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=('c6106262763eb7c82307eeee7a75a7f46236fe93e35b03e1023c65f730a22ef1ef2a2cc5232c3ce6ca741e49670f808c840abd45108dd992c90b81b865451b9b')
b2sums=('d7cc9310e4e5c252c667da62f0be884585b399ce5a45b5e9ba7a46d44b6bd0e602b09ee6b39e10889363ad17e329c5ce94d304f0f801f487218c74693ef53fe7')
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"
}