Created
September 20, 2010 23:47
-
-
Save wayneeseguin/588881 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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