Skip to content

Instantly share code, notes, and snippets.

@jarednorman
Created February 22, 2016 08:08
Show Gist options
  • Save jarednorman/61e6e7d4b4ab0f4363d1 to your computer and use it in GitHub Desktop.
Save jarednorman/61e6e7d4b4ab0f4363d1 to your computer and use it in GitHub Desktop.
Teamocil Makes Your Life Better: Rails Edition

Teamocil Makes Your Life Better: Rails Edition

I've never worked for a product company, and I have lots of personal projects. Because of this, I find myself jumping between different projects constantly. I manage this by keeping up to date Teamocil profiles for each project I work on, and using a development tools that fit completely inside of a tmux session (with the exception of my web browser, of course.)

There are lots of kinds of projects where your tools can't all run inside of terminals. Because I work primarily on Rails projects, I get to live in my terminal most of the time.

Here's an example Teamocil configuration for a simple Rails project.

name: Project Name
windows:
  - name: editor
    root: ~/Codes/project_name
    focus: true
    layout: even-vertical
    panes:
      - commands:
          - clear && git status
        focus: true
  - name: server
    root: ~/Codes/project_name
    layout: even-vertical
    panes:
      - clear && bundle exec rails s -p 9876
  - name: logs
    root: ~/Codes/project_name
    layout: even-vertical
    panes:
      - clear && tail -f log/test.log
      - clear && tail -f log/development.log | grep -e "Started\|Rendered\|Completed\|Served"
      - clear && tail -f log/development.log | grep -e "SQL\|CACHE"

This gives me a window for running my editor (Vim), a window with my rails server, and then a window where I can see vertical splits showing important info from the logs.

Being able to monitor which SQL queries are being run, and the view lifecycle at glance comes in very handy when you're debugging an unexpected bug in an application.

For added convenience, I have them on in a private gist, so that on new machines I can run git clone [email protected]:REDACTED.git ~/.teamocil to get my up to date profiles.

For projects that require additional processes for development (like webpack) it's easy to add more windows or panes to handle those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment