Skip to content

Commit 6719201

Browse files
committed
We still need to source chruby.sh for $CHRBUY_VERSION.
1 parent 6cdaefd commit 6719201

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

bin/chruby-exec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
22

3+
chruby_sh="${0%/*}/../share/chruby/chruby.sh"
4+
source "$chruby_sh"
5+
36
case "$1" in
47
-h|--help)
58
echo "usage: chruby-exec RUBY [RUBYOPTS] -- COMMAND [ARGS...]"
@@ -31,7 +34,6 @@ if (( $# == 0 )); then
3134
exit 1
3235
fi
3336

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

test/chruby_exec_test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@ function test_chruby_exec()
2121
assertEquals "did change the ruby" "$test_ruby_version" "$ruby_version"
2222
}
2323

24+
function test_chruby_exec_with_version()
25+
{
26+
local output=$(chruby-exec --version)
27+
28+
assertEquals "did not output the correct version" \
29+
"chruby version $CHRUBY_VERSION" \
30+
"$output"
31+
}
32+
2433
SHUNIT_PARENT=$0 . $SHUNIT2

0 commit comments

Comments
 (0)