-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
52 lines (40 loc) · 1.27 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
from fabric.api import *
import fabric.contrib.project as project
import os
env.build_path = 'output'
env.content_path = 'content'
env.production_serve = '/usr/local/data/www/ballroom'
env.alpha_serve = '/usr/local/data/www/ballroom/_alpha'
production = '[email protected]:22'
dest_path = '/usr/local/data/www/ballroom'
def clean():
if os.path.isdir(env.build_path):
local('rm -rf {build_path}'.format(**env))
local('mkdir {build_path}'.format(**env))
def build(settings='local'):
local('pelican {content_path} -s config/{settings}.py -o output'.format(settings=settings, **env))
def rebuild():
clean()
build()
def regenerate(settings='local'):
local('pelican {content_path} -r -s config/{settings}.py -o output'.format(settings=settings, **env))
def serve():
local('cd {build_path} && python -m SimpleHTTPServer'.format(**env))
def reserve():
build()
serve()
@hosts(production)
def publish(role='alpha'):
clean()
build(role)
project.rsync_project(
remote_dir=getattr(env, role+'_serve'),
local_dir=env.build_path.rstrip('/') + '/',
extra_opts='--omit-dir-times --no-perms',
exclude='_alpha',
delete=True
)
# put(
# env.build_path,
# dest_path
# )