You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB
Bash

#!/usr/bin/env bash
experiment=$1
dir=~/experiments/$experiment
if [[ ! -d $dir ]]; then
mkdir $dir
git clone https://github.com/h5bp/html5-boilerplate.git $dir
cd $dir
rm -rf .git
git init
git add .
git commit -m "inital commit"
cd -
fi
tmux has-session -t $experiment
if [[ $? == 0 ]]; then
tmux attach -t $experiment
exit
fi
tmux new-session -s $experiment -n editor -d
tmux split-window -h -t $experiment
tmux new-window -n console -t $experiment
tmux split-window -h -t $experiment:2
tmux split-window -v -t $experiment:2
tmux send-keys -t $experiment:1.1 "cd $dir" C-m
tmux send-keys -t $experiment:1.1 "vim index.html" C-m
tmux send-keys -t $experiment:1.2 "cd $dir" C-m
tmux send-keys -t $experiment:1.2 "git status" C-m
tmux send-keys -t $experiment:2.1 "cd $dir" C-m
tmux send-keys -t $experiment:2.1 "python -m SimpleHTTPServer" C-m
tmux send-keys -t $experiment:2.2 "cd $dir" C-m
tmux send-keys -t $experiment:2.2 "livereload" C-m
tmux send-keys -t $experiment:2.3 "cd $dir" C-m
tmux send-keys -t $experiment:2.3 "sleep 2" C-m
tmux send-keys -t $experiment:2.3 "chromium-browser http://localhost:8000 &" C-m
tmux select-window -t $experiment:1
tmux attach -t $experiment