forked from txenoo/django-radio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
executable file
·50 lines (35 loc) · 1.27 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
from fabric.api import env, local, require
env.heroku_project_name = 'radioco'
env.python = 'python2.7'
env.heroku_config_path = 'radio/configs/heroku'
def quickstart():
local('python manage.py migrate')
local('python manage.py create_example_data')
local('python manage.py runserver')
def master():
env.branch = 'master'
def branch(branch_name):
env.branch = branch_name
def checkout_latest():
local('git pull')
def heroku_setup():
local('heroku login')
local('heroku create %(heroku_project_name)s' % env)
local('git init')
local('heroku git:remote -a %(heroku_project_name)s' % env)
def save_changes():
# Add files
local('git add .')
# Add local settings excluded on gitignore
local('git add -f radio/configs/common/local_settings.py')
local('git add -f radio/configs/development/local_settings.py')
local('git add -f radio/configs/heroku/local_settings.py')
# Commit all
local('git commit -am "autocommit: save changes"')
def heroku_deploy():
# Require branch
require('branch', provided_by=[master, branch])
# Deploy changes
local('git push heroku %(branch)s' % env)
# Install requirements and run migrations
local('heroku run "python %(heroku_config_path)s/manage.py migrate"' % env)