c925aabea9b8b0578735fab4c75bec86e4d20f16

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #2885 from tsujigiri/bundler/run_binstubbed

Make bundler plugin run binstubbed cmd if existing

Diff

 1diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 2index 20931dcefb2c942096455f44225fb276581bf06b..fbdbc02447e30f4eb2732dffba9f86cac34edbf2 100644
 3--- a/plugins/bundler/bundler.plugin.zsh
 4+++ b/plugins/bundler/bundler.plugin.zsh
 5@@ -48,9 +48,17 @@ _within-bundled-project() {
 6   false
 7 }
 8 
 9+_binstubbed() {
10+  [ -f "./bin/${1}" ]
11+}
12+
13 _run-with-bundler() {
14   if _bundler-installed && _within-bundled-project; then
15-    bundle exec $@
16+    if _binstubbed $1; then
17+      bundle exec "./bin/$@"
18+    else
19+      bundle exec $@
20+    fi
21   else
22     $@
23   fi