Source / demonstration /

Full commit
from __future__ import with_statement
from fabric.api import run, require, cd
import os


def system_installs():
  sudo('yum -y install python-setuptools')
  sudo('easy_install virtualenv')

def fresh_deploy(tld):

  # Make the top level directory to deploy the codespeed server to 
  run('rm -rf %s' % tld)
  run('mkdir -p %tld')

  # Set up a virtual python environment to install things into
  run('virtualenv %s/python' % tld)

  # Install mandatory components into the virtual environment
  run('%s/python/bin/easy_install django' % tld)
  run('%s/python/bin/easy_install South' % tld)
  # Continue regular deployment from this stage 

def deploy(tld):
  Perform the deployment assuming that the environment has been basically set up

  Useful in development to avoid re-downloading django and codespeed 
  all the time
  PYTHON = os.path.join(tld, 'python', 'bin', 'python')

  # Do a fresh creation of codespeed
  code_dir = "%s/%s" % (tld, 'codespeed_src')
  run('rm -rf %s' % code_dir)
  run('mkdir -p %s' % code_dir)

  with cd(code_dir):
    run('git clone %s' % CODESPEED_REPO_URL)

  codespeed_dir = '/'.join([code_dir, 'codespeed'])
  with cd(codespeed_dir):
    run('%s install' % PYTHON)
    run('cp -rf example demonstration')

  demonstration_dir = '/'.join([codespeed_dir, 'demonstration'])
  with cd(demonstration_dir):
    run('%s syncdb' % PYTHON)
    run('%s migrate' % PYTHON)

  #with cd(tld):
    #install codespeed
    #syncdb codespeed
    #migrate codespeed
    #set up codespeed db (create demo project values in codespeed)
    #execute submission script over demo data