Ensure that the link_id entered is the user's in edit_self
[Melange.git] / scripts / build.sh
blobbdcefb2f4b7a2663f93313da71c6e5e211a86f33
1 #!/bin/bash
3 # Script to create a "build" subdirectory. This is a subdirectory
4 # containing a bunch of symlinks, from which the app can be updated.
5 # The main reason for this is to import Django from a zipfile, which
6 # saves dramatically in upload time: statting and computing the SHA1
7 # for 1000s of files is slow. Even if most of those files don't
8 # actually need to be uploaded, they still add to the work done for
9 # each update.
11 DEFAULT_APP_BUILD=../build
12 DEFAULT_APP_FOLDER="../app"
13 DEFAULT_APP_FILES="app.yaml index.yaml __init__.py main.py settings.py urls.py"
14 DEFAULT_APP_DIRS="soc ghop gsoc feedparser python25src reflistprop jquery ranklist json"
15 DEFAULT_ZIP_FILES="tiny_mce.zip"
17 APP_BUILD=${APP_BUILD:-"${DEFAULT_APP_BUILD}"}
18 APP_FOLDER=${APP_FOLDER:-"${DEFAULT_APP_FOLDER}"}
19 APP_FILES=${APP_FILES:-"${DEFAULT_APP_FILES}"}
20 APP_DIRS=${APP_DIRS:-"${DEFAULT_APP_DIRS}"}
21 ZIP_FILES=${ZIP_FILES:-"${DEFAULT_ZIP_FILES}"}
23 if [ -e $APP_FOLDER ] ; then
24 cd $APP_FOLDER
25 else
26 echo 'This script must be run from within the scripts directory!'
27 exit 1
30 # Remove old zip files (and django.zip in its old location)
31 rm -rf $ZIP_FILES django.zip
33 # Remove old $APP_BUILD directory.
34 rm -rf $APP_BUILD
36 # Create new $APP_BUILD directory.
37 mkdir $APP_BUILD
39 # Create new django.zip file, but directly in the $APP_BUILD directory,
40 # rather than in $APP_FOLDER and creating a symlink in $APP_BUILD. This
41 # keeps the presence of a django.zip file in the app/ folder from breaking
42 # debugging into app/django.
44 # We prune:
45 # - .svn subdirectories for obvious reasons.
46 # - contrib/gis/ and related files because it's huge and unneeded.
47 # - *.po and *.mo files because they are bulky and unneeded.
48 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
50 zip -q "$APP_BUILD/django.zip" `find django \
51 -name .svn -prune -o \
52 -name gis -prune -o \
53 -name admin -prune -o \
54 -name localflavor -prune -o \
55 -name mysql -prune -o \
56 -name mysql_old -prune -o \
57 -name oracle -prune -o \
58 -name postgresql-prune -o \
59 -name postgresql_psycopg2 -prune -o \
60 -name sqlite3 -prune -o \
61 -name test -prune -o \
62 -type f ! -name \*.py[co] ! -name *.[pm]o -print`
64 # Create new tiny_mce.zip file.
66 # We prune:
67 # - .svn subdirectories for obvious reasons.
69 # zipserve requires tiny_mce/* to be in root of zip file
70 pushd tiny_mce > /dev/null
71 zip -q ../tiny_mce.zip `find . \
72 -name .svn -prune -o \
73 -type f -print`
74 popd > /dev/null
76 # Create symbolic links.
77 for x in $APP_FILES $APP_DIRS $ZIP_FILES
79 ln -s $APP_FOLDER/$x $APP_BUILD/$x
80 done
82 echo "Build results in $APP_BUILD."