Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Created September 20, 2010 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wayneeseguin/588881 to your computer and use it in GitHub Desktop.
Save wayneeseguin/588881 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Author: Wayne E. Seguin (wayneeseguin@gmail.com)
#
# I like the sound of 'work_on', however you can name this
# function anything that makes it easier for you to think.
#
work_on ()
{
# We are expecting project name to be the first parameter
local project="${1:-""}";
(
# If you are using RVM as a user, make sure that the
# default ruby is loaded in the current environment
if [[ -s "$HOME/.rvm/environments/default" ]] ; then
source "$HOME/.rvm/environments/default";
fi
# Ensure that the terminitor gem is installed
# into the current ruby environment.
if ! command -v terminitor > /dev/null; then
gem install terminitor --no-rdoc --no-ri
if [[ ! -d "$HOME/.terminitor" ]] ; then
# Terminitor has not been setup yet, set it up!
terminitor setup
fi
fi
if [[ -f "$HOME/.terminitor/$project.yml" ]] ; then
# If the project exists, start working on it!
terminitor start "$project"
else
# If the project does not exist,
# open a new project definition in your editor.
terminator open "$project"
fi
)
return $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment