Commit 9e819435 authored by Bodo Tasche's avatar Bodo Tasche Committed by Hakan Ensari
Browse files

Added bundler-exec plugin

parent 3552423d
# This plugin is based on https://github.com/gma/bundler-exec
# modify the BUNDLED_COMMANDS if needed
BUNDLED_COMMANDS=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork)
## Functions
bundler-installed()
{
which bundle > /dev/null 2>&1
}
within-bundled-project()
{
local dir="$(pwd)"
while [ "$(dirname $dir)" != "/" ]; do
[ -f "$dir/Gemfile" ] && return
dir="$(dirname $dir)"
done
false
}
run-with-bundler()
{
local command="$1"
shift
if bundler-installed && within-bundled-project; then
bundle exec $command "$@"
else
$command "$@"
fi
}
## Main program
for CMD in $BUNDLED_COMMANDS; do
alias $CMD="run-with-bundler $CMD"
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment