diff --git a/ronin-dev.sh b/ronin-dev.sh index becf0b5..70d0208 100755 --- a/ronin-dev.sh +++ b/ronin-dev.sh @@ -248,13 +248,15 @@ function auto_install_git() } # -# Installs ruby 3, if it's not installed. +# Installs ruby >= 3.1, if it's not installed. # function auto_install_ruby() { - # check if ruby-3.x is already installed - if [[ ! "$ruby_version" == "3."* ]]; then - log "Installing ruby 3.x ..." + # check if ruby >= 3.1 is already installed + if [[ -z "$ruby_version" ]] || + [[ "$ruby_version" == "2."* ]] || + [[ "$ruby_version" == "3.0."* ]]; then + log "Installing ruby >= 3.1 ..." case "$package_manager" in brew) homebrew_install_ruby ;; dnf|yum) install_packages ruby-devel ruby-bundled-gems ;; diff --git a/ronin-install.sh b/ronin-install.sh index 6f0342a..d69bc88 100755 --- a/ronin-install.sh +++ b/ronin-install.sh @@ -200,13 +200,15 @@ function install_packages() } # -# Installs ruby 3, if it's not installed. +# Installs ruby >= 3.1, if it's not installed. # function auto_install_ruby() { - # check if ruby-3.x is already installed - if [[ ! "$ruby_version" == "3."* ]]; then - log "Installing ruby 3.x ..." + # check if ruby >= 3.1 is already installed + if [[ -z "$ruby_version" ]] || + [[ "$ruby_version" == "2."* ]] || + [[ "$ruby_version" == "3.0."* ]]; then + log "Installing ruby >= 3.1 ..." case "$package_manager" in brew) homebrew_install_ruby ;; dnf|yum) install_packages ruby-devel ruby-bundled-gems ;; diff --git a/test/ronin_dev_test.sh b/test/ronin_dev_test.sh index 0e40734..043b534 100755 --- a/test/ronin_dev_test.sh +++ b/test/ronin_dev_test.sh @@ -27,10 +27,12 @@ function test_awk_installed() assertCommandInstalled "did not successfully install awk" 'awk' } -function test_ruby_3_x_installed() +function test_at_least_ruby_3_1_installed() { - # check if ruby-3.x is already installed - if [[ "$test_ruby_version" == "3."* ]]; then + # check if ruby >= 3.1.x is already installed + if [[ -n "$ruby_version" ]] && + [[ "$ruby_version" != "2."* ]] && + [[ "$ruby_version" != "3.0."* ]]; then return fi diff --git a/test/ronin_install_test.sh b/test/ronin_install_test.sh index b7ecf0a..4bae925 100755 --- a/test/ronin_install_test.sh +++ b/test/ronin_install_test.sh @@ -17,10 +17,12 @@ function test_make_installed() assertCommandInstalled "did not successfully install make" 'make' } -function test_ruby_3_x_installed() +function test_at_least_ruby_3_1_installed() { - # check if ruby-3.x is already installed - if [[ "$test_ruby_version" == "3."* ]]; then + # check if ruby >= 3.1 is already installed + if [[ -n "$ruby_version" ]] && + [[ "$ruby_version" != "2."* ]] && + [[ "$ruby_version" != "3.0."* ]]; then return fi