This repository has been archived by the owner on Jan 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathfabfile.py
70 lines (51 loc) · 1.81 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
import sys
import manage
from fabric.api import run, local, env, get, prompt, sudo
from fabric.colors import yellow
from fabric.contrib import console, django
from fabric.context_managers import lcd
django.settings_module('popcorn_gallery.settings')
from django.conf import settings
def test(*args):
"""Run the tests locally takes a list of apps to test as arguments"""
os.environ['FORCE_DB'] = '1'
print yellow('Runing tests')
with lcd(settings.PROJECT_ROOT):
local('python manage.py test --noinput '
'--settings=popcorn_gallery.settings.test')
def update_npm():
print yellow('Updating npm')
with lcd(os.path.join(settings.PROJECT_ROOT, 'butter')):
local('npm install')
local('npm update')
def compile_butter():
print yellow('Compiling Butter files.')
with lcd(os.path.join(settings.PROJECT_ROOT, 'butter')):
local('VERSION=0.5 node make release')
copy_butter()
def syncdb():
print yellow('Syncing the database')
with lcd(settings.PROJECT_ROOT):
local('python manage.py syncdb --noinput')
local('python manage.py migrate --noinput')
def copy_butter():
print yellow('Coping Butter styling')
with lcd(settings.PROJECT_ROOT):
local('cp -r butter/dist/* assets/dist/')
local('cp butter/dist/*.css assets/css/')
local('cp butter/dist/*.js assets/js/')
def update_index():
print yellow('Updating search index')
with lcd(settings.PROJECT_ROOT):
local('python manage.py update_index')
def update():
print yellow('Updating the site:')
syncdb()
compile_butter()
update_index()
def collectstatic():
compile_butter()
print yellow('Collecting static files.')
with lcd(settings.PROJECT_ROOT):
local('python manage.py collectstatic --noinput')