<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Capfile</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -20,7 +20,7 @@ If anything goes wrong, ask the mailing list (lists.zenadmin.org) or read the co
 
 
 =end
-
+require 'erb'
 load File.join(File.dirname(__FILE__), 'deploy_config')
 
 #================= ADVANCED SETTINGS =============#
@@ -40,22 +40,38 @@ set :apache2_static,        []
 
 # helper
 set :in_current, &quot;cd #{deploy_to}/current &amp;&amp;&quot;
+class RenderClass
+  def initialize(path)
+    @text = File.read(path)
+  end
+  
+  def render(hash)
+    @values = hash
+    ERB.new(@text).result(binding)
+  end
+  
+  def method_missing(sym)
+    return @values[sym] if @values.has_key?(sym)
+    super
+  end
+end
+
+def render(file, hash)
+  RenderClass.new(file).render(hash)
+end
 
 #========================== SOURCE CODE   =========================#
+
+
 desc &quot;set permissions to www-data&quot;
 task :set_permissions, :roles =&gt; :app do
   run &quot;chown -R www-data:www-data #{deploy_to}&quot;
   run &quot;chown -R www-data:www-data /var/www/zena&quot;
 end
 
-desc &quot;push local changes by doing an svk checkin and updating code&quot;
-task :push, :roles =&gt; :app do
-  system &quot;svk st &amp;&amp; svk ci&quot;
-  if $? == 0
-    update_current
-  else
-    puts &quot;  - abort&quot;
-  end
+&quot;Update the currently released version of the software directly via an SCM update operation&quot; 
+task :update_current do 
+  source.sync(revision, self[:release_path]) 
 end
 
 desc &quot;clear all zafu compiled templates&quot;
@@ -69,24 +85,17 @@ task :clear_cache, :roles =&gt; :app do
 end
 
 desc &quot;after code update&quot;
-task :after_update_code, :roles =&gt; :app do
-  symlink
+task :after_update, :roles =&gt; :app do
   app_update_symlinks
+  db_update_config
   clear_zafu
   clear_cache
-  db_update_config
   migrate
 end
 
-desc &quot;after current code update&quot;
-task :after_update_current, :roles =&gt; :app do
-  after_update_code
-  restart
-end
-
-desc &quot;update symlinks&quot;
+desc &quot;update symlink to 'sites' directory&quot;
 task :app_update_symlinks, :roles =&gt; :app do
-  run &quot;rm -rf #{deploy_to}/current/sites&quot;
+  run &quot;rm #{deploy_to}/current/sites || true&quot;
   run &quot;ln -sf /var/www/zena #{deploy_to}/current/sites&quot;
   set_permissions
 end
@@ -102,6 +111,7 @@ task :app_setup, :roles =&gt; :app do
   run &quot;test -e /var/www/zena || mkdir /var/www/zena&quot;
   setup
 end
+
 #========================== MANAGE HOST   =========================#
 desc &quot;create a new site&quot;
 task :mksite, :roles =&gt; :app do
@@ -110,6 +120,15 @@ task :mksite, :roles =&gt; :app do
   set_permissions
 end
 
+desc &quot;update code in the current version&quot;
+task :up, :roles =&gt; :app do
+  run &quot;cd #{deploy_to}/current &amp;&amp; svn up&quot;
+  db_update_config
+  clear_zafu
+  clear_cache
+  migrate
+  restart
+end
 
 #========================== MONGREL ===============================#
 desc &quot;configure mongrel&quot;
@@ -227,18 +246,6 @@ task :db_dump, :roles =&gt; :db do
   run &quot;#{in_current} rm #{db_name}.sql&quot;
 end
 
-# taken from : http://source.mihelac.org/articles/2007/01/11/capistrano-get-method-download-files-from-server
-# Get file remote_path from FIRST server targetted by
-# the current task and transfer it to local machine as path, SFTP required
-def actor.get(remote_path, path, options = {})
-  execute_on_servers(options) do |servers|
-    self.sessions[servers.first].sftp.connect do |tsftp|
-      logger.info &quot;Get #{remote_path} to #{path}&quot; 
-      tsftp.get_file remote_path, path
-    end
-  end
-end
-
 desc &quot;Get backup file back&quot;
 task :get_backup, :roles =&gt; :app do
   get &quot;#{deploy_to}/current/#{db_name}_data.tgz&quot;, &quot;./#{db_name}_#{Time.now.strftime '%Y-%m-%d-%H'}.tgz&quot;</diff>
      <filename>config/deploy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -43,7 +43,7 @@
   &lt;/DirectoryMatch&gt;
   
   RewriteEngine On
-  &lt;% if options[:debug_rewrite] %&gt;
+  &lt;% if debug_rewrite %&gt;
   # rewrite debugging
   RewriteLog /var/www/zena/&lt;%= host %&gt;/log/rewrite.log
   RewriteLogLevel 9 
@@ -65,7 +65,7 @@
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteRule ^/(.*)$ balancer://&lt;%= balancer %&gt;%{REQUEST_URI} [P,QSA,L]
   
-  &lt;% if options[:deflate] %&gt;
+  &lt;% if deflate %&gt;
   # Deflate (compress data before sending to browser)
   AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
   BrowserMatch ^Mozilla/4 gzip-only-text/html
@@ -73,7 +73,7 @@
   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
   &lt;% end %&gt;
   
-  &lt;% if options[:debug_deflate] &amp;&amp; option[:deflate] %&gt;
+  &lt;% if debug_deflate &amp;&amp; deflate %&gt;
   # Deflate debugging
   DeflateFilterNote Input input_info
   DeflateFilterNote Output output_info</diff>
      <filename>config/vhost.rhtml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f7a88640de039d413857f93f170877dda09ff129</id>
    </parent>
  </parents>
  <author>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </author>
  <url>http://github.com/zena/zena/commit/37e7e90f3a49d319ee6cc9ba83fae908ea8df49e</url>
  <id>37e7e90f3a49d319ee6cc9ba83fae908ea8df49e</id>
  <committed-date>2008-01-28T07:29:53-08:00</committed-date>
  <authored-date>2008-01-28T07:29:53-08:00</authored-date>
  <message>Modified capistrano tasks to work with capistrano 2. This means you now have to use 'cap up' instead of 'cap update_current'. The other tasks should work fine.


git-svn-id: svn://svn.zenadmin.org/zena/trunk@827 aaa19a3b-e121-0410-9d45-962fd44e537e</message>
  <tree>2c17b1f7cec163ff32c20b5ea4d2da80a1616819</tree>
  <committer>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </committer>
</commit>
