-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathfabfile.py
51 lines (40 loc) · 1.15 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
"""
Simple deploy script to push the site contents from the local directory to the
server and then wax the varnish cache on the other side so I don't go into an
inhuman rage when trying to chase CSS issues.
"""
from fabric.api import *
LOCAL_SITE_DIR = 'site'
LOCAL_BUILD_DIR = 'site/_site'
REMOTE_PATH = '/home/jnoller'
DEPLOY_DIR = '%s/getpython3.com/htdocs' % REMOTE_PATH
env.hosts = ['getpython3.com']
env.user = 'jnoller'
@task
def nuke_cache():
run('echo "purge req.http.host ~ getpython3.com" | nc localhost 8181 -q 1')
@task
def push_site():
with lcd(LOCAL_BUILD_DIR):
local('tar -czf build.tgz *')
put('build.tgz', '%s/build.tgz' % DEPLOY_DIR)
with cd(DEPLOY_DIR):
run('tar -xzvf build.tgz')
run('rm -f build.tgz')
local('rm build.tgz')
@task
def push_amk():
with lcd(LOCAL_BUILD_DIR):
local('rsync -av --delete . [email protected]:~/py3.amk.ca/')
@task
def build_site():
site_dir = 'site'
with lcd(site_dir):
local('rm -rf _site')
local('blogofile build')
@task
def deploy():
build_site()
push_site()
nuke_cache()