Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ronin-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down
10 changes: 6 additions & 4 deletions ronin-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down
8 changes: 5 additions & 3 deletions test/ronin_dev_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions test/ronin_install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading