Created
September 28, 2011 22:12
-
-
Save snahor/1249404 to your computer and use it in GitHub Desktop.
fabfile example
This file contains 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
import os | |
from fabric.api import * | |
env.user = '' | |
env.hosts = [''] | |
env.password = '' | |
LOCAL_PATH = os.path.abspath('.') | |
SERVER_PATH = '' | |
def upload(prefix='', archive='src'): | |
archive = '%s.tar.bz2' % archive | |
server_base_path = SERVER_PATH | |
local( | |
'git archive --prefix=%(prefix)s/ HEAD | bzip2 > %(archive)s' % { | |
'prefix': prefix, | |
'archive': archive | |
} | |
) | |
put(archive, '%s/%s' % (server_base_path, 'src.tar.bz2')) | |
with cd(server_base_path): | |
run('tar xf %s' % archive) | |
run('rm -rf %s' % archive) | |
local('rm -rf %s' % archive) | |
def cp(name, dest=None): | |
if not dest: | |
dest = SERVER_PATH + "/%s" % name | |
put(LOCAL_PATH + "/%s" % name, dest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment