dev.sh 1.51 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
# Script to setup few usual aliases to facilitate the development
# This aliases should work if you've installed memopol throught the quickstart
# script or the documentation
# It :
#   - Setup automaticaly the venv
#   - Setup Django in DEBUG mode
# You just need to add a line in you're .bashrc or .zshrc to load them:

REPOROOT="$( readlink -m "${BASH_SOURCE[0]}"/../..)"
ALIASROOT=$REPOROOT"/.memopol.alias"
echo $ALIASROOT
echo "Create a dedicated alias file in $ALIASROOT"
jaster's avatar
jaster committed
14
echo "alias memopol-code=\"cd $REPOROOT && source $REPOROOT/memopol_env/bin/activate && export DJANGO_DEBUG=True\"" > $ALIASROOT
15
echo "alias memopol-launch=\"memopol-code && memopol runserver\"" >> $ALIASROOT
16
echo "alias memopol-update-all=\"memopol-code && bin/update_all\"" >> $ALIASROOT
17
18
echo "alias memopol-refresh-scores=\"memopol-code && memopol refresh_scores\"" >> $ALIASROOT

jaster's avatar
jaster committed
19
20
case $SHELL in
*/bash)
21
22
	echo "Bash detected"
	echo "Update $HOME/.bashrc file"
jaster's avatar
jaster committed
23
24
25
26
27
28
29
30
	RCSHELL="$HOME/.bashrc"
	;;
*/zsh)
	echo "Zsh detected"
	echo "Update $HOME/.zshrc file"
	RCSHELL="$HOME/.zshrc"
	;;
*)
31
	echo "SHELL not supported.  Try using BASH or ZSH, or set alias manually."
32
	RCSHELL="/dev/null"
jaster's avatar
jaster committed
33
34
	;;
esac
35
36
37
38
39
40
41
42

echo "source $ALIASROOT" >> $RCSHELL
source $ALIASROOT


echo -e "You can use the following aliases :\n"
echo -e "\t memopol-code : Go into the repository and activate the virtualenv"
echo -e "\t memopol-launch : Run the development server"
43
echo -e "\t memopol-update-all : Get all the production data"
44
echo -e "\t memopol-refresh-scores : Refresh all scores"