Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (36 sloc) 1.02 KB
Generic fabfile for my "static" web sites hosted on TextDrive. Knows how to
bootstrap and deploy those sites.
* We're operating in a directory with the same name as the web site
* The github repo for the site has the same name as well
from fabric.api import env, local, run, task
env.hosts = ['']
env.use_ssh_config = True
TARGET_DIR = '/var/www/'
def ensure_target():
run('mkdir -p {}'.format(TARGET_DIR))
def deploy():
"""Build and deploy a new version of the site."""
src = 'dist/'
dst = '{}:{}'.format(env.hosts[0], TARGET_DIR)
if not dst.endswith('/'):
dst = dst + '/'
cmd = 'rsync --verbose --progress --recursive --delete {} {}'.format(
src, dst)
def build():
"""Build a new index.html page from the Python docs."""
local('cp -r resources dist')
local('./ > dist/index.html')
def clean():
"""Clean up after a build."""
local('rm -rf dist')