summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 85799c094e87e6226de68440cdd08c90dbaa702c (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
pkgname=ruby-gollum-lib
_name=gollum-lib
pkgver=6.0
_commit=15aae49016860a7fa3c04bd6f48fee9fd43a518d
pkgrel=2
pkgdesc='A simple, Git-powered wiki with a sweet API.'
arch=(x86_64)
url='http://github.com/gollum/gollum-lib'
license=(MIT)
depends=(
ruby-rouge
ruby-nokogiri
ruby-loofah
ruby-github-markup
ruby-gemojione
ruby-twitter-text
ruby-gollum-rugged_adapter
)
makedepends=(
git
rubygems
)
checkdepends=(
ruby-rack-test
ruby-shoulda
ruby-minitest-reporters
ruby-mocha
ruby-test-unit
ruby-twitter_cldr
)
#options=(!emptydirs)
source=("git+https://github.com/gollum/gollum-lib.git#commit=${_commit}")
sha1sums=('SKIP')

pkgver() {
	cd gollum-lib
	git describe --tags | sed 's/^v//'
}


prepare() {
  cd gollum-lib

  # update gemspec/Gemfile to allow newer version of the dependencies
  sed --in-place --regexp-extended 's|~>|>=|g' "${_name}.gemspec"
  
  sed -i "s|s.add_dependency 'rouge', '~> 3.1'|s.add_dependency 'rouge'|" gemspec.rb
  sed -i "s|s.add_dependency 'twitter-text', '1.14.7'|s.add_dependency 'twitter-text'|" gemspec.rb
}

build() {
  cd gollum-lib

  local _gemdir="$(gem env gemdir)"

  gem build "${_name}.gemspec"

  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "tmp_install/${_gemdir}" \
    --bindir "tmp_install/usr/bin" \
    "${_name}-${pkgver}.gem"

  # remove unrepreducible files
  rm --force --recursive --verbose \
    "tmp_install/${_gemdir}/cache/" \
    "tmp_install/${_gemdir}/gems/${_name}-${pkgver}/vendor/" \
    "tmp_install/${_gemdir}/doc/${_name}-${pkgver}/ri/ext/"

  find "tmp_install/${_gemdir}/gems/" \
    -type f \
    \( \
      -iname "*.o" -o \
      -iname "*.c" -o \
      -iname "*.so" -o \
      -iname "*.time" -o \
      -iname "gem.build_complete" -o \
      -iname "Makefile" \
    \) \
    -delete

  find "tmp_install/${_gemdir}/extensions/" \
    -type f \
    \( \
      -iname "mkmf.log" -o \
      -iname "gem_make.out" \
    \) \
    -delete
}

check() {
  cd gollum-lib

  local _gemdir="$(gem env gemdir)"

  GEM_HOME="tmp_install/${_gemdir}" rake test | true  # needs ruby-nokogiri-diff at least
}

package() {
  cd gollum-lib

  cp --archive --verbose tmp_install/* "${pkgdir}"

  install --verbose -D --mode=0644 LICENSE --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
  install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
}