Created
February 5, 2012 22:27
-
-
Save maximebf/1748208 to your computer and use it in GitHub Desktop.
Fabfile to deploy a jekyll site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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