#!/bin/bash
# script to generate the pathagar rpm from Seth Woodward's github repo
release='8'

set -e
cdir=`pwd`
git clone git://github.com/PathagarBooks/pathagar
cat << EOF > pathagar/setup.py
#!/usr/bin/env python

from distutils.core import setup

setup(name='pathagar',
	version = '0.4',
	packages = ['pathagar',
		'pathagar.books',
		'pathagar.books.management',
		'pathagar.books.management.commands'
		],
	package_dir = {'pathagar':''},
	package_data = {'pathagar':['static_media/images/*',
		'static_media/js/*',
		'static_media/style/*.css',
		'static_media/style/blueprint/*.css',
		'static_media/style/blueprint/plugins/rtl/*.css',
		'static_media/style/blueprint/plugins/rtl/*.txt',
		'static_media/style/blueprint/plugins/link-icons/*.css',
		'static_media/style/blueprint/plugins/link-icons/*.txt',
		'static_media/style/blueprint/plugins/link-icons/icons/*',
		'static_media/style/blueprint/plugins/fancy-type/*',
		'static_media/style/blueprint/plugins/buttons/*.txt',
		'static_media/style/blueprint/plugins/buttons/*.css',
		'static_media/style/blueprint/plugins/buttons/icons/*',
		'templates/*.html',
		'templates/registration/*',
		'templates/admin/*',
		'templates/books/*',
		'AUTHORS',
		'COPYING',
		'README.mkd',
		'requirements.pip',
		'settings.*',
		'setup.*',
		'books/fixtures/*',
		'books/templates/*',
		'TODO',
		]}
	)
EOF

cat <<EOF > pathagar/setup.cfg
[bdist_rpm]
packager = George Hunt <georgejhunt@gmail.com>
release = 8
requires = django
	django-tagging
	django-taggit
	django-sendfile
EOF
cd pathagar
python setup.py bdist_rpm -v

cd $cdir/pathagar/dist
mkdir -p temp
cp path*noarch.rpm temp
cd temp
rpm2cpio pathagar* |cpio -id
tree
