forked from mozilla/fireplace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
53 lines (42 loc) · 1.36 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
import os
import fabdeploytools.envs
from fabric.api import env, lcd, local, task
from fabdeploytools import helpers
import deploysettings as settings
env.key_filename = settings.SSH_KEY
fabdeploytools.envs.loadenv(settings.CLUSTER)
ROOT, FIREPLACE = helpers.get_app_dirs(__file__)
COMMONPLACE = '%s/node_modules/commonplace/bin/commonplace' % FIREPLACE
@task
def pre_update(ref):
with lcd(FIREPLACE):
local('git fetch')
local('git fetch -t')
local('git reset --hard %s' % ref)
@task
def update():
with lcd(FIREPLACE):
local('npm install')
local('npm install --force commonplace@0.3.2')
local('%s includes' % COMMONPLACE)
local('%s langpacks' % COMMONPLACE)
@task
def deploy():
helpers.deploy(name=settings.PROJECT_NAME,
app_dir='fireplace',
env=settings.ENV,
cluster=settings.CLUSTER,
domain=settings.DOMAIN,
root=ROOT)
@task
def pre_update_latest_tag():
current_tag_file = os.path.join(FIREPLACE, '.tag')
latest_tag = helpers.git_latest_tag(FIREPLACE)
with open(current_tag_file, 'r+') as f:
if f.read() == latest_tag:
print 'Environment is at %s' % latest_tag
else:
pre_update(latest_tag)
f.seek(0)
f.write(latest_tag)
f.truncate()