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