Browse Source

Make bundler plugin run binstubbed cmd if existing

Helge Rausch 11 years ago
parent
commit
480ca22058
1 changed files with 9 additions and 1 deletions
  1. 9 1
      plugins/bundler/bundler.plugin.zsh

+ 9 - 1
plugins/bundler/bundler.plugin.zsh

@@ -47,9 +47,17 @@ _within-bundled-project() {
   false
   false
 }
 }
 
 
+_binstubbed() {
+  [ -f "./bin/${1}" ]
+}
+
 _run-with-bundler() {
 _run-with-bundler() {
   if _bundler-installed && _within-bundled-project; then
   if _bundler-installed && _within-bundled-project; then
-    bundle exec $@
+    if _binstubbed $1; then
+      bundle exec "./bin/$@"
+    else
+      bundle exec $@
+    fi
   else
   else
     $@
     $@
   fi
   fi