Index: pifr_demo.client.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pifr_demo/pifr_demo.client.inc,v
retrieving revision 1.3
diff -u -r1.3 pifr_demo.client.inc
--- pifr_demo.client.inc	9 Feb 2010 08:53:26 -0000	1.3
+++ pifr_demo.client.inc	9 Feb 2010 09:32:07 -0000
@@ -40,6 +40,20 @@
    * Move checkout to demo fresh directory.
    */
   protected function review() {
+    // Ensure demo directory exists.
+    if (!file_exists(file_directory_path() . '/demo')) {
+      mkdir(file_directory_path() . '/demo');
+    }
+    $demo_directory = file_directory_path() . '/demo/' . $this->unique_id;
+    mkdir($demo_directory);
+
+    // Generate tarball and zip of checkout.
+    $basename = date('Ymd') . '-' . $this->test['test_id'];
+    chdir($this->checkout_directory . '/..');
+    $this->exec('tar -cvzf demo/' . $this->unique_id . '/' . $basename . '.tar.gz checkout');
+    $this->exec('zip -r demo/' . $this->unique_id . '/' . $basename . '.zip checkout');
+    chdir($this->original['directory']);
+
     // Add an auto-login sniplet to index.php.
     $placeholder = $this->test['review']['argument']['core'] == 6 ?
       '$return = menu_execute_active_handler();' : 'menu_execute_active_handler();';
@@ -48,18 +62,13 @@
     $contents = str_replace('menu_execute_active_handler();',
 "if (!variable_get('pifr_demo', FALSE)) {
   variable_set('pifr_demo', TRUE);
+  drupal_set_message('Copy of code avaiable as <a href=\"$basename.tar.gz\">tar.gz</a> or <a href=\"$basename.zip\">zip</a>.');
   drupal_goto(user_pass_reset_url(user_load(1)));
 }
 " . $placeholder, $contents);
     file_put_contents($this->checkout_directory . '/index.php', $contents);
 
-    if (!file_exists(file_directory_path() . '/demo')) {
-      mkdir(file_directory_path() . '/demo');
-    }
-
     // Move checkout to demo directory.
-    $demo_directory = file_directory_path() . '/demo/' . $this->unique_id;
-    mkdir($demo_directory);
     $this->exec('mv ' . $this->checkout_directory . '/* ' . $demo_directory);
   }
 }
