Skip to content

Commit

Permalink
We still need to source chruby.sh for $CHRBUY_VERSION.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Dec 30, 2014
1 parent 6cdaefd commit 6719201
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/chruby-exec
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

chruby_sh="${0%/*}/../share/chruby/chruby.sh"
source "$chruby_sh"

case "$1" in
-h|--help)
echo "usage: chruby-exec RUBY [RUBYOPTS] -- COMMAND [ARGS...]"
Expand Down Expand Up @@ -31,7 +34,6 @@ if (( $# == 0 )); then
exit 1
fi

chruby_sh="${0%/*}/../share/chruby/chruby.sh"
source_command="command -v chruby >/dev/null || source $chruby_sh"
command="$source_command; chruby $(printf "%q " "${argv[@]}") && $(printf "%q " "$@")"

Expand Down
9 changes: 9 additions & 0 deletions test/chruby_exec_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@ function test_chruby_exec()
assertEquals "did change the ruby" "$test_ruby_version" "$ruby_version"
}

function test_chruby_exec_with_version()
{
local output=$(chruby-exec --version)

assertEquals "did not output the correct version" \
"chruby version $CHRUBY_VERSION" \
"$output"
}

SHUNIT_PARENT=$0 . $SHUNIT2

0 comments on commit 6719201

Please sign in to comment.