You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
791 B
Fish
33 lines
791 B
Fish
12 years ago
|
# The following is based on https://github.com/gma/bundler-exec
|
||
|
|
||
|
## Functions
|
||
|
function _bundler-installed
|
||
12 years ago
|
which bundle >/dev/null ^&1
|
||
12 years ago
|
end
|
||
|
|
||
|
function _within-bundled-project
|
||
|
set -l check_dir $PWD
|
||
|
while [ $check_dir != "/" ]
|
||
|
[ -f "$check_dir/Gemfile" ] and return
|
||
|
set check_dir (dirname $check_dir)
|
||
|
end
|
||
|
false
|
||
|
end
|
||
|
|
||
|
function _run-with-bundler
|
||
|
if _bundler-installed and _within-bundled-project
|
||
|
command bundle exec $argv
|
||
|
else
|
||
|
$argv
|
||
|
end
|
||
|
end
|
||
|
|
||
|
### Main program
|
||
|
set -l bundled_commands annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spinach spork thin thor unicorn unicorn_rails
|
||
|
|
||
|
for cmd in $bundled_commands
|
||
|
if not contains $cmd bundle gem
|
||
12 years ago
|
eval "function $cmd; _run-with-bundler $cmd \$argv;end"
|
||
12 years ago
|
end
|
||
|
end
|