archrelease: copy trunk to community-any
[ArchLinux/community.git] / ruby-logger / trunk / PKGBUILD
blobcbfc7f0fc7103091892e574d3c120fcec75940aa
1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
3 _gemname='logger'
4 pkgname="ruby-${_gemname}"
5 pkgver=1.5.1
6 pkgrel=3
7 pkgdesc='Provides a simple logging utility for outputting messages'
8 arch=('any')
9 url="https://github.com/ruby/${_gemname}"
10 license=('BSD' 'RUBY')
11 depends=('ruby')
12 checkdepends=('ruby-rake')
13 options=('!emptydirs')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('a2ce134234a471603f637c53bcc145dd95105dd3cc5490c56033169408e997a7ba4740d89e9bde014a7ac7806b3107e8da92f84c869b510bc820992da1be842f')
16 b2sums=('bc9a5c72f190082367ec1214d690d047fa60f0230e7d5065cb2acbd9ec4015ab41377f808df6aa46e19b9c90f69e89e4e7c5e2398593defad795399674a903a9')
18 prepare() {
19   cd "${_gemname}-${pkgver}"
21   # update gemspec/Gemfile to allow newer version of the dependencies
22   sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
25 build() {
26   cd "${_gemname}-${pkgver}"
28   local _gemdir="$(gem env gemdir)"
29   local _platform="$(gem env platform | cut -d':' -f2)"
30   local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"
32   install --verbose --directory --mode=0755 \
33     "tmp_install_default/gemspec/specifications/gems/${_gemname}-${pkgver}" \
34     "tmp_install/usr/lib/ruby/${_extension_api_version}/${_platform}" \
35     "tmp_install${_gemdir}/specifications/default"
37   gem build "${_gemname}.gemspec"
39   gem install \
40     --local \
41     --verbose \
42     --ignore-dependencies \
43     --no-user-install \
44     --install-dir "tmp_install/${_gemdir}" \
45     --bindir "tmp_install/usr/bin" \
46     "${_gemname}-${pkgver}.gem"
48   gem install \
49     --default \
50     --local \
51     --verbose \
52     --ignore-dependencies \
53     --no-user-install \
54     --install-dir "tmp_install_default/gemspec" \
55     --bindir "tmp_install_default/usr/bin" \
56     "${_gemname}-${pkgver}.gem"
58   mv --verbose "tmp_install_default/gemspec/specifications/default/${_gemname}-${pkgver}.gemspec" "tmp_install${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
59   mv --verbose "tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "tmp_install/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
60   mv --verbose "tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}" "tmp_install/usr/lib/ruby/${_extension_api_version}/${_gemname}"
62   # remove unrepreducible files
63   rm --force --recursive --verbose \
64     "tmp_install${_gemdir}/cache/" \
65     "tmp_install${_gemdir}/build_info/" \
66     "tmp_install${_gemdir}/extensions/" \
67     "tmp_install${_gemdir}/gems/" \
68     "tmp_install${_gemdir}/plugins/" \
69     "tmp_install${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" \
70     "tmp_install${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
73 check() {
74   cd "${_gemname}-${pkgver}"
76   local _gemdir="$(gem env gemdir)"
78   GEM_HOME="tmp_install/${_gemdir}" rake test
81 package() {
82   cd "${_gemname}-${pkgver}"
84   cp --archive --verbose tmp_install/* "${pkgdir}"
86   install -D --mode=644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
87   install -D --mode=644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
90 # vim: tabstop=2 shiftwidth=2 expandtab: