diff --git a/lib/utils.sh b/lib/utils.sh index 6c6454d1921228fca7b7f5defcc01e882f0b272f..bf1b2dd517156b06a22bdb79a81a2a8109729bb4 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -11,13 +11,13 @@ ensure_ruby_build_setup() { } ensure_ruby_build_installed() { - echo "got here" + local ruby_build_version + if [ ! -f "$(ruby_build_path)" ]; then download_ruby_build else - local ruby_build_version="$("$(ruby_build_path)" --version | cut -d ' ' -f2)" - echo $ruby_build_version - if [ "$("$(ruby_build_path)" --version)" != "$RUBY_BUILD_VERSION" ]; then + current_ruby_build_version="$("$(ruby_build_path)" --version | cut -d ' ' -f2)" + if [ "$current_ruby_build_version" != "$RUBY_BUILD_VERSION" ]; then # If the ruby-build directory already exists and the version does not # match, remove it and download the correct version rm -rf "$(ruby_build_dir)" @@ -33,27 +33,21 @@ download_ruby_build() { # Clone down and checkout the correct ruby-build version git clone https://github.com/rbenv/ruby-build.git $build_dir >&2 >/dev/null - $(cd $build_dir; git checkout $RUBY_BUILD_TAG) + (cd $build_dir; git checkout $RUBY_BUILD_TAG >&2 >/dev/null) # Install in the ruby-build dir PREFIX="$(ruby_build_dir)" ./$build_dir/install.sh # Remove ruby-build source dir - rm -rf ruby-build-source + rm -rf $build_dir } ruby_build_dir() { - echo "$(dirname "$(dirname $0)")/ruby-build" + echo "$(dirname "$(dirname "$0")")/ruby-build" } ruby_build_path() { echo "$(ruby_build_dir)/bin/ruby-build" } #set_ruby_build_env() { -# local kerl_home -# kerl_home="$(dirname "$(dirname "$0")")/kerl-home" -# mkdir -p "$kerl_home" -# export KERL_BASE_DIR="$kerl_home" -# export KERL_BUILD_BACKEND="git" -# export KERL_CONFIG="$kerl_home/.kerlrc" #}