<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Voodoo Programming &#187; General</title>
	<atom:link href="http://www.cneophytou.com/category/general/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cneophytou.com</link>
	<description>Things programmers do that they know shouldn&#039;t work but they try anyway, and which sometimes actually work, such as recompiling everything.</description>
	<lastBuildDate>Tue, 20 Oct 2009 13:54:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Downloading your code from Google App Engine</title>
		<link>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/</link>
		<comments>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 14:42:23 +0000</pubDate>
		<dc:creator>Constantinos</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Apps]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.cneophytou.com/?p=112</guid>
		<description><![CDATA[I've started using Google's App Engine since it launched, mostly playing around with Python (always wanted to learn), and setting up a small app to deal with my Desktop Photo Feed script. One irritation I had was that I wanted to share my code with a friend, but the app engine doesn't provide any way [...]]]></description>
			<content:encoded><![CDATA[I've started using Google's <a href="http://appengine.google.com/">App Engine</a> since it launched, mostly playing around with Python (always wanted to learn), and setting up a small app to deal with my <a href="http://www.cneophytou.com/2008/04/17/photo-feed-as-desktop-background/">Desktop Photo Feed</a> script. One irritation I had was that I wanted to share my code with a friend, but the app engine doesn't provide any way of downloading the source code.<br />
<br />
One way around this that I found, was a blog post by <a href="http://david-burger.blogspot.com/">David Burger</a> on <a href="http://david-burger.blogspot.com/2008/04/download-your-code-from-google-app.html">Download Your Code from Google App Engine</a>, where he created a Makefile to do the dirtywork. Because I don't like Makefiles (and have it from good authority that Googlers hate Makefiles too, but that's besides the point - just to reinforce my position), I modified his method to make it slightly more versatile so that it can work well with OS X (<code>tar</code> includes ._* resource fork files which are annoying), and also turn it into a shell script.<br />
<span id="more-112"></span>
<br />
There are two steps to the process. First, save this code as a file called something like <code>update.sh</code> in the base folder where your app code is located, and make it executable:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">ARCHIVE_DIR</span>=archive
<span style="color: #007800;">ARCHIVE_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">`</span>.tgz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*~&quot;</span> <span style="color: #660033;">-delete</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*pyc&quot;</span> <span style="color: #660033;">-delete</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COPY_EXTENDED_ATTRIBUTES_DISABLE</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COPYFILE_DISABLE</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-czf</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #660033;">--exclude</span> .DS_Store <span style="color: #660033;">--exclude</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #660033;">-C</span> ..<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
appcfg.py update .<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>



<p>
<a href='http://www.cneophytou.com/wp-content/uploads/2008/04/update.sh'>Download this script</a><br />
<br />
Then, you would probably want to password protect the resource that points to this archive file, so add this to your <code>app.yaml</code> file:</p>


<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">- url: /archive
  static_dir: archive
  login: admin</pre></div></div>



<p>
Now, whenever you wish to update your app, just execute <code>./update.sh</code> instead of <code>./appcfg.py update ./</code>, and the archive of your source will be created and uploaded with your changes. To download, assuming the folder your application is in has the same name as your application, just visit <code>http://yourapp.appspot.com/archive/yourapp.tgz</code> where <code>yourapp</code> is your app's name, and <code>yourapp.tgz</code> is your app folder's name if it's different from your app's name, and you will be prompted to download the archive assuming you're logged in as administrator. That's it!]]></content:encoded>
			<wfw:commentRss>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
