# Maintainer: Slash # Contributor: Nathan "Necopinus" # Contributor: Sebastian Schäfer 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" }