Skip to content

Instantly share code, notes, and snippets.

@maximebf maximebf/fabfile.py
Created Feb 5, 2012

Embed
What would you like to do?
Fabfile to deploy a jekyll site
from fabric.api import task, run, env, execute, local, put, lcd
env.site_path = '/tmp/jekyll-site'
env.tar_filename = env.site_path + '.tar.bz2'
env.remote_site_path = '~/public_html'
@task
def build():
local("jekyll %s" % env.site_path)
with lcd(env.site_path):
local('tar cjf %s *' % env.tar_filename)
local("rm -r %s" % env.site_path)
@task
def push():
run('mkdir -p %s' % env.remote_site_path)
put(env.tar_filename, env.tar_filename)
run('tar xjf %s -C %s' % (env.tar_filename, env.remote_site_path))
run('rm %s' % env.tar_filename)
@task
def deploy():
execute(build)
execute(push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.