Fix redundant and incorrect version comparison logic

This commit is contained in:
mengxun
2025-11-11 16:10:57 +08:00
parent ac2d6fd9ac
commit 64e3f0b424

14
install
View File

@@ -184,19 +184,7 @@ check_ruby_version() {
info 'Detecting Ruby environment...'
MIN_RUBY_VER='3.0'
if command_exists rvm; then
RUBY_VERSION=$(rvm current | cut -d'-' -f 2)
info "Ruby version ${RUBY_VERSION} is installed with RVM"
if RUBY_VERSION -lt MIN_RUBY_VER; then
fatal "Ruby version ${RUBY_VERSION} is not supported. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
elif command_exists rbenv; then
RUBY_VERSION=$(rbenv version | cut -d' ' -f 2)
info "Ruby version ${RUBY_VERSION} is installed with rbenv"
if RUBY_VERSION -lt MIN_RUBY_VER; then
fatal "Ruby version ${RUBY_VERSION} is not supported. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
elif command_exists ruby${RUBYSUFFIX}; then
if command_exists ruby${RUBYSUFFIX}; then
RUBY_VERSION=$(ruby${RUBYSUFFIX} -e "puts RUBY_VERSION")
info "Ruby version ${RUBY_VERSION} is installed"
if [ "$(ruby${RUBYSUFFIX} -e "puts RUBY_VERSION.to_f >= ${MIN_RUBY_VER}")" = 'false' ]; then