Skip to content

Instantly share code, notes, and snippets.

@uggedal
Created May 24, 2012 21:41
Show Gist options
  • Save uggedal/2784406 to your computer and use it in GitHub Desktop.
Save uggedal/2784406 to your computer and use it in GitHub Desktop.
mediaqueri.es deployment with pacman
VERSION=1.0
.PHONY: all with-venv
all: with-venv
@./manage.py assets build
@python setup.py sdist
@cp dist/mediaqueries-$(VERSION).tar.gz pkg/
@cd pkg && makepkg -f --skipchecksums
@./manage.py assets clean
@rm -rf build/ dist/ mediaqueries.egg-info/
@rm pkg/mediaqueries-$(VERSION).tar.gz
with-venv:
ifndef VIRTUAL_ENV
$(error can not run wihout a venv)
endif
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
pkgname=mediaqueries
pkgver=1.0
pkgrel=6
pkgdesc='Source and static files for mediaqueri.es.'
arch=('any')
url='http://mediaqueri.es'
license=('custom')
depends=('python2' 'python2-virtualenv' 'phantomjs')
source=("mediaqueries-$pkgver.tar.gz")
md5sums=()
build() {
local venv_dest="$pkgdir/usr/local/venv/$pkgname"
local http_root="$pkgdir/srv/http"
local http_dest="$http_root/$pkgname"
# Static content served directly by nginx:
install -d $http_dest/static
install ../../$pkgname/static/*.css -t $http_dest/static
install ../../$pkgname/static/*.js -t $http_dest/static
install ../../$pkgname/static/*.png -t $http_dest/static
install ../../$pkgname/static/*-webfont.* -t $http_dest/static
install ../../$pkgname/static/.webassets-manifest -t $http_dest/static
install ../../$pkgname/static/favicon.ico -t $http_dest
# Preserve original /srv/http mode
chmod 0750 $http_root
# Create venv and install mediaqueries and all deps into it
cd "$srcdir/$pkgname-$pkgver"
sed -i -e's/env = "Development"/env = "Production"/' mediaqueries/__init__.py
virtualenv --distribute $venv_dest
"$venv_dest/bin/python" setup.py install --optimize=1
virtualenv --relocatable $venv_dest
# The http user should own all files and directories
chown -R http: $http_dest $venv_dest
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment