Created
September 15, 2011 20:42
-
-
Save czue/1220420 to your computer and use it in GitHub Desktop.
Fabfile calling 7zip on windows
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
from datetime import datetime | |
from subprocess import Popen, PIPE, call | |
from fabric.api import * | |
from fabric.contrib.console import confirm | |
# use this instead of os.path.join since remote OS might differ from local | |
PATH_SEP = "/" | |
env.user = 'czue' | |
env.hosts = ['czue.org'] | |
def clean(): | |
try: | |
local("rmdir /q /s deploy") | |
except Exception: pass | |
def pack(): | |
clean() | |
local("mkdir deploy") | |
# www | |
call("7z a -ttar website.tar", shell=True, cwd="www") | |
call(r"move website.tar ..\deploy", shell=True, cwd="www") | |
call("7z a -tgzip website.tgz website.tar", shell=True, cwd="deploy") | |
#local('7z a -ttar website.tar ', capture=False) | |
#local('7z a -tgzip website.tgz website.tar', capture=False) | |
# django | |
call("7z a -ttar django.tar", shell=True, cwd="django") | |
call(r"move django.tar ..\deploy", shell=True, cwd="django") | |
call("7z a -tgzip django.tgz django.tar", shell=True, cwd="deploy") | |
def deploy(): | |
put('deploy/website.tgz', '/tmp/') | |
put('deploy/django.tgz', '/tmp/') | |
with cd('/var/www/czue/'): | |
sudo('tar xzf /tmp/website.tgz') | |
with cd('/var/django/'): | |
run('tar xzf /tmp/django.tgz') | |
sudo('/etc/init.d/apache2 reload') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment