Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 79 lines (65 sloc) 2.092 kB
023face @moopet Initial commit
authored
1 #!/bin/bash
2
3 # Start up a Django coding session just the way I like it
4 # Assumes projects are in subfolders with the same name as the virtual environment
5 # if you're already in a VE you don't need to specify it on the command line
6
7 PROJECTS_PATH="/var/www/"
8
9 source virtualenvwrapper.sh
10 if [ $? -ne 0 ]; then
11 echo "$0: virtualenvwrapper.sh not found. Perhaps you should 'pip install virtualenv virtualenvwrapper' ?"
12 exit 1
13 fi
14
15 CURRENT_VE=${VIRTUAL_ENV##*/}
16 VE="${1:-$CURRENT_VE}"
0c196d9 @moopet Using basename instead of shell replacement for temporary file names
authored
17 RCFILE="/tmp/$(basename $0).$$"
023face @moopet Initial commit
authored
18
19 workon $VE 2>/dev/null
20
21 if [ $? -ne 0 ]; then
22 echo "Usage: $0 <virtual-env>"
23 echo "Available virtual environments:"
24 workon
25 exit 1
26 fi
27
28 cat >| $RCFILE.default <<RCDATA.default
29 #!/bin/bash
30 source ~/.bashrc
31 source virtualenvwrapper.sh
32 cd $PROJECTS_PATH/$VE
33 workon $VE
34 RCDATA.default
35
6a4fb4e @moopet fixing stupid error in example "runserver" tab
authored
36 cat >| $RCFILE.shell <<RCDATA.shell
023face @moopet Initial commit
authored
37 #!/bin/bash
38 source ~/.bashrc
39 source virtualenvwrapper.sh
40 cd $PROJECTS_PATH/$VE
41 workon $VE
42 python `find . -name manage.py` shell
43 RCDATA.shell
44
45 cat >| $RCFILE.runserver <<RCDATA.runserver
46 #!/bin/bash
47 source ~/.bashrc
48 source virtualenvwrapper.sh
49 cd $PROJECTS_PATH/$VE
50 workon $VE
51 python `find . -name manage.py` runserver 0.0.0.0:8000
52 RCDATA.runserver
53
54 cat >| $RCFILE.vcs <<RCDATA.vcs
55 #!/bin/bash
56 source ~/.bashrc
57 cd $PROJECTS_PATH/$VE
58 git status
59 RCDATA.vcs
60
61 cat >| $RCFILE.compass <<RCDATA.compass
62 #!/bin/bash
63 source ~/.bashrc
64 source virtualenvwrapper.sh
65 cd $PROJECTS_PATH/$VE/sass
66 compass watch
67 RCDATA.compass
68
69 if [ $? -ne 0 ]; then
70 echo "Couldn't save temporary bash rcfiles"
71 exit 1
72 fi
73
74 gnome-terminal --tab-with-profile="Default" --title="$VE" -e "bash --rcfile $RCFILE.default" \
75 --tab-with-profile="Default" --title="Compass/SASS" -e "bash --rcfile $RCFILE.compass" \
76 --tab-with-profile="Default" --title="Development Server" -e "bash --rcfile $RCFILE.runserver" \
77 --tab-with-profile="Default" --title="Django Shell" -e "bash --rcfile $RCFILE.shell" \
78 --tab-with-profile="Default" --title="Version Control" -e "bash --rcfile $RCFILE.vcs"
Something went wrong with that request. Please try again.