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
2 changes: 2 additions & 0 deletions .github/ruby-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"4.0.1",
"4.0.0",
"3.4.8",
"3.4.7",
Expand All @@ -20,6 +21,7 @@
"3.3.2",
"3.3.1",
"3.3.0",
"3.2.10",
"3.2.9",
"3.2.8",
"3.2.7",
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 @@ -40,7 +40,7 @@ Installs Ruby and a version manager (mise or rbenv) along with the dependencies

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | The version of ruby to be installed | string | 4.0.0 |
| version | The version of ruby to be installed | string | 4.0.1 |
| versionManager | The version manager to use for Ruby (mise or rbenv) | string | mise |

## Customizations
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.1.2",
"version": "2.1.3",
"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.0",
"default": "4.0.1",
"description": "The ruby version to be installed"
},
"versionManager": {
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 @@ -8,6 +8,6 @@ check "mise is installed" bash -c "mise --version"
check "mise init is sourced in the bashrc" bash -c "grep 'eval \"\$(~/.local/bin/mise activate bash)\"' $HOME/.bashrc"
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.0" bash -c "mise use -g ruby | grep 4.0.0"
check "Ruby version is set to 4.0.1" bash -c "mise use -g ruby | grep 4.0.1"

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.0" bash -c "rbenv global | grep 4.0.0"
check "Ruby version is set to 4.0.1" bash -c "rbenv global | grep 4.0.1"

reportResults
3 changes: 2 additions & 1 deletion lib/add_ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def read_json(relative_path)
end

def write_json(relative_path, data)
File.write(path_for(relative_path), JSON.pretty_generate(data) + "\n")
json = JSON.pretty_generate(data, indent: " ")
File.write(path_for(relative_path), json + "\n")
end

def current_default_version
Expand Down
6 changes: 6 additions & 0 deletions test/add_ruby_version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def test_adds_version_to_json_file
assert_includes versions, "3.4.0", "New version should be added to JSON"
assert_includes versions, "3.3.0", "Existing versions should be preserved"
assert_includes versions, "3.2.0", "Existing versions should be preserved"

content = File.read(File.join(@temp_dir, ".github/ruby-versions.json"))
assert_match(/^ "3\.4\.0"/, content, "Should use 4-space indentation")
end

def test_sorts_versions_descending
Expand Down Expand Up @@ -173,6 +176,9 @@ def test_bumps_feature_version_when_default_changes
feature = read_feature_json
assert_equal "2.0.1", feature["version"],
"Feature version should be bumped when default changes"

content = File.read(File.join(@temp_dir, "features/src/ruby/devcontainer-feature.json"))
assert_match(/^ "id"/, content, "Should use 4-space indentation")
end

def test_does_not_bump_feature_version_when_default_unchanged
Expand Down