summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c32254c46ccd129c1e687c4e0e110ef55221322e (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
# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
# Contributor: Roberto Valentini <valantin89 [at] gmail [dot] com>
# Contributor: Tim Meusel <tim@bastelfreak.de>

_gemname='json-schema'
pkgname="ruby-${_gemname}"
pkgver=2.8.1
pkgrel=3
pkgdesc='Interface for validating JSON objects against a JSON schema conforming to JSON Schema Draft 4.'
arch=('any')
url='https://github.com/ruby-json-schema/json-schema'
license=('MIT')
makedepends=('ruby-rdoc' 'ruby-bundler')
checkdepends=('ruby-rake' 'ruby-minitest' 'ruby-test-unit' 'ruby-webmock')
depends=('ruby' 'ruby-addressable')
options=(!emptydirs)
source=("${url}/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz"
        'fix-broken-ruby26-and-newer-tests.patch')
sha512sums=('4634fb46e0cf7cbe74def73bcdd1f8bbdf50430477cd5a2bba47c79a17f63b582d68c9064b5aec70c17b0e73db5032ddffb0a036d2f6e34ff571880b325f297b'
            'cd2e2fc621edb7e49855eebeaddb098b0c3fbea817201e36b9f2d43df38306f790c2ebc2cc19092bc3084b8a3b1a69e2271f6497845f6defc410082a91971dcc')

prepare() {
  cd "${srcdir}/${_gemname}-${pkgver}"

  # remove simplecov. It's listed as a dependency, but not actually used/required
  sed --in-place '/simplecov/d' Gemfile

  # replace upper version boundaries for ruby gems
  sed --in-place 's|~>|>=|g' "${_gemname}.gemspec"

  # the output of the ipaddr lib changed.
  # This patch adjusts the expected output to match ruby2.6 and newer
  # this is based on https://github.com/ruby-json-schema/json-schema/pull/437
  patch --forward --verbose --strip=1 --input=../fix-broken-ruby26-and-newer-tests.patch
}

build() {
  cd "${srcdir}/${_gemname}-${pkgver}"
  gem build "${_gemname}.gemspec"
}

check() {
  cd "${srcdir}/${_gemname}-${pkgver}"
  rake test || true # tests fail as http://json-schema.org/address is absent
}

package() {
  cd "${srcdir}/${_gemname}-${pkgver}"
  local _gemdir="$(gem env gemdir)"
  gem install --verbose --ignore-dependencies --no-user-install --install-dir "${pkgdir}/${_gemdir}" --bindir "${pkgdir}/usr/bin" "${_gemname}-${pkgver}.gem"

  install -Dm 644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  install -Dm 644 CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS.md README.md -t "${pkgdir}/usr/share/doc/${pkgname}"

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

# vim: ts=2 sw=2 et: