-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.py
executable file
·48 lines (39 loc) · 1.65 KB
/
deploy.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
#!/usr/bin/python
import os
from subprocess import check_output, call
PROJECT_DIR = os.path.dirname(__file__)
STATIC_FILES_DIR = os.path.join(os.getcwd(), "heartbeat", "common", "static")
ENVIRON = [
'GMAIL_SMTP_USER',
'GMAIL_SMTP_PASSWORD',
'MEMCACHE_SERVERS',
'MEMCACHE_USERNAME',
'MEMCACHE_PASSWORD',
'MEMCACHIER_SERVERS',
'STRIPE_PROD_API_KEY',
'STRIPE_TEST_API_KEY',
]
print "Checking environ vars..."
for var in ENVIRON:
sts = check_output(["cd " + PROJECT_DIR + "; heroku config:get " + var], shell=True)
if sts is None or sts == '':
raise Exception('Undefined environ var: %s' % var)
print "Server has all environ vars"
print "Compiling js..."
call(['node', 'heartbeat/common/static/js/r.js', '-o', 'heartbeat/common/static/js/build.js'])
print "Compiling css..."
call(['lessc', 'heartbeat/common/static/css/application.less', 'heartbeat/common/static/built/application.css', '--compress'])
print "Compiling splash.js"
call(['node', 'heartbeat/common/static/js/r.js', '-o',
'name=heartbeat/common/static/splash',
'out=heartbeat/common/static/built/splash.min.js',
'include=heartbeat/common/static/js/libs/require/require'])
print "Pushing to github.."
call(['git', 'add', 'heartbeat/common/static/built/splash.min.js'])
call(['git', 'add', 'heartbeat/common/static/built/main-built.js'])
call(['git', 'add', 'heartbeat/common/static/built/application.css'])
call(['git', 'commit', '-m', '"Generated commit, built js and css"'])
call(['git', 'push', 'origin', 'master'])
print "Pushing to heroku.."
#call(['cd ' + PROJECT_DIR + '; git push heroku master'])
#call(['cd ' + PROJECT_DIR + '; heroku run ./manage.py migrate'])