Skip to content

Instantly share code, notes, and snippets.

@kernicPanel
Forked from vrde/bootstrap-myproject.sh
Created November 19, 2013 09:35
Show Gist options
  • Select an option

  • Save kernicPanel/7542750 to your computer and use it in GitHub Desktop.

Select an option

Save kernicPanel/7542750 to your computer and use it in GitHub Desktop.

Revisions

  1. @vrde vrde renamed this gist Nov 10, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @vrde vrde created this gist Nov 10, 2013.
    50 changes: 50 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    #!/bin/sh


    # Setup some variables needed for bootstrapping the environment
    ROOT=/home/vrde/projectz/myproject
    REPOS=${ROOT}/repos

    export PYTHONPATH=${REPOS}


    # Bootstrap a new session called "myproject"
    tmux new-session -d -s myproject


    # Rename the first window (using the session-name:id notation)
    tmux rename-window -t myproject:0 "backend"


    # Create and label three other windows, splitting the last one horizontally
    tmux new-window -t myproject:1 -n "frontend:server"
    tmux new-window -t myproject:2 -n "frontend:dev"
    tmux new-window -t myproject:3 -n "git"
    tmux split-window -h -t myproject:3



    # Send commands to the windows, use "C-m" to emulate "enter"

    # On window 1, Start the virtualenv and run the Python server.
    tmux send-keys -t myproject:1 "pew workon myproject" C-m
    tmux send-keys -t myproject:1 "cd ${REPOS}/myproject_web_client/server" C-m
    tmux send-keys -t myproject:1 "python server.py" C-m

    # On window 2, move to the directory with the source code for the client, and start Vim
    tmux send-keys -t myproject:2 "cd ${REPOS}/myproject_web_client/src" C-m
    tmux send-keys -t myproject:2 "vim" C-m

    # On window 3 setup Git. On the left launch an alias to watch the current tree, while...
    tmux send-keys -t myproject:3.left "cd ${REPOS}/myproject_web_client" C-m
    tmux send-keys -t myproject:3.left "git watchtree" C-m
    # on the right keep a shell to interact with Git
    tmux send-keys -t myproject:3.right "cd ${REPOS}/myproject_web_client" C-m
    tmux send-keys -t myproject:3.right "git status" C-m


    # Switch to window 0
    tmux select-window -t myproject:0

    # Force tmux to assume the terminal supports 256 colors and attach to the target session "myproject"
    tmux -2 attach-session -t myproject