... | ... |
@@ -6,29 +6,29 @@ bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgu |
6 | 6 |
## Functions |
7 | 7 |
|
8 | 8 |
_bundler-installed() { |
9 |
- which bundle > /dev/null 2>&1 |
|
9 |
+ which bundle > /dev/null 2>&1 |
|
10 | 10 |
} |
11 | 11 |
|
12 | 12 |
_within-bundled-project() { |
13 |
- local check_dir=$PWD |
|
14 |
- while [ "$(dirname $check_dir)" != "/" ]; do |
|
15 |
- [ -f "$check_dir/Gemfile" ] && return |
|
16 |
- check_dir="$(dirname $check_dir)" |
|
17 |
- done |
|
18 |
- false |
|
13 |
+ local check_dir=$PWD |
|
14 |
+ while [ "$(dirname $check_dir)" != "/" ]; do |
|
15 |
+ [ -f "$check_dir/Gemfile" ] && return |
|
16 |
+ check_dir="$(dirname $check_dir)" |
|
17 |
+ done |
|
18 |
+ false |
|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
_run-with-bundler() { |
22 |
- local command="$1" |
|
23 |
- shift |
|
24 |
- if _bundler-installed && _within-bundled-project; then |
|
25 |
- bundle exec $command "$@" |
|
26 |
- else |
|
27 |
- $command "$@" |
|
28 |
- fi |
|
22 |
+ local command="$1" |
|
23 |
+ shift |
|
24 |
+ if _bundler-installed && _within-bundled-project; then |
|
25 |
+ bundle exec $command "$@" |
|
26 |
+ else |
|
27 |
+ $command "$@" |
|
28 |
+ fi |
|
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
## Main program |
32 | 32 |
for cmd in $bundled_commands; do |
33 |
- alias $cmd="_run-with-bundler $cmd" |
|
33 |
+ alias $cmd="_run-with-bundler $cmd" |
|
34 | 34 |
done |