Skip to content

Commit 3be3751

Browse files
committed
feat(ruby)!: rewrite to use ruby-build with optional rbenv/rvm (v2.0.0)
Replace the rvm-only install with ruby-build under /usr/local/rubies, exposed via the 'current' symlink on the PATH. Add a versionManager option ("none" | "rbenv" | "rvm") that installs the chosen manager and delegates 'install' to it. Detect build deps across apt, dnf/yum, apk, zypper, and pacman. Replace ruby_fallback_test with ruby_rbenv / ruby_rvm scenarios.
1 parent 8c47157 commit 3be3751

11 files changed

Lines changed: 382 additions & 684 deletions

src/ruby/NOTES.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## OS Support
44

5-
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
5+
This Feature supports Linux images that ship one of the following package managers: `apt`, `dnf`/`yum`, `apk`, `zypper`, or `pacman`. The script detects the available package manager and installs the build dependencies that ruby-build needs.
66

77
`bash` is required to execute the `install.sh` script.
8+
9+
## Layout
10+
11+
- Ruby is installed under `/usr/local/rubies/<version>` by ruby-build.
12+
- The default Ruby is exposed via the `/usr/local/rubies/current` symlink, which is placed on the `PATH` through `containerEnv`.
13+
- `ruby-build` itself is cloned to `/usr/local/share/ruby-build` and symlinked into `/usr/local/bin/ruby-build` so additional versions can be installed later.
14+
- A shared `ruby` group owns `/usr/local/rubies`; the configured non-root user is added to it so `gem install` can write into the active Ruby tree without `sudo`.

src/ruby/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
# Ruby (via rvm) (ruby)
2+
# Ruby (via ruby-build) (ruby)
33

4-
Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.
4+
Installs Ruby using ruby-build only (no rvm, no rbenv), along with common build dependencies.
55

66
## Example Usage
77

88
```json
99
"features": {
10-
"ghcr.io/devcontainers/features/ruby:1": {}
10+
"ghcr.io/devcontainers/features/ruby:2": {}
1111
}
1212
```
1313

@@ -27,7 +27,7 @@ Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.
2727

2828
## OS Support
2929

30-
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
30+
This Feature supports Linux images that ship one of the following package managers: `apt`, `dnf`/`yum`, `apk`, `zypper`, or `pacman`. The script detects the available package manager and installs the build dependencies that ruby-build needs.
3131

3232
`bash` is required to execute the `install.sh` script.
3333

src/ruby/devcontainer-feature.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
{
22
"id": "ruby",
3-
"version": "1.3.2",
4-
"name": "Ruby (via rvm)",
3+
"version": "2.0.0",
4+
"name": "Ruby (via ruby-build)",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
6-
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
6+
"description": "Installs Ruby using ruby-build, with optional rbenv or rvm for version management.",
77
"options": {
88
"version": {
99
"type": "string",
1010
"proposals": [
1111
"latest",
1212
"none",
13-
"3.4",
14-
"3.2"
13+
"4.0",
14+
"3.4"
1515
],
1616
"default": "latest",
1717
"description": "Select or enter a Ruby version to install"
18+
},
19+
"versionManager": {
20+
"type": "string",
21+
"enum": ["none", "rbenv", "rvm"],
22+
"default": "none",
23+
"description": "Version manager to install alongside Ruby: 'rbenv', 'rvm', or 'none' (ruby-build only)"
1824
}
1925
},
2026
"customizations": {
@@ -25,17 +31,15 @@
2531
"settings": {
2632
"github.copilot.chat.codeGeneration.instructions": [
2733
{
28-
"text": "This dev container includes Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies pre-installed and available on the `PATH`, along with the Ruby language extension for Ruby development."
34+
"text": "This dev container installs Ruby via ruby-build. rbenv or rvm may also be available depending on the versionManager option. The default Ruby is on the PATH via /usr/local/rubies/current/bin (or rbenv shims if rbenv is the version manager)."
2935
}
3036
]
3137
}
3238
}
3339
},
3440
"containerEnv": {
35-
"GEM_PATH": "/usr/local/rvm/gems/default:/usr/local/rvm/gems/default@global",
36-
"GEM_HOME": "/usr/local/rvm/gems/default",
37-
"MY_RUBY_HOME": "/usr/local/rvm/rubies/default",
38-
"PATH": "/usr/local/rvm/gems/default/bin:/usr/local/rvm/gems/default@global/bin:/usr/local/rvm/rubies/default/bin:/usr/local/share/rbenv/bin:${PATH}"
41+
"RBENV_ROOT": "/usr/local/share/rbenv",
42+
"PATH": "/usr/local/share/rbenv/shims:/usr/local/share/rbenv/bin:/usr/local/rubies/current/bin:${PATH}"
3943
},
4044
"installsAfter": [
4145
"ghcr.io/devcontainers/features/common-utils"

0 commit comments

Comments
 (0)