mirror of
https://github.com/rbenv/ruby-build.git
synced 2026-05-14 16:36:53 -04:00
Compare commits
32 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e6d7f1653 |
||
|
|
60d0948d06 | ||
|
|
17c061e067 | ||
|
|
b0a21cdfce |
||
|
|
e98dffb562 |
||
|
|
84bcde9fde |
||
|
|
92d57fdbb6 |
||
|
|
9061a957e7 |
||
|
|
20abbb0618 |
||
|
|
f723aa7bf0 | ||
|
|
ffca2ee5a9 |
||
|
|
9e2a72a666 | ||
|
|
1c4ddb5320 |
||
|
|
82be834195 |
||
|
|
2b0f711360 |
||
|
|
4c5ef3e9ec |
||
|
|
c11e986163 | ||
|
|
68a0d76e14 | ||
|
|
90b52b26b7 | ||
|
|
759428c8a6 |
||
|
|
9c5f2601be | ||
|
|
79f3ddb562 | ||
|
|
d27dd19c24 | ||
|
|
63d8d38219 |
||
|
|
0bdc2c78d0 | ||
|
|
d099da0514 |
||
|
|
07deac8d23 | ||
|
|
03b4d45e4e |
||
|
|
c07e80e8b4 | ||
|
|
b46653bc1d |
||
|
|
7858b1231d |
||
|
|
cb14920bd6 |
24 changed files with 504 additions and 76 deletions
36
README.md
36
README.md
|
|
@ -42,11 +42,13 @@ PREFIX=/usr/local ./ruby-build-*/install.sh
|
|||
# As a standalone program
|
||||
$ ruby-build --list # lists latest stable releases for each Ruby
|
||||
$ ruby-build --definitions # lists all definitions, including outdated ones
|
||||
$ ruby-build 3.2.2 ~/.rubies/ruby-3.2.2 # installs Ruby 3.2.2
|
||||
$ ruby-build -d ruby-3.2.2 ~/.rubies # alternate form for the previous example
|
||||
$ ruby-build 3.4.9 ~/.rubies/ruby-3.4.9 # installs Ruby 3.4.9
|
||||
$ ruby-build -d ruby-3.4.9 ~/.rubies # alternate form for the previous example
|
||||
$ ruby-build -d ruby-3.4 ~/.rubies # installs latest Ruby 3.4.x
|
||||
|
||||
# As an rbenv plugin
|
||||
$ rbenv install 3.2.2 # installs Ruby 3.2.2 to ~/.rbenv/versions/3.2.2
|
||||
$ rbenv install 3.4.9 # installs Ruby 3.4.9 to ~/.rbenv/versions/3.4.9
|
||||
$ rbenv install 3 # installs latest Ruby 3.x
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
|
|
@ -61,6 +63,28 @@ Basically, what ruby-build does when installing a Ruby version is this:
|
|||
|
||||
Depending on the context, ruby-build does a little bit more than the above: for example, it will try to link Ruby to the appropriate OpenSSL version, even if that means downloading and compiling OpenSSL itself; it will discover and link to Homebrew-installed instances of some libraries like libyaml and readline, etc.
|
||||
|
||||
### Ruby versions
|
||||
|
||||
When listing "latest" Ruby versions, such as in `ruby-build --list` output, ruby-build only knows of Ruby versions that are bundled with this project. That means that when a new Ruby version comes out, ruby-build will not know about it immediately— you will have to upgrade ruby-build before you can use it to install the new Ruby version. This is because ruby-build bundles [definition files](#custom-build-definitions) for each individual Ruby version.
|
||||
|
||||
If it's important to you that your installer tool always consults remote resources to download the list of latest Ruby versions (without having to upgrade the tool itself), check out [ruby-install][] as an alternative to ruby-build.
|
||||
|
||||
### Ruby implementations
|
||||
|
||||
ruby-build ships with definitions for the following Ruby implementations, denoted by version prefixes in the `ruby-build --list` output:
|
||||
|
||||
- [CRuby][]: listed in ruby-build as unprefixed version numbers in the `X.Y.Z` format. This is the main Ruby implementation that most people use and is also historically known as "MRI". ruby-build allows adding the `ruby-` prefix to CRuby version numbers for compatibility with other version managers.
|
||||
|
||||
- `jruby`: [JRuby][] is a high-performance Ruby implementation with real threading built on top of the Java virtual machine (JVM).
|
||||
|
||||
- `mruby`: [mruby][] is a lightweight, embeddable Ruby implementation for microcontrollers.
|
||||
|
||||
- `picoruby`: [PicoRuby][] is an alternative mruby implementation for one-chip microcontrollers.
|
||||
|
||||
- `truffleruby`: The Native standalone distribution of [TruffleRuby][], an implementation of Ruby on top of GraalVM's Truffle framework.
|
||||
|
||||
- `truffleruby+graalvm`: The JVM standalone distribution of TruffleRuby.
|
||||
|
||||
### Advanced Usage
|
||||
|
||||
#### Custom Build Definitions
|
||||
|
|
@ -197,3 +221,9 @@ Be sure to include the full build log for build failures.
|
|||
[wiki]: https://github.com/rbenv/ruby-build/wiki
|
||||
[build-env]: https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
||||
[issue tracker]: https://github.com/rbenv/ruby-build/issues
|
||||
[cruby]: https://www.ruby-lang.org/
|
||||
[truffleruby]: https://truffleruby.dev/
|
||||
[picoruby]: https://github.com/picoruby/picoruby#readme
|
||||
[mruby]: https://mruby.org/
|
||||
[jruby]: https://www.jruby.org/
|
||||
[ruby-install]: https://github.com/postmodern/ruby-install#readme
|
||||
|
|
|
|||
|
|
@ -134,8 +134,6 @@ done
|
|||
|
||||
[ "${#ARGUMENTS[@]}" -le 1 ] || usage 1 >&2
|
||||
|
||||
unset VERSION_NAME
|
||||
|
||||
# The first argument contains the definition to install. If the
|
||||
# argument is missing, try to install whatever local app-specific
|
||||
# version is specified by rbenv. Show usage instructions if a local
|
||||
|
|
@ -144,6 +142,12 @@ DEFINITION="${ARGUMENTS[0]}"
|
|||
[ -n "$DEFINITION" ] || DEFINITION="$(rbenv-local 2>/dev/null || true)"
|
||||
[ -n "$DEFINITION" ] || usage 1 >&2
|
||||
|
||||
if VERSION_NAME="$(ruby-build --resolve "$DEFINITION")"; then
|
||||
DEFINITION="$VERSION_NAME"
|
||||
else
|
||||
unset VERSION_NAME
|
||||
fi
|
||||
|
||||
# Define `before_install` and `after_install` functions that allow
|
||||
# plugin hooks to register a string of code for execution before or
|
||||
# after the installation process.
|
||||
|
|
|
|||
110
bin/ruby-build
110
bin/ruby-build
|
|
@ -2,10 +2,12 @@
|
|||
#
|
||||
# Usage: ruby-build [-dvpk] <definition> <prefix> [-- <configure-args...>]
|
||||
# ruby-build {--list|--definitions}
|
||||
# ruby-build --resolve <version>
|
||||
# ruby-build --version
|
||||
#
|
||||
# -l, --list List latest stable releases for each Ruby
|
||||
# --definitions List all local definitions, including outdated ones
|
||||
# --resolve Print the latest stable definition name matching a version prefix
|
||||
# --version Show version of ruby-build
|
||||
#
|
||||
# -d, --dir Install the Ruby in <prefix>/<definition> instead of <prefix>
|
||||
|
|
@ -16,7 +18,7 @@
|
|||
# -6, --ipv6 Resolve names to IPv6 addresses only
|
||||
#
|
||||
|
||||
RUBY_BUILD_VERSION="20260326"
|
||||
RUBY_BUILD_VERSION="20260512"
|
||||
|
||||
OLDIFS="$IFS"
|
||||
|
||||
|
|
@ -885,7 +887,9 @@ build_package_picoruby() {
|
|||
mkdir -p "$PREFIX_PATH"
|
||||
cp -fR build/host/* include "$PREFIX_PATH"
|
||||
ln -fs picoruby "$PREFIX_PATH/bin/ruby"
|
||||
ln -fs picoirb "$PREFIX_PATH/bin/irb"
|
||||
if [ -f build/host/bin/picoirb ]; then
|
||||
ln -fs picoirb "$PREFIX_PATH/bin/irb"
|
||||
fi
|
||||
}
|
||||
|
||||
build_package_jruby() {
|
||||
|
|
@ -1292,6 +1296,11 @@ build_package_openssl() {
|
|||
# Extract root certs from the system keychain in .pem format.
|
||||
security find-certificate -a -p /Library/Keychains/System.keychain > "$pem_file"
|
||||
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file"
|
||||
elif [ -e /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]; then # RHEL 9+, Fedora 34+
|
||||
# See https://fedoraproject.org/wiki/Changes/droppingOfCertPemFile
|
||||
rm -rf "$OPENSSLDIR/certs" "$pem_file"
|
||||
ln -s /etc/pki/ca-trust/extracted/pem/ "$OPENSSLDIR/certs"
|
||||
ln -s /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem "$pem_file"
|
||||
elif [ -e /etc/pki/tls/cert.pem ]; then # RedHat
|
||||
# See https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259
|
||||
rm -rf "$OPENSSLDIR/certs" "$pem_file"
|
||||
|
|
@ -1311,7 +1320,10 @@ build_package_openssl() {
|
|||
ln -snf "$SYSTEM_OPENSSLDIR/certs" "$OPENSSLDIR/certs"
|
||||
fi
|
||||
else
|
||||
echo "Could not find OpenSSL certificates" >&2
|
||||
{ colorize 1 "ERROR"
|
||||
echo "Could not find OpenSSL certificates on this system."
|
||||
echo "You may need to install the 'ca-certificates' package or 'openssl' for your distribution."
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -1401,6 +1413,40 @@ list_maintained_versions() {
|
|||
} | extract_latest_versions | sort_versions | uniq
|
||||
}
|
||||
|
||||
# resolve a version prefix to the exact version name for which exists a
|
||||
# definition file. Example: "ruby-3" => "3.4.9"
|
||||
resolve_version() {
|
||||
local version="${1#ruby-}"
|
||||
|
||||
# Look for an exact match first.
|
||||
for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do
|
||||
if [ -f "${DEFINITION_DIR}/$1" ]; then
|
||||
echo "$1"
|
||||
return 0
|
||||
fi
|
||||
if [ -f "${DEFINITION_DIR}/${version}" ]; then
|
||||
echo "$version"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
local grep_pattern="${version%.}"
|
||||
if [ "$grep_pattern" = "ruby" ]; then
|
||||
# Special case to select the latest CRuby.
|
||||
grep_pattern="[0-9]"
|
||||
else
|
||||
grep_pattern="$(tr 'A-Z' 'a-z' <<<"${grep_pattern//./\\.}")"
|
||||
fi
|
||||
|
||||
version=$(list_definitions | \
|
||||
grep -e "^${grep_pattern}[-.]" | \
|
||||
grep -v -e '-rc[0-9]*$' -e '-preview[0-9]*$' -e '-dev$' | \
|
||||
tail -n 1)
|
||||
|
||||
[ -n "$version" ] || return 1
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
extract_latest_versions() {
|
||||
# sort in this function looks redundunt but it is necessary
|
||||
# rbx-3.99 appears latest unless the sort
|
||||
|
|
@ -1443,6 +1489,14 @@ for option in "${OPTIONS[@]}"; do
|
|||
"l" | "list")
|
||||
EARLY_EXIT=list_maintained_versions
|
||||
;;
|
||||
"resolve")
|
||||
if [ "${#ARGUMENTS[*]}" -eq 1 ]; then
|
||||
EARLY_EXIT=resolve_version
|
||||
else
|
||||
echo "ruby-build: '--resolve' needs an argument" >&2
|
||||
EARLY_EXIT=usage_error
|
||||
fi
|
||||
;;
|
||||
"d" | "dir")
|
||||
APPEND_DEFINITION_TO_PREFIX=true
|
||||
;;
|
||||
|
|
@ -1493,12 +1547,9 @@ if [ "${#EXTRA_ARGUMENTS[@]}" -gt 0 ]; then
|
|||
RUBY_CONFIGURE_OPTS_ARRAY=("${EXTRA_ARGUMENTS[@]}")
|
||||
fi
|
||||
|
||||
if [ "$APPEND_DEFINITION_TO_PREFIX" = "true" ]; then
|
||||
if [ -p "$DEFINITION_PATH" ]; then
|
||||
echo "ruby-build: using named pipes in combination with \`--dir' is not possible" >&2
|
||||
EARLY_EXIT=usage_error
|
||||
fi
|
||||
PREFIX_PATH="$PREFIX_PATH/$(basename "$DEFINITION_PATH")"
|
||||
if [[ "$APPEND_DEFINITION_TO_PREFIX" = "true" && -p "$DEFINITION_PATH" ]]; then
|
||||
echo "ruby-build: using named pipes in combination with \`--dir' is not possible" >&2
|
||||
EARLY_EXIT=usage_error
|
||||
fi
|
||||
|
||||
case "$EARLY_EXIT" in
|
||||
|
|
@ -1511,6 +1562,10 @@ version | list_definitions | list_maintained_versions )
|
|||
"$EARLY_EXIT"
|
||||
exit 0
|
||||
;;
|
||||
resolve_version )
|
||||
resolve_version "${ARGUMENTS[0]}" || exit 1
|
||||
exit 0
|
||||
;;
|
||||
usage_error )
|
||||
echo >&2
|
||||
usage 1 >&2
|
||||
|
|
@ -1523,30 +1578,29 @@ usage_error )
|
|||
;;
|
||||
esac
|
||||
|
||||
VERSION_NAME_PREFIX=""
|
||||
|
||||
# expand the <definition> argument to full path of the definition file
|
||||
if [[ ! -f "$DEFINITION_PATH" && ! -p "$DEFINITION_PATH" ]]; then
|
||||
for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do
|
||||
if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then
|
||||
DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If the given definition is like ruby-X.Y.Z, search again with X.Y.Z
|
||||
if [[ "$DEFINITION_PATH" =~ ^ruby-[0-9] ]]; then
|
||||
DEFINITION_PATH="${DEFINITION_PATH#ruby-}"
|
||||
for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do
|
||||
if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then
|
||||
DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -f "$DEFINITION_PATH" ]; then
|
||||
if ! VERSION_NAME="$(resolve_version "$DEFINITION_PATH")"; then
|
||||
echo "ruby-build: definition not found: ${DEFINITION_PATH}" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ $DEFINITION_PATH == ruby-* && $VERSION_NAME != ruby-* ]]; then
|
||||
VERSION_NAME_PREFIX="ruby-"
|
||||
fi
|
||||
|
||||
for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do
|
||||
if [ -f "${DEFINITION_DIR}/${VERSION_NAME}" ]; then
|
||||
DEFINITION_PATH="${DEFINITION_DIR}/${VERSION_NAME}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$APPEND_DEFINITION_TO_PREFIX" = "true" ]; then
|
||||
PREFIX_PATH="$PREFIX_PATH/${VERSION_NAME_PREFIX}$(basename "$DEFINITION_PATH")"
|
||||
fi
|
||||
|
||||
# normalize the <prefix> argument
|
||||
|
|
|
|||
|
|
@ -36,7 +36,14 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
major_version=$(echo ${version} | cut -d '.' -f 1)
|
||||
if [ "$major_version" -ge 4 ]; then
|
||||
needs_openssl="needs_openssl:1.1.1-3.x.x"
|
||||
else
|
||||
needs_openssl="needs_openssl:1.0.2-3.x.x"
|
||||
fi
|
||||
|
||||
cat > "$file" <<EOS
|
||||
install_package "openssl-${openssl_version}" "${openssl_url}#${openssl_sha256}" openssl --if needs_openssl:1.0.2-3.x.x
|
||||
install_package "openssl-${openssl_version}" "${openssl_url}#${openssl_sha256}" openssl --if ${needs_openssl}
|
||||
install_package "ruby-${version}" "${url}#${sha256}" enable_shared standard
|
||||
EOS
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ Linux-aarch64)
|
|||
EOS
|
||||
add_platform "linux-aarch64"
|
||||
cat >> "$file" <<EOS
|
||||
Darwin-x86_64)
|
||||
EOS
|
||||
add_platform "macos-amd64"
|
||||
cat >> "$file" <<EOS
|
||||
Darwin-arm64)
|
||||
EOS
|
||||
add_platform "macos-aarch64"
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ Linux-aarch64)
|
|||
EOS
|
||||
add_platform "linux-aarch64"
|
||||
cat >> "$file" <<EOS
|
||||
Darwin-x86_64)
|
||||
EOS
|
||||
add_platform "macos-amd64"
|
||||
cat >> "$file" <<EOS
|
||||
Darwin-arm64)
|
||||
EOS
|
||||
add_platform "macos-aarch64"
|
||||
|
|
|
|||
123
share/man/man1/ruby-build.1
generated
123
share/man/man1/ruby-build.1
generated
|
|
@ -2,12 +2,12 @@
|
|||
.\" Title: ruby-build
|
||||
.\" Author: Mislav Marohnić
|
||||
.\" Generator: Asciidoctor 2.0.26
|
||||
.\" Date: 2024-09-24
|
||||
.\" Date: 2026-05-07
|
||||
.\" Manual: ruby-build Manual
|
||||
.\" Source: ruby-build 20260326
|
||||
.\" Source: ruby-build 20260512
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "RUBY\-BUILD" "1" "2024-09-24" "ruby\-build 20260326" "ruby\-build Manual"
|
||||
.TH "RUBY\-BUILD" "1" "2026-05-07" "ruby\-build 20260512" "ruby\-build Manual"
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.ss \n[.ss] 0
|
||||
|
|
@ -35,15 +35,14 @@ ruby\-build [\-dvpk] \fI<definition>\fP \fI<prefix>\fP [\-\- \fI<configure\-args
|
|||
.br
|
||||
ruby\-build {\-\-list|\-\-definitions}
|
||||
.br
|
||||
ruby\-build \-\-resolve \fI<version>\fP
|
||||
.br
|
||||
ruby\-build \-\-version
|
||||
.SH "DESCRIPTION"
|
||||
.sp
|
||||
ruby\-build downloads, compiles, and installs a Ruby version named by the
|
||||
\fIdefinition\fP argument into the location specified by \fIprefix\fP.
|
||||
.sp
|
||||
The \fIdefinition\fP argument can optionally start with "ruby\-", in which case
|
||||
it resolves to a CRuby that matches the version number that follows.
|
||||
.sp
|
||||
The \fIdefinition\fP argument can be a path to a file on disk, in which case
|
||||
it is sourced into ruby\-build as a bash script.
|
||||
.sp
|
||||
|
|
@ -53,6 +52,91 @@ will get forwarded to the \f(CR./configure\fP invocation.
|
|||
By default, all compile output is redirected to a log file at
|
||||
\f(CR$TMPDIR/ruby\-build.*.log\fP. Activate the verbose mode to skip the log file
|
||||
and print everything to standard streams.
|
||||
.SH "RUBY VERSIONS"
|
||||
.sp
|
||||
When listing "latest" Ruby versions, such as in \f(CR\-\-list\fP output,
|
||||
ruby\-build only knows of Ruby versions that are bundled with this project.
|
||||
That means that when a new Ruby version comes out, ruby\-build will not
|
||||
know about it immediately; you will have to upgrade ruby\-build before you
|
||||
can use it to install the new Ruby version.
|
||||
.SH "RUBY IMPLEMENTATIONS"
|
||||
.sp
|
||||
ruby\-build ships with definitions for the following Ruby implementations:
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
CRuby, also known as "MRI": denoted by version numbers in form of "X.Y.Z".
|
||||
This is the main Ruby implementation that most people use.
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
"jruby": High\-performance Ruby implementation with real threading built
|
||||
on top of the Java virtual machine (JVM).
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
"mruby": Lightweight Ruby for microcontrollers.
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
"picoruby": Alternative mruby implementation for one\-chip microcontrollers.
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
"truffleruby": The Native standalone distribution of TruffleRuby, an
|
||||
implementation of Ruby on top of GraalVM\(cqs Truffle framework.
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
. sp -1
|
||||
. IP \(bu 2.3
|
||||
.\}
|
||||
"truffleruby+graalvm": The JVM standalone distribution of TruffleRuby.
|
||||
.RE
|
||||
.sp
|
||||
The \fIdefinition\fP argument may optionally start with "ruby\-", in which case
|
||||
it resolves to a CRuby that matches the version number that follows. The
|
||||
\fIdefinition\fP argument may also be a name of one of the alternative Ruby
|
||||
implementations, in which case the latest version of that implementation
|
||||
will be installed.
|
||||
.SH "OPTIONS"
|
||||
.sp
|
||||
\fB\-l, \-\-list\fP
|
||||
|
|
@ -65,6 +149,11 @@ List latest stable releases for each Ruby
|
|||
List all local definitions, including outdated ones
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-resolve\fP
|
||||
.RS 4
|
||||
Print the definition name of the latest stable Ruby version matching the \fIversion\fP argument
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-version\fP
|
||||
.RS 4
|
||||
Show version of ruby\-build
|
||||
|
|
@ -106,27 +195,37 @@ Install a Ruby version while tweaking some configuration options:
|
|||
.if n .RS 4
|
||||
.nf
|
||||
.fam C
|
||||
$ ruby\-build 3.2.2 /path/to/destination \-\- \-\-disable\-install\-doc \-\-with\-openssl\-dir=/opt/openssl
|
||||
$ ruby\-build 3.4.9 /path/to/destination \-\- \-\-disable\-install\-doc \-\-with\-openssl\-dir=/opt/openssl
|
||||
.fam
|
||||
.fi
|
||||
.if n .RE
|
||||
.sp
|
||||
Install a Ruby version to \f(CR~/.rubies/ruby\-3.2.2\fP:
|
||||
Install a Ruby version to \f(CR~/.rubies/ruby\-3.4.9\fP:
|
||||
.sp
|
||||
.if n .RS 4
|
||||
.nf
|
||||
.fam C
|
||||
$ ruby\-build \-\-dir ruby\-3.2.2 ~/.rubies
|
||||
$ ruby\-build \-\-dir ruby\-3.4.9 ~/.rubies
|
||||
.fam
|
||||
.fi
|
||||
.if n .RE
|
||||
.sp
|
||||
Install a Ruby version to \f(CR~/.rbenv/versions/3.3.5\fP:
|
||||
Install the latest Ruby 3.x version to \f(CR~/.rubies/ruby\-3.x.y\fP:
|
||||
.sp
|
||||
.if n .RS 4
|
||||
.nf
|
||||
.fam C
|
||||
$ ruby\-build \-\-dir 3.3.5 ~/.rbenv/versions
|
||||
$ ruby\-build \-\-dir ruby\-3 ~/.rubies
|
||||
.fam
|
||||
.fi
|
||||
.if n .RE
|
||||
.sp
|
||||
Install a Ruby version to \f(CR~/.rbenv/versions/3.3.11\fP:
|
||||
.sp
|
||||
.if n .RS 4
|
||||
.nf
|
||||
.fam C
|
||||
$ ruby\-build \-\-dir 3.3.11 ~/.rbenv/versions
|
||||
.fam
|
||||
.fi
|
||||
.if n .RE
|
||||
|
|
@ -136,7 +235,7 @@ Usage as rbenv plugin, accomplishes the same as the previous example:
|
|||
.if n .RS 4
|
||||
.nf
|
||||
.fam C
|
||||
$ rbenv install 3.3.5
|
||||
$ rbenv install 3.3.11
|
||||
.fam
|
||||
.fi
|
||||
.if n .RE
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ ruby-build - Download, compile, and install a version of Ruby
|
|||
|
||||
ruby-build [-dvpk] _<definition>_ _<prefix>_ [-- _<configure-args>_...] +
|
||||
ruby-build {--list|--definitions} +
|
||||
ruby-build --resolve _<version>_ +
|
||||
ruby-build --version
|
||||
|
||||
== Description
|
||||
|
|
@ -20,9 +21,6 @@ ruby-build --version
|
|||
ruby-build downloads, compiles, and installs a Ruby version named by the
|
||||
_definition_ argument into the location specified by _prefix_.
|
||||
|
||||
The _definition_ argument can optionally start with "ruby-", in which case
|
||||
it resolves to a CRuby that matches the version number that follows.
|
||||
|
||||
The _definition_ argument can be a path to a file on disk, in which case
|
||||
it is sourced into ruby-build as a bash script.
|
||||
|
||||
|
|
@ -33,6 +31,39 @@ By default, all compile output is redirected to a log file at
|
|||
`$TMPDIR/ruby-build.*.log`. Activate the verbose mode to skip the log file
|
||||
and print everything to standard streams.
|
||||
|
||||
== Ruby versions
|
||||
|
||||
When listing "latest" Ruby versions, such as in `--list` output,
|
||||
ruby-build only knows of Ruby versions that are bundled with this project.
|
||||
That means that when a new Ruby version comes out, ruby-build will not
|
||||
know about it immediately; you will have to upgrade ruby-build before you
|
||||
can use it to install the new Ruby version.
|
||||
|
||||
== Ruby implementations
|
||||
|
||||
ruby-build ships with definitions for the following Ruby implementations:
|
||||
|
||||
- CRuby, also known as "MRI": denoted by version numbers in form of "X.Y.Z".
|
||||
This is the main Ruby implementation that most people use.
|
||||
|
||||
- "jruby": High-performance Ruby implementation with real threading built
|
||||
on top of the Java virtual machine (JVM).
|
||||
|
||||
- "mruby": Lightweight Ruby for microcontrollers.
|
||||
|
||||
- "picoruby": Alternative mruby implementation for one-chip microcontrollers.
|
||||
|
||||
- "truffleruby": The Native standalone distribution of TruffleRuby, an
|
||||
implementation of Ruby on top of GraalVM's Truffle framework.
|
||||
|
||||
- "truffleruby+graalvm": The JVM standalone distribution of TruffleRuby.
|
||||
|
||||
The _definition_ argument may optionally start with "ruby-", in which case
|
||||
it resolves to a CRuby that matches the version number that follows. The
|
||||
_definition_ argument may also be a name of one of the alternative Ruby
|
||||
implementations, in which case the latest version of that implementation
|
||||
will be installed.
|
||||
|
||||
== Options
|
||||
|
||||
*-l, --list*::
|
||||
|
|
@ -41,6 +72,9 @@ and print everything to standard streams.
|
|||
*--definitions*::
|
||||
List all local definitions, including outdated ones
|
||||
|
||||
*--resolve*::
|
||||
Print the definition name of the latest stable Ruby version matching the _version_ argument
|
||||
|
||||
*--version*::
|
||||
Show version of ruby-build
|
||||
|
||||
|
|
@ -66,22 +100,27 @@ and print everything to standard streams.
|
|||
|
||||
Install a Ruby version while tweaking some configuration options:
|
||||
----
|
||||
$ ruby-build 3.2.2 /path/to/destination -- --disable-install-doc --with-openssl-dir=/opt/openssl
|
||||
$ ruby-build 3.4.9 /path/to/destination -- --disable-install-doc --with-openssl-dir=/opt/openssl
|
||||
----
|
||||
|
||||
Install a Ruby version to `~/.rubies/ruby-3.2.2`:
|
||||
Install a Ruby version to `~/.rubies/ruby-3.4.9`:
|
||||
----
|
||||
$ ruby-build --dir ruby-3.2.2 ~/.rubies
|
||||
$ ruby-build --dir ruby-3.4.9 ~/.rubies
|
||||
----
|
||||
|
||||
Install a Ruby version to `~/.rbenv/versions/3.3.5`:
|
||||
Install the latest Ruby 3.x version to `~/.rubies/ruby-3.x.y`:
|
||||
----
|
||||
$ ruby-build --dir 3.3.5 ~/.rbenv/versions
|
||||
$ ruby-build --dir ruby-3 ~/.rubies
|
||||
----
|
||||
|
||||
Install a Ruby version to `~/.rbenv/versions/3.3.11`:
|
||||
----
|
||||
$ ruby-build --dir 3.3.11 ~/.rbenv/versions
|
||||
----
|
||||
|
||||
Usage as rbenv plugin, accomplishes the same as the previous example:
|
||||
----
|
||||
$ rbenv install 3.3.5
|
||||
$ rbenv install 3.3.11
|
||||
----
|
||||
|
||||
== Environment Variables
|
||||
|
|
|
|||
2
share/ruby-build/3.2.11
Normal file
2
share/ruby-build/3.2.11
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
install_package "openssl-3.0.19" "https://github.com/openssl/openssl/releases/download/openssl-3.0.19/openssl-3.0.19.tar.gz#fa5a4143b8aae18be53ef2f3caf29a2e0747430b8bc74d32d88335b94ab63072" openssl --if needs_openssl:1.0.2-3.x.x
|
||||
install_package "ruby-3.2.11" "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.11.tar.gz#b3eeabd6636f334531db3ffdc3229eb05e524740e6c84fdc043720573cf2f8b2" enable_shared standard
|
||||
2
share/ruby-build/4.0.3
Normal file
2
share/ruby-build/4.0.3
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
install_package "openssl-3.0.20" "https://github.com/openssl/openssl/releases/download/openssl-3.0.20/openssl-3.0.20.tar.gz#c80a01dfc70ece4dc21168932c37739042d404d46ccc81a5986dd75314ecda6f" openssl --if needs_openssl:1.1.1-3.x.x
|
||||
install_package "ruby-4.0.3" "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.3.tar.gz#77964acc370d5c8375b9502e5ba6c13c03ef91ab9eb9f521c84fb42b9c9a6b0f" enable_shared standard
|
||||
2
share/ruby-build/4.0.4
Normal file
2
share/ruby-build/4.0.4
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
install_package "openssl-3.0.20" "https://github.com/openssl/openssl/releases/download/openssl-3.0.20/openssl-3.0.20.tar.gz#c80a01dfc70ece4dc21168932c37739042d404d46ccc81a5986dd75314ecda6f" openssl --if needs_openssl:1.1.1-3.x.x
|
||||
install_package "ruby-4.0.4" "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.4.tar.gz#f35f6edfa3dabb3f723f9d0cf1906c6512ae77f4e412ab1e68cc6e91d230fa80" enable_shared standard
|
||||
2
share/ruby-build/jruby-10.0.5.0
Normal file
2
share/ruby-build/jruby-10.0.5.0
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require_java 21
|
||||
install_package "jruby-10.0.5.0" "https://repo1.maven.org/maven2/org/jruby/jruby-dist/10.0.5.0/jruby-dist-10.0.5.0-bin.tar.gz#6b3aa0340bd60a2b131e12490bb498c45359d9c91e477f5760c3aa18e37d1988" jruby
|
||||
2
share/ruby-build/jruby-10.1.0.0
Normal file
2
share/ruby-build/jruby-10.1.0.0
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require_java 21
|
||||
install_package "jruby-10.1.0.0" "https://repo1.maven.org/maven2/org/jruby/jruby-dist/10.1.0.0/jruby-dist-10.1.0.0-bin.tar.gz#9c14a0ce81f3a312fd98c415986982132e91d36b12cb8d74a3dfdae93fe984ac" jruby
|
||||
1
share/ruby-build/mruby-4.0.0
Normal file
1
share/ruby-build/mruby-4.0.0
Normal file
|
|
@ -0,0 +1 @@
|
|||
install_package "mruby-4.0.0" "https://github.com/mruby/mruby/archive/4.0.0.tar.gz#e2ea271dbed14e9f2b33df773ae447b747dbc242ce2675022c0a57efea85a7b4" mruby
|
||||
1
share/ruby-build/picoruby-3.4.2
Normal file
1
share/ruby-build/picoruby-3.4.2
Normal file
|
|
@ -0,0 +1 @@
|
|||
install_package "picoruby-3.4.2" "https://github.com/picoruby/picoruby/releases/download/3.4.2/picoruby-3.4.2.tar.gz#75a7dded2b2dff443a80e3bb8075ccf2fe7b77282f8a8a69689fc700b51d61f3" picoruby
|
||||
16
share/ruby-build/truffleruby+graalvm-34.0.0
Normal file
16
share/ruby-build/truffleruby+graalvm-34.0.0
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
platform="$(uname -s)-$(uname -m)"
|
||||
case $platform in
|
||||
Linux-x86_64)
|
||||
install_package "truffleruby+graalvm-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-jvm-34.0.0-linux-amd64.tar.gz#58fbc7dda89368d330211ec6782f8c43c04cbfc19fc81cb3b0e545fa03dd4562" truffleruby
|
||||
;;
|
||||
Linux-aarch64)
|
||||
install_package "truffleruby+graalvm-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-jvm-34.0.0-linux-aarch64.tar.gz#d35412c9ed08c834f81a1aabe3278aa371682be9cbf1becbf3302f0b85619522" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby+graalvm-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-jvm-34.0.0-macos-aarch64.tar.gz#17b934df517c8311c9d31248c779c0651f3ffe068a614996d7f32dd746106678" truffleruby
|
||||
;;
|
||||
*)
|
||||
colorize 1 "Unsupported platform: $platform"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
16
share/ruby-build/truffleruby+graalvm-34.0.1
Normal file
16
share/ruby-build/truffleruby+graalvm-34.0.1
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
platform="$(uname -s)-$(uname -m)"
|
||||
case $platform in
|
||||
Linux-x86_64)
|
||||
install_package "truffleruby+graalvm-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-jvm-34.0.1-linux-amd64.tar.gz#2fb0ad7964f635cdf47a9b1a238aaa377d1eb18ddd12c0846d525f7b82fac525" truffleruby
|
||||
;;
|
||||
Linux-aarch64)
|
||||
install_package "truffleruby+graalvm-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-jvm-34.0.1-linux-aarch64.tar.gz#f72d631d265cb6b2cac87169203eee4bfd3a61e75b8d7fd3cc8f383b8b701854" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby+graalvm-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-jvm-34.0.1-macos-aarch64.tar.gz#1d14a4186e718a3f52682a771b9796c594ddf664c2eb9d24dba1abff7d973fd3" truffleruby
|
||||
;;
|
||||
*)
|
||||
colorize 1 "Unsupported platform: $platform"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -6,9 +6,6 @@ Linux-x86_64)
|
|||
Linux-aarch64)
|
||||
install_package "truffleruby+graalvm-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby+graalvm-head-linux-arm64.tar.gz" truffleruby
|
||||
;;
|
||||
Darwin-x86_64)
|
||||
install_package "truffleruby+graalvm-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby+graalvm-head-darwin-x64.tar.gz" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby+graalvm-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby+graalvm-head-darwin-arm64.tar.gz" truffleruby
|
||||
;;
|
||||
|
|
|
|||
16
share/ruby-build/truffleruby-34.0.0
Normal file
16
share/ruby-build/truffleruby-34.0.0
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
platform="$(uname -s)-$(uname -m)"
|
||||
case $platform in
|
||||
Linux-x86_64)
|
||||
install_package "truffleruby-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-34.0.0-linux-amd64.tar.gz#cd3dd1af0c6e63511527ec535a56522f9951950dbb1cb349f5845d9d432a5cc3" truffleruby
|
||||
;;
|
||||
Linux-aarch64)
|
||||
install_package "truffleruby-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-34.0.0-linux-aarch64.tar.gz#5736f6278d36ed962e6f317996624676d0d95e9f2a37a5e03f6dd317f4e0b190" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby-34.0.0" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.0/truffleruby-34.0.0-macos-aarch64.tar.gz#1140797470447a17760d19972404d9903fdcc8d638b3d1f55a0d0c8a18e693b9" truffleruby
|
||||
;;
|
||||
*)
|
||||
colorize 1 "Unsupported platform: $platform"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
16
share/ruby-build/truffleruby-34.0.1
Normal file
16
share/ruby-build/truffleruby-34.0.1
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
platform="$(uname -s)-$(uname -m)"
|
||||
case $platform in
|
||||
Linux-x86_64)
|
||||
install_package "truffleruby-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-34.0.1-linux-amd64.tar.gz#15fb3c5bb6d2917a2e5d08497f62586d262cddd65c9d251f098f6b568b33a8f7" truffleruby
|
||||
;;
|
||||
Linux-aarch64)
|
||||
install_package "truffleruby-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-34.0.1-linux-aarch64.tar.gz#10ed8310addb41782d92ce44e1ec9b2865b65f1c8d7c4ce489d6e84854d0bca5" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby-34.0.1" "https://github.com/truffleruby/truffleruby/releases/download/graal-34.0.1/truffleruby-34.0.1-macos-aarch64.tar.gz#7a1404751b88aa49686e0787eafc9695d67ac3925d9d2bfdb881a4e5258842f3" truffleruby
|
||||
;;
|
||||
*)
|
||||
colorize 1 "Unsupported platform: $platform"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -6,9 +6,6 @@ Linux-x86_64)
|
|||
Linux-aarch64)
|
||||
install_package "truffleruby-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby-head-linux-arm64.tar.gz" truffleruby
|
||||
;;
|
||||
Darwin-x86_64)
|
||||
install_package "truffleruby-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby-head-darwin-x64.tar.gz" truffleruby
|
||||
;;
|
||||
Darwin-arm64)
|
||||
install_package "truffleruby-dev" "https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby-head-darwin-arm64.tar.gz" truffleruby
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -787,6 +787,30 @@ make install
|
|||
OUT
|
||||
}
|
||||
|
||||
@test "nested install destination with ruby prefix and version prefix" {
|
||||
cached_tarball "ruby-3.2.45" configure
|
||||
|
||||
stub_repeated brew false
|
||||
stub_make_install
|
||||
|
||||
mkdir -p "$TMP"/definitions
|
||||
cat > "$TMP"/definitions/3.2.45 <<DEF
|
||||
install_package "ruby-3.2.45" "http://ruby-lang.org/ruby/2.0/ruby-3.2.45.tar.gz"
|
||||
DEF
|
||||
|
||||
RUBY_BUILD_DEFINITIONS="$TMP"/definitions run ruby-build --dir ruby-3.2 "$INSTALL_ROOT"
|
||||
assert_success
|
||||
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
ruby-3.2.45: [--prefix=$INSTALL_ROOT/ruby-3.2.45,--with-ext=openssl,psych,+]
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "definition file with ruby prefix" {
|
||||
export RUBY_BUILD_CACHE_PATH="$FIXTURE_ROOT"
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,111 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/ruby-build | wc -l)"
|
|||
assert_success ""
|
||||
}
|
||||
|
||||
@test "installing definition by prefix" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
echo false > "${TMP}/definitions/1.8.6"
|
||||
echo false > "${TMP}/definitions/1.9.3"
|
||||
echo true > "${TMP}/definitions/1.9.10"
|
||||
echo false > "${TMP}/definitions/1.90.0"
|
||||
echo false > "${TMP}/definitions/2.0.0"
|
||||
|
||||
run bin/ruby-build "1.9" "${TMP}/install"
|
||||
assert_success ""
|
||||
}
|
||||
|
||||
@test "resolve failure" {
|
||||
run bin/ruby-build --resolve "doesntexist"
|
||||
assert_failure ""
|
||||
}
|
||||
|
||||
@test "resolve definition by version prefix" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/1.8.6"
|
||||
touch "${TMP}/definitions/1.9.3"
|
||||
touch "${TMP}/definitions/1.9.10"
|
||||
touch "${TMP}/definitions/1.90.0"
|
||||
touch "${TMP}/definitions/2.0.0"
|
||||
|
||||
run bin/ruby-build --resolve "1.9"
|
||||
assert_success "1.9.10"
|
||||
}
|
||||
|
||||
@test "resolve definition by exact match" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/3.2.1"
|
||||
|
||||
run bin/ruby-build --resolve "3.2.1"
|
||||
assert_success "3.2.1"
|
||||
}
|
||||
|
||||
@test "resolve definition by exact match and ruby prefix" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/3.2.1"
|
||||
|
||||
run bin/ruby-build --resolve "ruby-3.2.1"
|
||||
assert_success "3.2.1"
|
||||
}
|
||||
|
||||
@test "resolve definition by exact match for ruby-prefixed name" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/ruby-dev"
|
||||
|
||||
run bin/ruby-build --resolve "ruby-dev"
|
||||
assert_success "ruby-dev"
|
||||
}
|
||||
|
||||
@test "resolve definition with ruby prefix" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/1.8.6"
|
||||
touch "${TMP}/definitions/1.9.3"
|
||||
touch "${TMP}/definitions/1.9.10"
|
||||
touch "${TMP}/definitions/1.90.0"
|
||||
touch "${TMP}/definitions/2.0.0"
|
||||
|
||||
run bin/ruby-build --resolve "ruby-1.9"
|
||||
assert_success "1.9.10"
|
||||
}
|
||||
|
||||
@test "resolve definition by implementation name" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/fooruby-1.8.6"
|
||||
touch "${TMP}/definitions/fooruby-1.9.3"
|
||||
touch "${TMP}/definitions/1.9.10"
|
||||
touch "${TMP}/definitions/1.90.0"
|
||||
touch "${TMP}/definitions/2.0.0"
|
||||
|
||||
run bin/ruby-build --resolve "FooRuby"
|
||||
assert_success "fooruby-1.9.3"
|
||||
}
|
||||
|
||||
@test "resolve definition by implementation name and version" {
|
||||
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
|
||||
mkdir -p "${TMP}/definitions"
|
||||
|
||||
touch "${TMP}/definitions/foo-1.8.6"
|
||||
touch "${TMP}/definitions/foo-1.9.3"
|
||||
touch "${TMP}/definitions/1.9.10"
|
||||
touch "${TMP}/definitions/1.90.0"
|
||||
touch "${TMP}/definitions/2.0.0"
|
||||
|
||||
run bin/ruby-build --resolve "foo-1.8"
|
||||
assert_success "foo-1.8.6"
|
||||
}
|
||||
|
||||
@test "installing nonexistent definition" {
|
||||
run ruby-build "nonexistent" "${TMP}/install"
|
||||
assert [ "$status" -eq 2 ]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ stub_ruby_build() {
|
|||
}
|
||||
|
||||
@test "install proper" {
|
||||
stub_ruby_build 'echo ruby-build "$@"'
|
||||
stub_ruby_build 'echo 2.1.2' 'echo ruby-build "$@"'
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success "ruby-build 2.1.2 ${RBENV_ROOT}/versions/2.1.2"
|
||||
|
|
@ -27,7 +27,7 @@ stub_ruby_build() {
|
|||
}
|
||||
|
||||
@test "install with flags" {
|
||||
stub_ruby_build 'echo "ruby-build $(inspect_args "$@")"'
|
||||
stub_ruby_build 'echo 2.1.2' 'echo "ruby-build $(inspect_args "$@")"'
|
||||
|
||||
run rbenv-install -kpv 2.1.2 -- --with-configure-opt="hello world"
|
||||
assert_success "ruby-build --keep --verbose --patch 2.1.2 ${RBENV_ROOT}/versions/2.1.2 -- \"--with-configure-opt=hello world\""
|
||||
|
|
@ -39,7 +39,7 @@ stub_ruby_build() {
|
|||
|
||||
@test "suggest running rbenv global after install" {
|
||||
rm -rf "$RBENV_ROOT/version"
|
||||
stub_ruby_build 'echo ruby-build "$@"'
|
||||
stub_ruby_build 'echo 2.1.2' 'echo ruby-build "$@"'
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success <<OUT
|
||||
|
|
@ -52,7 +52,7 @@ OUT
|
|||
}
|
||||
|
||||
@test "install rbenv local version by default" {
|
||||
stub_ruby_build 'echo ruby-build "$1"'
|
||||
stub_ruby_build 'echo 2.1.2' 'echo ruby-build "$1"'
|
||||
stub rbenv-local 'echo 2.1.2'
|
||||
|
||||
run rbenv-install
|
||||
|
|
@ -100,7 +100,8 @@ OUT
|
|||
fi
|
||||
|
||||
stub_repeated brew false
|
||||
stub_ruby_build 'echo ERROR >&2 && exit 2' \
|
||||
stub_ruby_build 'exit 1' \
|
||||
'echo ERROR >&2 && exit 2' \
|
||||
"--definitions : echo 1.8.7 1.9.3-p0 1.9.3-p194 2.1.2 | tr ' ' $'\\n'"
|
||||
|
||||
run rbenv-install 1.9.3
|
||||
|
|
@ -127,10 +128,11 @@ OUT
|
|||
|
||||
@test "Homebrew upgrade instructions" {
|
||||
stub brew "--prefix : echo '${BATS_TEST_DIRNAME%/*}'"
|
||||
stub_ruby_build 'echo ERROR >&2 && exit 2' \
|
||||
stub_ruby_build 'exit 1' \
|
||||
'echo ERROR >&2 && exit 2' \
|
||||
"--definitions : true"
|
||||
|
||||
run rbenv-install 1.9.3
|
||||
run rbenv-install 1.9.10
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
ERROR
|
||||
|
|
@ -148,7 +150,8 @@ OUT
|
|||
|
||||
@test "no build definitions from plugins" {
|
||||
refute [ -e "${RBENV_ROOT}/plugins" ]
|
||||
stub_ruby_build 'echo $RUBY_BUILD_DEFINITIONS'
|
||||
stub_ruby_build 'echo 2.1.2' \
|
||||
'echo $RUBY_BUILD_DEFINITIONS'
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success ""
|
||||
|
|
@ -157,7 +160,8 @@ OUT
|
|||
@test "some build definitions from plugins" {
|
||||
mkdir -p "${RBENV_ROOT}/plugins/foo/share/ruby-build"
|
||||
mkdir -p "${RBENV_ROOT}/plugins/bar/share/ruby-build"
|
||||
stub_ruby_build "echo \$RUBY_BUILD_DEFINITIONS | tr ':' $'\\n'"
|
||||
stub_ruby_build 'echo 2.1.2' \
|
||||
"echo \$RUBY_BUILD_DEFINITIONS | tr ':' $'\\n'"
|
||||
|
||||
run rbenv-install 2.1.2
|
||||
assert_success
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue