-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
55 lines (49 loc) · 1.12 KB
/
__init__.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
from __future__ import with_statement
from fabric.api import *
# Environments
from environments import *
# Submodules
import wp
import mysql as db
import git
import media
import webfaction
# Create tmp dirs
@task
def bootstrap():
with cd(env.dir):
run('mkdir -p %s' % env.mediadir)
run('mkdir -p %s' % env.tmpdir)
local('mkdir -p %s' % env.tmpdir)
# First run install - automatically triggered by 'deploy' if needed
@task
def setup():
execute(git.commit)
execute(git.push)
run('git clone %s %s' % (env.git, env.dir))
execute(bootstrap)
execute(wp.config)
#execute(wp.htaccess)
execute(media.push)
execute(db.push)
# Update local development from remote
@task
def pull():
#execute(git.commit_remote)
#execute(git.pull_remote)
#execute(git.push_remote)
execute(git.pull)
execute(media.pull)
execute(db.pull)
# Deploy the website
@task
def push():
with settings(warn_only=True):
if run('test -d %s/.git' % (env.dir)).failed:
if run('test -f %s/index.html' % (env.dir)).succeeded:
run('rm %s/index.html' % (env.dir))
execute(setup)
else:
execute(git.commit)
execute(git.push)
execute(git.pull_remote)