summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 08de8dfae2f0e48db46f7ccaf2699d2f334eac88 (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
# Maintainer: Slash <demodevil5[at]yahoo[dot]com>
# Contributor: Nathan "Necopinus" <nathan@ecopunk.info>
# Contributor: Sebastian Schäfer <sarek@uliweb.de>

pkgname=tracks
pkgver=2.3.0
pkgrel=1
pkgdesc="Web-based application helping to implement the 'Getting things done' methodology"
arch=('any')
url="http://www.getontracks.org/"
license=('GPL')
makedepends=('libmariadbclient' 'libxml2' 'libxslt'  'ruby-bundler' 'sqlite')
backup=('usr/share/webapps/tracks/config/database.yml'
        'usr/share/webapps/tracks/config/site.yml'
        'usr/share/webapps/tracks/db/tracks.sqlite3.db')
source=(
    'default_db.patch'
    'tracks.service'
    "tracks.zip::https://github.com/TracksApp/tracks/zipball/v${pkgver}")
install="${pkgname}.install"
sha256sums=('d6a762be317e3753d50aca29a953cd5c8ef0aae6ddabd5807124e2e41ba46f48'
            '9decac0239505dcbd8cdbde1d105939a4388a243f570f83c4dfee1e709517418'
            'dbe6e1e940305e8d5ce7d794d26bfd69a4740f7176a76df4aecb7d69927d1762')
_tracks_archive_path='TracksApp-tracks-4070f4e'

prepare() {
    cd "${srcdir}/${_tracks_archive_path}"

    # Create site.yml from template
    cp config/site.yml.tmpl config/site.yml

    # Create database.yml from template
    cp config/database.yml.tmpl config/database.yml

    # Patch database.yml to use the sqlite default database
    patch -p0 < "${srcdir}/default_db.patch"

    # Configure Tracks to serve static assets via Mongrel
    sed -i \
      's/config.serve_static_assets = false/config.serve_static_assets = true/' \
      config/environments/production.rb
}

build() {
    cd "${srcdir}/${_tracks_archive_path}"

    # Use bundler to install required gems
    bundle install --without development test --path vendor/bundle

    # Initialize the default sqlite Database
    bundle exec rake db:migrate RAILS_ENV=production

    # Precompile static assets
    bundle exec rake assets:precompile RAILS_ENV=production
}

package() {
    cd "${srcdir}"

    # Create destination directories
    install -d "${pkgdir}/etc/webapps/tracks"
    install -d "${pkgdir}/srv/http"
    install -d "${pkgdir}/usr/share/webapps/tracks"

    # Copy Tracks data to destination directory
    cp -r "${srcdir}/${_tracks_archive_path}/". \
        "${pkgdir}/usr/share/webapps/tracks/"

    # Change ownership of files to http:http
    chown -R 33:33 "${pkgdir}/usr/share/webapps/tracks"

    # Symlink configuration files to /etc/
    ln -s /usr/share/webapps/tracks/config/database.yml \
        "${pkgdir}/etc/webapps/tracks/database.yml"

    ln -s /usr/share/webapps/tracks/config/site.yml \
        "${pkgdir}/etc/webapps/tracks/site.yml"

    # Symlink tracks to /srv/http/
    ln -s /usr/share/webapps/tracks/ \
        "${pkgdir}/srv/http/tracks"

    # Install systemd Service File
    install -Dm644 tracks.service \
        "${pkgdir}/usr/lib/systemd/system/tracks.service"
}