60e104acd1710c04057d079cfa5ac9316762f580

Author
Hakan Ensari <hakan.ensari@papercavalier.com>
Committer
Hakan Ensari <hakan.ensari@papercavalier.com>
Date

Message

merge bundler and bundle-exec plugins

Diff

 1diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh
 2deleted file mode 100644
 3index 3417ea81cdc658b55120cb7136093665e43c4792..0000000000000000000000000000000000000000
 4--- a/plugins/bundler-exec/bundler-exec.plugin.zsh
 5+++ /dev/null
 6@@ -1,34 +0,0 @@
 7-# This plugin is based on https://github.com/gma/bundler-exec
 8-# modify the bundled_commands if needed
 9-
10-bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
11-
12-## Functions
13-
14-_bundler-installed() {
15-  which bundle > /dev/null 2>&1
16-}
17-
18-_within-bundled-project() {
19-  local check_dir=$PWD
20-  while [ "$(dirname $check_dir)" != "/" ]; do
21-    [ -f "$check_dir/Gemfile" ] && return
22-    check_dir="$(dirname $check_dir)"
23-  done
24-  false
25-}
26-
27-_run-with-bundler() {
28-  local command="$1"
29-  shift
30-  if _bundler-installed && _within-bundled-project; then
31-    bundle exec $command "$@"
32-  else
33-    $command "$@"
34-  fi
35-}
36-
37-## Main program
38-for cmd in $bundled_commands; do
39-  alias $cmd="_run-with-bundler $cmd"
40-done
41diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
42index fb40e2cec10dc79da5875c660d18d70d4ee9ac10..fcf3e85fc5a4484ee6e38a5338fec03e4f9810d9 100644
43--- a/plugins/bundler/bundler.plugin.zsh
44+++ b/plugins/bundler/bundler.plugin.zsh
45@@ -1,3 +1,37 @@
46 alias be="bundle exec"
47 alias bi="bundle install"
48 alias bu="bundle update"
49+
50+# The following is based on https://github.com/gma/bundler-exec
51+
52+bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
53+
54+## Functions
55+
56+_bundler-installed() {
57+  which bundle > /dev/null 2>&1
58+}
59+
60+_within-bundled-project() {
61+  local check_dir=$PWD
62+  while [ "$(dirname $check_dir)" != "/" ]; do
63+    [ -f "$check_dir/Gemfile" ] && return
64+    check_dir="$(dirname $check_dir)"
65+  done
66+  false
67+}
68+
69+_run-with-bundler() {
70+  local command="$1"
71+  shift
72+  if _bundler-installed && _within-bundled-project; then
73+    bundle exec $command "$@"
74+  else
75+    $command "$@"
76+  fi
77+}
78+
79+## Main program
80+for cmd in $bundled_commands; do
81+  alias $cmd="_run-with-bundler $cmd"
82+done