summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 72a3c481b72100082182b26fd644b335a9ee5526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
# Contributor: Aoibhinn Nic Aoidh <oibindnicaoidh@gmail.com>
# Contributor: Barry Smith <brrtsm@gmail.com>
# Contributor: Florent H. CARRÉ <colundrum@gmail.com>

_gemname=thread_safe
pkgname=ruby-$_gemname
pkgver=0.3.6
pkgrel=3
pkgdesc='(Deprecated) Thread-safe collections and utilities for Ruby'
arch=(any)
url="https://github.com/ruby-concurrency/${_gemname}"
license=('Apache-2.0')
depends=('ruby')
makedepends=(
  'ruby-rdoc'
  'rubygems'
)
checkdepends=(
  'ruby-bundler'
  'ruby-rake'
  'ruby-rspec'
  'ruby-rspec-core'
  'ruby-yard'
)
options=(!emptydirs)
_tarname="${_gemname}-${pkgver}"
source=("${_tarname}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
b2sums=('32719abb80a126cb228dbd84b3f83fe418507609144a0e062cd0c0cd9c5c92db3ac7c093796378fae98acded9f91a7c3aae96965580fccdc4a35f323925ddca1')

prepare() {
  cd "${_tarname}"
  sed -e 's|~>|>=|g' \
    -e "s|, '[<=]\+ [0-9.]\+'||g" \
    -i "${_gemname}.gemspec"
  sed -e 's|~>|>=|g' \
    -e "s|, '[<=]\+ [0-9.]\+'||g" \
    -i Gemfile

  # we use a tarball, not a git checkout
  sed -e 's/git ls-files --/find/' -i ${_gemname}.gemspec
  sed -e 's/git ls-files/find/' -i ${_gemname}.gemspec

  # remove unneeded code coverage plugins
  sed -e "/require 'simplecov'/d" -i ./spec/spec_helper.rb
  sed -e "/require 'coveralls'/d" -i ./spec/spec_helper.rb
  sed -e "/^SimpleCov/,/^end/d" -i ./spec/spec_helper.rb

  # fix hasbang line to allow passing the arguments to ruby
  sed -e "s|#!/usr/bin/env ruby |#!/usr/bin/env -S ruby |" -i ./examples/bench_cache.rb
}

build() {
  cd "${_tarname}"
  gem build ${_gemname}.gemspec
}

check() {
  cd "${_tarname}"
  rake test
}

package() {
  cd "${_tarname}"
  local _gemdir="$(gem env gemdir)"

  gem install \
    --ignore-dependencies \
    --no-user-install \
    -i "${pkgdir}/${_gemdir}" \
    -n "${pkgdir}/usr/bin" \
    "${_tarname}.gem"

  rm -rf "${pkgdir}/${_gemdir}/cache"

  install -Dm0644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}/"
}