`resolve_version` strips the leading `ruby-` from its argument and
then only looks for the stripped form in the definitions directory.
For canonical definitions whose filename retains the `ruby-` prefix
(currently `ruby-dev`) the exact-match step searches for `dev`,
which does not exist, and the grep fallback's `^dev[-.]` anchor
also misses the `ruby-dev` line in the definitions list. Result:
`ruby-build ruby-dev` reports "definition not found" even though
the file is shipped.
Try the original (unstripped) argument first in the exact-match
loop, then fall back to the stripped form. Numeric-version inputs
(`ruby-3.4.9`, `3.4`, `ruby-3.4`) and other implementations
(`mruby-dev`, `jruby-dev`) are unaffected because their existing
code paths still match.
Regression introduced in #2610.
* Support building with version prefix
Commonly in CI pipelines and other scripts, users may
want to install the latest from a specific series, e.g.
`3.4` or `jruby-10.0`.
```bash
$ bin/ruby-build 3.4 /tmp/3.4
...
Downloading ruby-3.4.9.tar.gz...
$ bin/ruby-build 4.0 /tmp/4.0
...
Downloading ruby-4.0.2.tar.gz...
```
Also support `--resolve`:
```bash
$ bin/ruby-build --resolve 3.4
3.4.9
```
* Improve version name resolution from prefix
- `ruby-build --resolve` now prints canonical definition names, always
stripping the "ruby-" prefix from output (e.g. "ruby-3.4" => "3.4.9").
- Fix sorting versions so that "jruby" correctly resolves to "jruby-10.x"
instead of to "jruby-9.x".
- Support bare "ruby" argument to select the latest CRuby version, since
that was already possible for "jruby", "mruby", et al.
- Case-normalize version inputs so that arguments like "JRuby" or
"TruffleRuby" resolve to their lowercase definitions.
- Simplify definition file lookup: all code paths now go through
resolve_version.
- Restore the named-pipe + `--dir` check to correctly abort early.
- Update README and man page: bump Ruby version numbers in examples, add
Ruby implementations section, document the `--resolve` option.
* Clarify what ruby-build considers to be "latest" Ruby version
* Print usage error message if `--resolve` wasn't passed an argument
---------
Co-authored-by: Mislav Marohnić <git@mislav.net>
This commit adds PicoRuby 3.4.2 and introduces a new artifacts: r2p2.
Version numbering context:
PicoRuby's version numbers are aligned with mruby's VM code specification compatibility.
Version 3.4 indicates compatibility with mruby 3.4 VM code format, or RITE0300.
Version 3.4.2 indicates minor bug fix in PicoRuby.
Build artifact changes:
Starting from version 3.4.2, PicoRuby has replaced the irb executable with r2p2 executable(POSIX version of PicoRuby shell system including IRB).
The new build produces three executables:
- picoruby: main Ruby interpreter
- picorbc: Ruby bytecode compiler
- r2p2: interactive REPL (replaces picoirb)
Implementation:
- Added conditional symlink logic in `build_package_picoruby()`: symlinks picoirb as irb if present
- If there's no picoirb in artifacts, symlink for irb is not created
- Added picoruby-3.4.2 definition file
Ruby >= 4.0 requires OpenSSL >= 1.1.1, but the script hardcoded
needs_openssl:1.0.2-3.x.x for all versions. Add version-based
condition to use needs_openssl:1.1.1-3.x.x for Ruby 4.x and later.
Ref: https://github.com/rbenv/ruby-build/pull/2608
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
While bisecting, or building a nightly Ruby CI and some other situations,
it is useful to be able to build a specific Ruby revision rather than
just the tip of Ruby's master branch.