-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetupkalite.py
50 lines (40 loc) · 1.71 KB
/
setupkalite.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
#!/bin/env python
import os
import subprocess
import sys
def git(*command):
try:
subprocess.call(['git'] + list(command))
except OSError as e:
if e.errno == os.errno.ENOENT: # git binary does not exist
print 'The git binary does not exist. Install that first.'
sys.exit(1)
else:
raise
def clone_repo(repo_name, username):
print 'Cloning %s onto the current directory' % repo_name
repo_url = '[email protected]:%s/%s.git' % (username, repo_name)
print 'Cloning %s' % repo_url
git('clone', repo_url)
print 'Great success cloning %s repo' % repo_name
def setup_repo(kalite_dir):
print 'Setting up the repo in %s' % kalite_dir
managepy = os.path.join(kalite_dir, 'manage.py')
subprocess.call(['python', managepy, 'setup', '--username=admin', '--password=pass', '--noinput'])
print 'Great success setting up %s' % kalite_dir
def setup_localsettings(kalite_dir):
with open(os.path.join(kalite_dir, "local_settings.py"), "w") as fp:
fp.write("DEBUG = True\n")
fp.write("CENTRAL_SERVER_HOST = '127.0.0.1:8000'\n")
fp.write("SECURESYNC_PROTOCOL = 'http'\n")
if __name__ == '__main__':
print "I'm assuming you've already forked the learningequality/ka-lite repo on GitHub"
username = raw_input('What is your github username?')
clone_repo('ka-lite', username)
os.chdir('ka-lite')
git('remote', 'add', 'upstream', '[email protected]:learningequality/ka-lite.git')
git('remote', 'add', 'bcipolli', '[email protected]:bcipolli/ka-lite.git')
git('remote', 'add', 'aronasorman', '[email protected]:aronasorman/ka-lite.git')
git('checkout', 'develop')
setup_repo('kalite')
setup_localsettings('kalite')