Skip to content

Instantly share code, notes, and snippets.

@jmvrbanac
Created February 10, 2014 16:27
Show Gist options
  • Save jmvrbanac/8919133 to your computer and use it in GitHub Desktop.
Save jmvrbanac/8919133 to your computer and use it in GitHub Desktop.
CAFE Tmux setup
#!/bin/bash
BASEDIR="/home/john/Repositories/github/CAFE"
VENV_NAME="CloudCAFE"
PROJECT="CAFE-Dev"
set_env_and_clear(){
num_panes=`tmux list-panes -t $PROJECT:$1 | wc -l`
for (( i=0; i<${num_panes}; i++ ));
do
tmux send-keys -t$PROJECT:$1.$i "workon $VENV_NAME && clear" C-m
done
}
tmux start-server
tmux has-session -t $PROJECT &> /dev/null
if [ $? != 0 ]
then
tmux new-session -d -s $PROJECT -n Repl
tmux new-window -t$PROJECT:1 -d -n "OpenCAFE" -c "$BASEDIR/opencafe"
tmux new-window -t$PROJECT:2 -d -n "CloudCAFE" -c "$BASEDIR/cloudcafe"
tmux new-window -t$PROJECT:3 -d -n "CloudRoast" -c "$BASEDIR/cloudroast"
tmux new-window -t$PROJECT:4 -d -n "OpenCAFE Docs" -c "$BASEDIR/opencafe/docs"
tmux split-window -d -v -t$PROJECT:4 -c "$BASEDIR/opencafe/docs"
# Make sure all windows are in venv
for i in {0..4}
do
set_env_and_clear $i
done
# Other Commands
tmux send-keys -t$PROJECT:0 "cd $BASEDIR/opencafe && ipython" C-m
tmux send-keys -t$PROJECT:4.1 "sphinx-serve" C-m
fi
tmux attach -t $PROJECT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment