-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
81 lines (67 loc) · 1.78 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import fabric.api as fab
import fabric.contrib.project as project
import os
import shutil
# Remote server configuration
# user@host:port
host = [ "user@url-or-ip-address:port_number" ]
# Local path configuration (can be absolute or relative to fabfile)
#local build path
fab.env.deploy_path = "output"
#my pelican theme static folder
fab.env.static_path = "korgi/static"
#beta deploy path on the webserver
fab.env.beta_dest_path = "/srv/public/test/chicagolug.org/"
#the live deploy path on the webserver
fab.env.live_dest_path = "/srv/public/chicagolug.org/"
def startdev():
"""
serve files locally via the development server
"""
fab.local("./develop_server.sh start")
def stopdev():
"""
stop the local development server
"""
fab.local("./develop_server.sh stop")
def clean():
"""
do a local cleanup
"""
if os.path.isdir(fab.env.deploy_path):
fab.local("rm -rf {deploy_path}".format(**fab.env))
fab.local("mkdir {deploy_path}".format(**fab.env))
def build():
"""
build the site locally
"""
clean()
fab.local("make html".format(**fab.env))
@fab.hosts(host)
def test():
"""
build and deploy the site to the test url
http://test.chicagolug.org
"""
build()
project.rsync_project(
remote_dir=fab.env.beta_dest_path,
#excluded files
exclude="",
local_dir=fab.env.deploy_path.rstrip("/") + "/",
delete=True
)
@fab.hosts(host)
def live():
"""
build and deploy the live site
http://chicagolug.org
"""
build()
project.rsync_project(
remote_dir=fab.env.live_dest_path,
#excluded files
exclude="",
local_dir=fab.env.deploy_path.rstrip("/") + "/",
delete=True
)