-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfabfile.py
More file actions
49 lines (41 loc) · 1012 Bytes
/
fabfile.py
File metadata and controls
49 lines (41 loc) · 1012 Bytes
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
from fabric.api import *
from fabric.contrib.project import rsync_project
from contextlib import contextmanager
import os.path
env.disable_known_hosts = True
env.root = "%s/_build/" % os.path.dirname(__file__)
if not env.shell:
env.shell = "/bin/bash -l -c"
env.user = 'anthony'
env.ssh_key = '~/.ssh/id_rsa.pub'
@task
@runs_once
def build():
'''Build config files'''
local('make build')
@task
def deploy():
'''Install files'''
sync()
@task
def sync():
'''Sync scripts to server'''
rsync_project(
'~/',
env.root,
exclude = [
".git*",
".git/*",
"fabfile.py",
]
)
@task
def ssh():
'''Add SSH authorized key'''
if not exists('.ssh/'):
run('mkdir .ssh')
put(env.ssh_key, '.ssh/authorized_keys')
def exists(path):
'''Same as the contrib.files.exists, only with a different test'''
with settings(hide('everything'), warn_only=True):
return not run("test -e %s" % path).failed