-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfabfile.py
52 lines (40 loc) · 1.3 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
from fabric.api import *
import fabric.contrib.project as project
import os
# Local path configuration (can be absolute or relative to fabfile)
env.deploy_path = 'output'
DEPLOY_PATH = env.deploy_path
# Local path configuration (can be absolute or relative to fabfile)
env.input_path = 'content'
INPUT_PATH = env.input_path
# Remote server configuration
production = '[email protected]'
dest_path = '/home/blog/public'
def clean():
if os.path.isdir(DEPLOY_PATH):
local('rm -rf {deploy_path}'.format(**env))
local('mkdir {deploy_path}'.format(**env))
def build():
local('pelican {input_path} -s pelicanconf.py'.format(**env))
def rebuild():
clean()
build()
def regenerate():
local('pelican {input_path} -r -s pelicanconf.py'.format(**env))
def serve():
local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env))
def reserve():
build()
serve()
def preview():
local('pelican {input_path} -s publishconf.py'.format(**env))
@hosts(production)
def publish():
local('pelican {input_path} -s publishconf.py'.format(**env))
project.rsync_project(
remote_dir=dest_path,
exclude=".DS_Store",
local_dir=DEPLOY_PATH.rstrip('/') + '/',
delete=True,
extra_opts='--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r',
)