summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2efc8186b91fc823784c3de579018aaeb8153840 (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
# Maintainer: Jonian Guveli <https://github.com/jonian/>
pkgname=devdocs-git
pkgver=r1033.ddf87bb
pkgrel=2
pkgdesc="API Documentation Browser"
arch=("any")
url="http://devdocs.io"
license=("MPL")
depends=("ruby" "ruby-bundler" "curl" "nodejs" "coffee-script")
makedepends=("git")
provides=("devdocs-git")
source=("$pkgname::git+https://github.com/Thibaut/devdocs" "devdocs-server.sh" "devdocs-cli.sh" "devdocs.service")
md5sums=("SKIP" "SKIP" "SKIP" "SKIP")

pkgver() {
  cd "$srcdir/$pkgname"
  ( set -o pipefail
    git describe --long 2>/dev/null | sed "s/\([^-]*-g\)/r\1/;s/-/./g" ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

package() {
  mkdir -p "$pkgdir/opt"
  mkdir -p "$pkgdir/usr/bin"
  mkdir -p "$pkgdir/usr/lib/systemd/system"

  cp -a "$srcdir/$pkgname" "$pkgdir/opt/$pkgname"
  sed -i "/ruby /d" "$pkgdir/opt/$pkgname/Gemfile"

  cp "$srcdir/devdocs-server.sh" "$pkgdir/opt/$pkgname/devdocs-server.sh"
  cp "$srcdir/devdocs-cli.sh" "$pkgdir/opt/$pkgname/devdocs-cli.sh"
  cp "$srcdir/devdocs.service" "$pkgdir/usr/lib/systemd/system/devdocs.service"

  ln -s "/opt/$pkgname/devdocs-server.sh" "$pkgdir/usr/bin/devdocs-server"
  ln -s "/opt/$pkgname/devdocs-cli.sh" "$pkgdir/usr/bin/devdocs-cli"

  mkdir -p "$pkgdir/opt/$pkgname/tmp"

  chown -R http:wheel "$pkgdir/opt/$pkgname/public"
  chown -R http:wheel "$pkgdir/opt/$pkgname/tmp"

  chmod -R g+w "$pkgdir/opt/$pkgname/public"
  chmod -R g+w "$pkgdir/opt/$pkgname/tmp"

  cd "$pkgdir/opt/$pkgname" && bundle install --path .bundle
  cd "$pkgdir/opt/$pkgname" && bundle exec thor assets:clean && bundle exec thor assets:compile
}