Skip to content

Instantly share code, notes, and snippets.

@layerssss
Last active December 31, 2015 14:59
Show Gist options
  • Save layerssss/8003669 to your computer and use it in GitHub Desktop.
Save layerssss/8003669 to your computer and use it in GitHub Desktop.
use [zeus](https://github.com/burke/zeus) as a shim
# Usage:
#
# Paste these functions into your `.*shrc`, and re-open a new session. Then
# you can use `rails`, `rake`, `rspec` to launch their zeus equivalance. If you
# need to invoke a bash script contains those commands, you'll have to call it
# by `source xxxx.sh`.
#
# It works under rbenv. But not tested under rvm (rvm use shell functions, so it may
# not be compliant with these functions)
#
export rake() {
if [[ -S .zeus.sock ]]; then
echo using zeus!!!
if [[ $1 == "test" ]]; then
zeus "$@"
else
zeus rake "$@"
fi
else
command rake "$@"
fi
}
export rails() {
if [[ -S .zeus.sock ]]; then
echo using zeus!!!
zeus $@
else
command rails "$@"
fi
}
export rspec() {
if [[ -S .zeus.sock ]]; then
echo using zeus!!!
zeus test spec $@
else
command rspec "$@"
fi
}
export bundle() {
if [[ -S .zeus.sock && $1 == "exec" && ($2 == "rake" || $2 == "rails" || $2 == "rspec") ]]; then
shift
$@
else
command bundle "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment