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
1 change: 1 addition & 0 deletions .github/ruby-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"4.0.4",
"4.0.3",
"4.0.2",
"4.0.1",
Expand Down
2 changes: 1 addition & 1 deletion features/src/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ When using `mise`, this feature keeps `ruby.compile=true` by default so Ruby is

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | The version of ruby to be installed | string | 4.0.3 |
| version | The version of ruby to be installed | string | 4.0.4 |
| versionManager | The version manager to use for Ruby (mise or rbenv) | string | mise |
| usePrecompiledRubies | Use precompiled Rubies with mise when available | boolean | false |

Expand Down
4 changes: 2 additions & 2 deletions features/src/ruby/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "ruby",
"version": "2.2.1",
"version": "2.2.2",
"name": "Ruby",
"description": "Installs Ruby and a version manager (mise or rbenv) along with libraries needed to build Ruby.",
"documentationURL": "https://github.com/rails/devcontainer/tree/main/features/src/ruby",
Expand All @@ -19,7 +19,7 @@
"options": {
"version": {
"type": "string",
"default": "4.0.3",
"default": "4.0.4",
"description": "The ruby version to be installed"
},
"versionManager": {
Expand Down
21 changes: 17 additions & 4 deletions features/src/ruby/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,26 @@ setup_rbenv() {
add_to_shell_init "$_user" 'eval "$(rbenv init -)"'
}

run_ruby_install_command() {
_user="$1"
_version="$2"
_command="$3"

_configure_opts=""
if [ "$_version" = "4.0.4" ]; then
_configure_opts="RUBY_CONFIGURE_OPTS='--disable-install-doc' "
fi

su "$_user" -c "${_configure_opts}${_command}"
}

# Function to install Ruby with rbenv
install_ruby_rbenv() {
_user="$1"
_version="$2"

su "$_user" -c "/usr/local/share/rbenv/bin/rbenv install $_version"
su "$_user" -c "/usr/local/share/rbenv/bin/rbenv global $_version"
run_ruby_install_command "$_user" "$_version" "/usr/local/share/rbenv/bin/rbenv install \"$_version\""
su "$_user" -c "/usr/local/share/rbenv/bin/rbenv global \"$_version\""
}

# Function to setup mise
Expand Down Expand Up @@ -114,8 +127,8 @@ install_ruby_mise() {
_home_dir="/home/$_user"
fi

su "$_user" -c "$_home_dir/.local/bin/mise install ruby@$_version"
su "$_user" -c "$_home_dir/.local/bin/mise use -g ruby@$_version"
run_ruby_install_command "$_user" "$_version" "$_home_dir/.local/bin/mise install \"ruby@$_version\""
su "$_user" -c "$_home_dir/.local/bin/mise use -g \"ruby@$_version\""
su "$_user" -c "$_home_dir/.local/bin/mise settings add idiomatic_version_file_enable_tools ruby"
}

Expand Down
2 changes: 1 addition & 1 deletion features/test/ruby/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ check "mise init is sourced in the bashrc" bash -c "grep 'eval \"\$(~/.local/bin
check "mise is configured to compile Ruby from source by default" bash -c "mise settings | grep ruby.compile | grep true"
check "mise idiomatic version file is enabled for ruby" bash -c "mise settings | grep idiomatic_version_file_enable_tools | grep ruby"
check "Ruby is installed with YJIT" bash -c "RUBY_YJIT_ENABLE=1 ruby -v | grep +YJIT"
check "Ruby version is set to 4.0.3" bash -c "mise use -g ruby | grep 4.0.3"
check "Ruby version is set to 4.0.4" bash -c "mise use -g ruby | grep 4.0.4"

reportResults
2 changes: 1 addition & 1 deletion features/test/ruby/with_precompiled_rubies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ check "mise is installed" bash -c "mise --version"
check "mise uses precompiled Rubies when enabled" bash -c "mise settings | grep ruby.compile | grep false"
check "mise idiomatic version file is enabled for ruby" bash -c "mise settings | grep idiomatic_version_file_enable_tools | grep ruby"
check "Ruby is installed with YJIT" bash -c "RUBY_YJIT_ENABLE=1 ruby -v | grep +YJIT"
check "Ruby version is set to 4.0.3" bash -c "mise use -g ruby | grep 4.0.3"
check "Ruby version is set to 4.0.4" bash -c "mise use -g ruby | grep 4.0.4"

reportResults
2 changes: 1 addition & 1 deletion features/test/ruby/with_rbenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ check "rbenv is installed" bash -c "rbenv --version"
check "ruby-build is installed" bash -c "ls -l $HOME/.rbenv/plugins/ruby-build | grep '\-> /usr/local/share/ruby-build'"
eval "$(rbenv init -)"
check "Ruby is installed with YJIT" bash -c "RUBY_YJIT_ENABLE=1 ruby -v | grep +YJIT"
check "Ruby version is set to 4.0.3" bash -c "rbenv global | grep 4.0.3"
check "Ruby version is set to 4.0.4" bash -c "rbenv global | grep 4.0.4"

reportResults