Saturday, April 12, 2008

Download Your Code from Google App Engine

I've been toying around with Google App Engine a little. One feature (among several) that is missing right now is the ability to download your source code after deploying it. (Sure, sure, ..., you should really have your code in a source control system.) While it is likely that Google will give us the ability to download our code in the coming days, I've written a small Makefile that you can use to create a source archive of your site. By deploying the source archive along with your site and then password protecting it you will always have the source handy. Here is the Makefile:

If you put this in the root of your application and run "make", an archive of the entire application will be stored in archive/archive.tgz. Now you probably want to password protect this resource so add the following in your app.yaml file:

Now if you go to you'll be prompted to login to download the source archive.

Don't ask me how long it took me to figure out I needed to use two dollar signs on the fancy parameter substitution $${PWD##*/} because it is a shell variable and not a make variable -- really, don't ask.