Skip to content

Commit 7bed8ba

Browse files
added fabfile
1 parent f5534ff commit 7bed8ba

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.swp
2+
*.pyc
23
js/mobile.js
34
js/init_plot.js
45
css/mobile.css

fabfile.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from fabric.api import *
2+
3+
env.use_ssh_config = True
4+
env.hosts = ['kraken.habhub.org']
5+
6+
def get_user():
7+
env.user = prompt("Username to use?", default=env.user)
8+
9+
def stage_master():
10+
result = local('git branch', capture=True);
11+
12+
for line in result.split('\n'):
13+
if line[0] == '*':
14+
branch = line.split(' ')[1]
15+
break
16+
17+
if branch == "master":
18+
print "Already on master branch."
19+
return
20+
21+
local("git checkout master")
22+
local("git merge %s" % branch)
23+
local("git checkout %s" % branch)
24+
local("git push -f origin")
25+
local("git push -f ukhas")
26+
27+
def deploy():
28+
get_user();
29+
wd = "/var/www/habitat/mobile-tracker/"
30+
31+
with settings(warn_only=True):
32+
if run("test -d %s" % wd).failed:
33+
print "Cannot locate %s" % wd
34+
return
35+
36+
with cd(wd):
37+
run("git reset --hard")
38+
run("git pull")
39+
run("./build.sh")
40+
41+
def build():
42+
local("./build.sh")

0 commit comments

Comments
 (0)