mirror of
https://github.com/rbenv/ruby-build.git
synced 2026-11-10 16:19:19 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d8999e9d1 | ||
|
|
e9129e5a34 | ||
|
|
972498d4bf | ||
|
|
aacb3afe1b | ||
|
|
4fbb207e0f | ||
|
|
59269d1571 | ||
|
|
d6da2d5fda | ||
|
|
6990108a1e | ||
|
|
2948dee888 | ||
|
|
97a48518e5 | ||
|
|
b5cc9ffb8b | ||
|
|
296cdb4384 | ||
|
|
eed1cd5f0c | ||
|
|
7c06228378 | ||
|
|
c152a226e6 | ||
|
|
7311e0dc23 |
777 changed files with 899 additions and 9195 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
|
@ -1 +0,0 @@
|
|||
/share/man/man[1-8]/*.[1-8] linguist-generated
|
||||
16
.github/ISSUE_TEMPLATE/bug.md
vendored
16
.github/ISSUE_TEMPLATE/bug.md
vendored
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
name: "🐛 Bug report"
|
||||
about: Report a bug with ruby-build. For "BUILD FAILED" scenarios, see below
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
|
||||
### Expected vs. actual behavior
|
||||
|
||||
### Logs
|
||||
|
||||
<!-- Paste the output from your terminal. Please enclose the pasted content within triple backticks. If the output suggests the full log was written to a file, copy the contents of that file to a new Gist and link it here. -->
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,8 +0,0 @@
|
|||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: BUILD FAILED
|
||||
about: Check the Discussions section for reports of a failing Ruby build. Submit your experience (plus logs) if you cannot find reports similar to yours.
|
||||
url: https://github.com/rbenv/ruby-build/discussions
|
||||
- name: Suggested build environment
|
||||
about: Review the instructions about the suggested build environment for your operating system.
|
||||
url: https://github.com/rbenv/ruby-build/wiki
|
||||
8
.github/ISSUE_TEMPLATE/enhancement.md
vendored
8
.github/ISSUE_TEMPLATE/enhancement.md
vendored
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: "⭐ Submit a feature request"
|
||||
about: Suggest a feature to be added to ruby-build
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
|
|
@ -1,6 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: 'github-actions'
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
|
|
@ -1,22 +0,0 @@
|
|||
name: Test
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install bats
|
||||
run: git clone --depth 1 --branch v1.10.0 https://github.com/bats-core/bats-core.git bats
|
||||
- name: Run tests
|
||||
run: PATH="./bats/bin:$PATH" script/test
|
||||
29
.github/workflows/differential-shellcheck.yml
vendored
29
.github/workflows/differential-shellcheck.yml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
# Doc: https://github.com/redhat-plumbers-in-action/differential-shellcheck#usage
|
||||
---
|
||||
|
||||
name: Differential ShellCheck
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Repository checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Differential ShellCheck
|
||||
uses: redhat-plumbers-in-action/differential-shellcheck@v5
|
||||
with:
|
||||
severity: warning
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
19
.github/workflows/release.yml
vendored
19
.github/workflows/release.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags: 'v*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
homebrew:
|
||||
name: Bump Homebrew formula
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mislav/bump-homebrew-formula-action@v4
|
||||
if: "!contains(github.ref, '-')" # skip prereleases
|
||||
with:
|
||||
formula-name: ruby-build
|
||||
env:
|
||||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
|
||||
49
.github/workflows/update-ruby.yml
vendored
49
.github/workflows/update-ruby.yml
vendored
|
|
@ -1,49 +0,0 @@
|
|||
name: Update Ruby definitions
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ruby_version:
|
||||
description: 'Ruby version'
|
||||
required: true
|
||||
default: '3.3.4'
|
||||
openssl_version:
|
||||
description: 'OpenSSL version'
|
||||
required: true
|
||||
default: '3.0.15'
|
||||
|
||||
repository_dispatch:
|
||||
types: [update-ruby]
|
||||
|
||||
jobs:
|
||||
update-ruby:
|
||||
name: Update Ruby definitions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Store Ruby version
|
||||
run: echo "RUBY_VERSION=${{ github.event.client_payload.ruby_version || github.event.inputs.ruby_version }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Store ABI version
|
||||
run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV
|
||||
|
||||
- name: Store OpenSSL version
|
||||
run: echo "OPENSSL_VERSION=${{ github.event.client_payload.openssl_version || github.event.inputs.openssl_version }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Run script/update-cruby
|
||||
run: |
|
||||
curl -fsL https://cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz -O
|
||||
curl -fsL https://www.openssl.org/source/openssl-${{ env.OPENSSL_VERSION }}.tar.gz -O
|
||||
script/update-cruby ${{ env.RUBY_VERSION }} ${{ env.OPENSSL_VERSION }} .
|
||||
rm *.gz
|
||||
|
||||
- name: commit and push
|
||||
run: |
|
||||
git config user.name "GitHub Actions Bot"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add .
|
||||
git commit -m "Added ${{ env.RUBY_VERSION }} with OpenSSL ${{ env.OPENSSL_VERSION }}"
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
/bats
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting one of the project maintainers listed below. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Project Maintainers
|
||||
|
||||
* Sam Stephenson <<sstephenson@gmail.com>>
|
||||
* Mislav Marohnić <<mislav.marohnic@gmail.com>>
|
||||
* Erik Michaels-Ober <<sferik@gmail.com>>
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
## Adding a new Ruby version
|
||||
|
||||
Use one of the scripts `script/update-*` to add a new Ruby version.
|
||||
|
||||
## Updating OpenSSL
|
||||
|
||||
Use `script/update-openssl`.
|
||||
33
LICENSE
33
LICENSE
|
|
@ -1,19 +1,20 @@
|
|||
Copyright (c) 2012-2013 Sam Stephenson
|
||||
Copyright (c) 2011 Sam Stephenson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
|
|||
9
Makefile
9
Makefile
|
|
@ -1,9 +0,0 @@
|
|||
release_version := $(shell grep "^RUBY_BUILD_VERSION" bin/ruby-build | cut -d\" -f2)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
bash install.sh
|
||||
|
||||
share/man/man1/%.1: share/man/man1/%.1.adoc bin/ruby-build
|
||||
which asciidoctor || gem install asciidoctor
|
||||
asciidoctor -b manpage -a version=$(release_version:v%=%) -o $@ $<
|
||||
270
README.md
270
README.md
|
|
@ -1,229 +1,95 @@
|
|||
# ruby-build
|
||||
|
||||
ruby-build is a command-line tool that simplifies installation of any Ruby version from source on Unix-like systems.
|
||||
ruby-build provides a simple way to compile and install different
|
||||
versions of Ruby on UNIX-like systems.
|
||||
|
||||
It is available as a plugin for [rbenv][] as the `rbenv install` command, or as a standalone program as the `ruby-build` command.
|
||||
### Installing ruby-build
|
||||
|
||||
## Installation
|
||||
$ git clone git://github.com/sstephenson/ruby-build.git
|
||||
$ cd ruby-build
|
||||
$ ./install.sh
|
||||
|
||||
### Homebrew package manager
|
||||
```sh
|
||||
brew install ruby-build
|
||||
```
|
||||
This will install ruby-build into `/usr/local`. If you do not have
|
||||
write permission to `/usr/local`, you will need to run `sudo
|
||||
./install.sh` instead. You can install to a different prefix by
|
||||
setting the `PREFIX` environment variable.
|
||||
|
||||
Upgrade with:
|
||||
```sh
|
||||
brew upgrade ruby-build
|
||||
```
|
||||
### Installing Ruby
|
||||
|
||||
### Clone as rbenv plugin using git
|
||||
```sh
|
||||
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
|
||||
```
|
||||
To install a Ruby version, run the `ruby-build` command with the path
|
||||
to a definition file and the path where you want to install it. (A
|
||||
number of [built-in
|
||||
definitions](https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build)
|
||||
may be specified instead.)
|
||||
|
||||
Upgrade with:
|
||||
```sh
|
||||
git -C "$(rbenv root)"/plugins/ruby-build pull
|
||||
```
|
||||
$ ruby-build 1.9.2-p290 ~/local/ruby-1.9.2-p290
|
||||
...
|
||||
$ ~/local/ruby-1.9.2-p290/bin/ruby --version
|
||||
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
|
||||
|
||||
### Install manually as a standalone program
|
||||
You can use it with [rbenv](https://github.com/sstephenson/rbenv):
|
||||
|
||||
First, download a tarball from https://github.com/rbenv/ruby-build/releases/latest. Then:
|
||||
```sh
|
||||
tar -xzf ruby-build-*.tar.gz
|
||||
PREFIX=/usr/local ./ruby-build-*/install.sh
|
||||
```
|
||||
$ ruby-build 1.9.2-p290 ~/.rbenv/versions/1.9.2-p290
|
||||
|
||||
## Usage
|
||||
ruby-build provides an `rbenv-install` command that shortens this to:
|
||||
|
||||
### Basic Usage
|
||||
$ rbenv install 1.9.2-p290
|
||||
|
||||
```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.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
|
||||
### Version History
|
||||
|
||||
# As an rbenv plugin
|
||||
$ rbenv install 3.4.9 # installs Ruby 3.4.9 to ~/.rbenv/versions/3.4.9
|
||||
$ rbenv install 3 # installs latest Ruby 3.x
|
||||
```
|
||||
#### 20110928
|
||||
|
||||
> [!WARNING]
|
||||
> ruby-build mostly does not verify that system dependencies are present before downloading and attempting to compile Ruby from source. Please ensure that [all requisite libraries][build-env] such as build tools and development headers are already present on your system.
|
||||
* ruby-build now uses the `--with-gcc` configure flag on OS X Lion.
|
||||
* Added definitions for REE 1.8.7-2010.02 and 1.8.6-2009.06.
|
||||
* Modified `rbenv-install` to run `rbenv rehash` after installation.
|
||||
* Added a Ruby 1.9.3-rc1 definition.
|
||||
* Updated the JRuby defintions to install the `jruby-launcher` gem.
|
||||
* Updated the rbx-2.0.0 definition to point to the master branch.
|
||||
* Added a jruby-1.7.0-dev definition.
|
||||
* Added a Ruby 1.9.4-dev definition.
|
||||
|
||||
Basically, what ruby-build does when installing a Ruby version is this:
|
||||
- Downloads an official tarball of Ruby source code;
|
||||
- Extracts the archive into a temporary directory on your system;
|
||||
- Executes `./configure --prefix=/path/to/destination` in the source code;
|
||||
- Runs `make install` to compile Ruby;
|
||||
- Verifies that the installed Ruby is functional.
|
||||
#### 20110914
|
||||
|
||||
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.
|
||||
* Added an rbx-2.0.0-dev definition for Rubinius 2.0.0 from git.
|
||||
* Added support for setting `./configure` options with the
|
||||
`CONFIGURE_OPTS` environment variable.
|
||||
* Added a 1.9.3-dev definition for Ruby 1.9.3 from Git.
|
||||
* Added support for fetching package sources via Git.
|
||||
* Added an `rbenv-install` script which provides an `install` command
|
||||
for rbenv users.
|
||||
|
||||
### Ruby versions
|
||||
#### 20110906.1
|
||||
|
||||
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.
|
||||
* Changed the REE definition not to install its default gem
|
||||
collection.
|
||||
* Reverted a poorly-tested change that intended to enable support for
|
||||
relative installation paths.
|
||||
|
||||
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.
|
||||
#### 20110906
|
||||
|
||||
### Ruby implementations
|
||||
* Initial public release.
|
||||
|
||||
ruby-build ships with definitions for the following Ruby implementations, denoted by version prefixes in the `ruby-build --list` output:
|
||||
### License
|
||||
|
||||
- [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.
|
||||
(The MIT License)
|
||||
|
||||
- `jruby`: [JRuby][] is a high-performance Ruby implementation with real threading built on top of the Java virtual machine (JVM).
|
||||
Copyright (c) 2011 Sam Stephenson
|
||||
|
||||
- `mruby`: [mruby][] is a lightweight, embeddable Ruby implementation for microcontrollers.
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
- `picoruby`: [PicoRuby][] is an alternative mruby implementation for one-chip microcontrollers.
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
- `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
|
||||
|
||||
To install a version of Ruby that is not available in ruby-build, you can specify the path to a custom build definition file in place of a Ruby version number.
|
||||
|
||||
```sh
|
||||
# As a standalone program
|
||||
$ ruby-build -d /path/to/3.4-custom /opt/rubies # installs to /opt/rubies/3.4-custom
|
||||
|
||||
# As an rbenv plugin
|
||||
$ rbenv install /path/to/3.4-custom # installs to $(rbenv root)/versions/3.4-custom
|
||||
```
|
||||
|
||||
You can also provide a _directory_ of custom build definition files.
|
||||
The path(s) will be searched along with ruby-build's bundled `share/ruby-build/` directory.
|
||||
(Perhaps a collection of 3rd-party build definitions published as a git repo,
|
||||
or an organization's custom build definitions distributed in-house.)
|
||||
|
||||
```sh
|
||||
# As a standalone program
|
||||
$ RUBY_BUILD_DEFINITIONS=/path/to/custom/defs ruby-build --definitions # lists all available versions of Ruby, including custom defs
|
||||
$ RUBY_BUILD_DEFINITIONS=/path/to/custom/defs ruby-build -d 3.5-custom /opt/rubies # installs to /opt/rubies/3.5-custom
|
||||
|
||||
# As an rbenv plugin
|
||||
$ RUBY_BUILD_DEFINITIONS=/path/to/custom/defs rbenv install --list # lists all available versions of Ruby, including custom defs
|
||||
$ RUBY_BUILD_DEFINITIONS=/path/to/custom/defs rbenv install 3.5-custom # installs to $(rbenv root)/versions/3.5-custom
|
||||
```
|
||||
|
||||
Check out [default build definitions][definitions] as examples on how to write definition files.
|
||||
|
||||
#### Custom Build Configuration
|
||||
|
||||
The build process may be configured through the following environment variables:
|
||||
|
||||
| Variable | Function |
|
||||
| ------------------------------- | ------------------------------------------------------------------------------------------------ |
|
||||
| `TMPDIR` | Where temporary files are stored. |
|
||||
| `RUBY_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) |
|
||||
| `RUBY_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.rbenv/cache` if invoked as rbenv plugin) |
|
||||
| `RUBY_BUILD_HTTP_CLIENT` | One of `aria2c`, `curl`, or `wget` to use for downloading. (Default: first one found in PATH) |
|
||||
| `RUBY_BUILD_ARIA2_OPTS` | Additional options to pass to `aria2c` for downloading. |
|
||||
| `RUBY_BUILD_CURL_OPTS` | Additional options to pass to `curl` for downloading. |
|
||||
| `RUBY_BUILD_WGET_OPTS` | Additional options to pass to `wget` for downloading. |
|
||||
| `RUBY_BUILD_MIRROR_URL` | Custom mirror URL root. |
|
||||
| `RUBY_BUILD_MIRROR_PACKAGE_URL` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz). |
|
||||
| `RUBY_BUILD_SKIP_MIRROR` | Bypass the download mirror and fetch all package files from their original URLs. |
|
||||
| `RUBY_BUILD_TARBALL_OVERRIDE` | Override the URL to fetch the ruby tarball from, optionally followed by `#checksum`. |
|
||||
| `RUBY_BUILD_DEFINITIONS` | Colon-separated list of paths to search for build definition files. |
|
||||
| `RUBY_BUILD_ROOT` | The path prefix to search for build definitions files. *Deprecated:* use `RUBY_BUILD_DEFINITIONS`|
|
||||
| `RUBY_BUILD_VENDOR_OPENSSL` | Build and vendor openssl even if the system openssl is compatible |
|
||||
| `CC` | Path to the C compiler. |
|
||||
| `RUBY_CFLAGS` | Overrides Ruby's default `CFLAGS`, including `-O3` (beware: without a `-O` flag Ruby is built unoptimized). To add flags, use `RUBY_CONFIGURE_OPTS=cflags=...` instead |
|
||||
| `CONFIGURE_OPTS` | Additional `./configure` options. |
|
||||
| `MAKE` | Custom `make` command (_e.g.,_ `gmake`). |
|
||||
| `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. |
|
||||
| `MAKE_INSTALL_OPTS` | Additional `make install` options. |
|
||||
| `RUBY_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Ruby source). |
|
||||
| `RUBY_MAKE_OPTS` | Additional `make` options (applies only to Ruby source). |
|
||||
| `RUBY_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Ruby source). |
|
||||
| `NO_COLOR` | Disable ANSI colors in output. The default is to use colors for output connected to a terminal. |
|
||||
| `CLICOLOR_FORCE` | Use ANSI colors in output even when not connected to a terminal. |
|
||||
| `RUBY_REPO` | The URL of the git repository to use when building `ruby-dev` |
|
||||
| `RUBY_REF` | The git branch (or revision) to use when building `ruby-dev`, e.g. `some-branch@af12decf` |
|
||||
|
||||
#### Applying Patches
|
||||
|
||||
Both `rbenv install` and `ruby-build` commands support the `-p/--patch` flag to apply a patch to the Ruby source code before building. Patches are read from standard input:
|
||||
|
||||
```sh
|
||||
# applying a single patch
|
||||
$ rbenv install --patch 1.9.3-p429 < /path/to/ruby.patch
|
||||
|
||||
# applying a patch from HTTP
|
||||
$ rbenv install --patch 1.9.3-p429 < <(curl -sSL http://git.io/ruby.patch)
|
||||
|
||||
# applying multiple patches
|
||||
$ cat fix1.patch fix2.patch | rbenv install --patch 1.9.3-p429
|
||||
```
|
||||
|
||||
#### Checksum Verification
|
||||
|
||||
All Ruby definition files bundled with ruby-build include checksums for packages, meaning that all externally downloaded packages are automatically checked for integrity after fetching.
|
||||
|
||||
See the next section for more information on how to author checksums.
|
||||
|
||||
#### Package Mirrors
|
||||
|
||||
You may specify a custom mirror by setting `RUBY_BUILD_MIRROR_URL`. When set,
|
||||
ruby-build will first attempt to download packages from the mirror before falling
|
||||
back to the original URL.
|
||||
|
||||
```sh
|
||||
# example:
|
||||
export RUBY_BUILD_MIRROR_URL="https://my-mirror.example.com"
|
||||
install_package "ruby-2.6.5" "https://ruby-lang.org/ruby-2.6.5.tgz#<SHA2>"
|
||||
# Will first try: https://my-mirror.example.com/<SHA2>
|
||||
```
|
||||
|
||||
ruby-build will first try to fetch this package from `$RUBY_BUILD_MIRROR_URL/<SHA2>`
|
||||
(note: this is the complete URL), where `<SHA2>` is the checksum for the file. It
|
||||
will fall back to downloading the package from the original location if:
|
||||
- the package was not found on the mirror;
|
||||
- the mirror is down;
|
||||
- the download is corrupt, i.e. the file's checksum doesn't match;
|
||||
- no tool is available to calculate the checksum; or
|
||||
- `RUBY_BUILD_SKIP_MIRROR` is enabled.
|
||||
|
||||
If a mirror site doesn't conform to the above URL format, you can specify the
|
||||
complete URL by setting `RUBY_BUILD_MIRROR_PACKAGE_URL`. It behaves the same as
|
||||
`RUBY_BUILD_MIRROR_URL` except being a complete URL.
|
||||
|
||||
#### Keeping the build directory after installation
|
||||
|
||||
Both `ruby-build` and `rbenv install` accept the `-k` or `--keep` flag, which
|
||||
tells ruby-build to keep the downloaded source after installation. This can be
|
||||
useful if you need to use `gdb` and `memprof` with Ruby.
|
||||
|
||||
Source code will be kept in a parallel directory tree `~/.rbenv/sources` when
|
||||
using `--keep` with the `rbenv install` command. You should specify the
|
||||
location of the source code with the `RUBY_BUILD_BUILD_PATH` environment
|
||||
variable when using `--keep` with `ruby-build`.
|
||||
|
||||
## Getting Help
|
||||
|
||||
Please see the [ruby-build wiki][wiki] for solutions to common problems.
|
||||
|
||||
If you can't find an answer on the wiki, open an issue on the [issue tracker][].
|
||||
Be sure to include the full build log for build failures.
|
||||
|
||||
|
||||
[rbenv]: https://github.com/rbenv/rbenv#readme
|
||||
[definitions]: https://github.com/rbenv/ruby-build/tree/master/share/ruby-build
|
||||
[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
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
|
|||
8
TODO
Normal file
8
TODO
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Binary packages
|
||||
---------------
|
||||
|
||||
X Better error messages
|
||||
X Show 'Downloading' and 'Installing' messages a la ruby-build
|
||||
* Rewrite RbConfig::CONFIG['CC'] on install
|
||||
* Patch rbx since the rewriter doesn't work there
|
||||
X rbenv-install should check for binary packages before building
|
||||
|
|
@ -1,278 +1,82 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Summary: Install a Ruby version using ruby-build
|
||||
#
|
||||
# Usage: rbenv install [-f|-s] [-kpv] <version> [-- <configure-args...>]
|
||||
# rbenv install [-f|-s] [-kpv] <definition-file>
|
||||
# rbenv install --list
|
||||
# rbenv install --version
|
||||
#
|
||||
# -l, --list List latest stable versions for each Ruby
|
||||
# -L, --list-all List all local versions, including outdated ones
|
||||
# -f, --force Allow overwriting an existing installed version
|
||||
# -s, --skip-existing Avoid overwriting an existing installed version
|
||||
#
|
||||
# ruby-build options:
|
||||
#
|
||||
# -v, --verbose Verbose mode: forward all build output to stdout/stderr
|
||||
# -p, --patch Apply a patch from stdin before building
|
||||
# -k, --keep Keep source tree in RBENV_BUILD_ROOT after installation
|
||||
# (defaults to "RBENV_ROOT/sources")
|
||||
# --version Show version of ruby-build
|
||||
#
|
||||
# For detailed information on installing Ruby versions with ruby-build,
|
||||
# including a list of environment variables for adjusting compilation,
|
||||
# see: https://github.com/rbenv/ruby-build#usage
|
||||
#
|
||||
set -e
|
||||
[ -n "$RBENV_DEBUG" ] && set -x
|
||||
|
||||
# Add `share/ruby-build/` directory from each rbenv plugin to the list of
|
||||
# paths where build definitions are looked up.
|
||||
shopt -s nullglob
|
||||
for plugin_path in "$RBENV_ROOT"/plugins/*/share/ruby-build; do
|
||||
RUBY_BUILD_DEFINITIONS="${RUBY_BUILD_DEFINITIONS}:${plugin_path}"
|
||||
done
|
||||
export RUBY_BUILD_DEFINITIONS
|
||||
shopt -u nullglob
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) $1
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
usage() {
|
||||
{ echo "usage: rbenv install [--build | --package] VERSION"
|
||||
echo " rbenv install /path/to/definition"
|
||||
echo
|
||||
echo "Available versions:"
|
||||
ruby-build --definitions | sed 's/^/ /'
|
||||
echo
|
||||
} >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
bin_dir="$(abs_dirname "$0")"
|
||||
export PATH="${bin_dir}:$PATH"
|
||||
|
||||
# Provide rbenv completions
|
||||
if [ "$1" = "--complete" ]; then
|
||||
echo --list
|
||||
echo --list-all
|
||||
echo --force
|
||||
echo --skip-existing
|
||||
echo --keep
|
||||
echo --patch
|
||||
echo --verbose
|
||||
echo --version
|
||||
exec ruby-build --definitions
|
||||
fi
|
||||
|
||||
# Load shared library functions
|
||||
eval "$(ruby-build --lib)"
|
||||
force_build=""
|
||||
force_package=""
|
||||
if [ "$1" = "--build" ]; then
|
||||
force_build=1
|
||||
shift
|
||||
elif [ "$1" = "--package" ]; then
|
||||
force_package=1
|
||||
shift
|
||||
fi
|
||||
|
||||
usage() {
|
||||
rbenv-help install 2>/dev/null
|
||||
[ -z "$1" ] || exit "$1"
|
||||
definition="$1"
|
||||
case "$definition" in
|
||||
"" | -* )
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$RBENV_ROOT" ]; then
|
||||
RBENV_ROOT="${HOME}/.rbenv"
|
||||
fi
|
||||
|
||||
version_name="${definition##*/}"
|
||||
prefix="${RBENV_ROOT}/versions/${version_name}"
|
||||
|
||||
package() {
|
||||
ruby-package install $* "$definition" "$prefix"
|
||||
}
|
||||
|
||||
definitions() {
|
||||
local query="$1"
|
||||
ruby-build --definitions | $(type -p ggrep grep | head -1) -F "$query" || true
|
||||
build() {
|
||||
ruby-build "$definition" "$prefix"
|
||||
}
|
||||
|
||||
suggest_selecting_global() {
|
||||
# shellcheck disable=SC2155
|
||||
local version_file="$(rbenv-version-file)"
|
||||
[[ "$version_file" != "$RBENV_ROOT"/version || -e "$version_file" ]] && return 0
|
||||
echo
|
||||
colorize 1 "NOTE:"
|
||||
echo -n " to activate this Ruby version as the new default, run: "
|
||||
colorize 33 "rbenv global $VERSION_NAME"
|
||||
echo
|
||||
}
|
||||
|
||||
colorize() {
|
||||
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
|
||||
else printf "%s" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
indent() {
|
||||
sed 's/^/ /'
|
||||
}
|
||||
|
||||
unset FORCE
|
||||
unset SKIP_EXISTING
|
||||
unset KEEP
|
||||
unset VERBOSE
|
||||
unset HAS_PATCH
|
||||
|
||||
parse_options "$@"
|
||||
for option in "${OPTIONS[@]}"; do
|
||||
case "$option" in
|
||||
"h" | "help" )
|
||||
usage 0
|
||||
;;
|
||||
"l" | "list" )
|
||||
ruby-build --list
|
||||
[ ! -t 1 ] || {
|
||||
echo
|
||||
echo "Only latest stable releases for each Ruby implementation are shown."
|
||||
echo "Use \`rbenv install --list-all' to show all local versions."
|
||||
} 1>&2
|
||||
exit
|
||||
;;
|
||||
"L" | "list-all" )
|
||||
ruby-build --definitions
|
||||
exit
|
||||
;;
|
||||
"f" | "force" )
|
||||
FORCE=true
|
||||
;;
|
||||
"s" | "skip-existing" )
|
||||
SKIP_EXISTING=true
|
||||
;;
|
||||
"k" | "keep" )
|
||||
[ -n "${RBENV_BUILD_ROOT}" ] || RBENV_BUILD_ROOT="${RBENV_ROOT}/sources"
|
||||
;;
|
||||
"v" | "verbose" )
|
||||
VERBOSE="-v"
|
||||
;;
|
||||
"p" | "patch" )
|
||||
HAS_PATCH="-p"
|
||||
;;
|
||||
"version" )
|
||||
exec ruby-build --version
|
||||
;;
|
||||
* )
|
||||
usage 1 >&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ "${#ARGUMENTS[@]}" -le 1 ] || usage 1 >&2
|
||||
|
||||
# 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
|
||||
# version is not specified.
|
||||
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"
|
||||
if [ -n "$force_build" ]; then
|
||||
build
|
||||
elif [ -n "$force_package" ]; then
|
||||
package
|
||||
else
|
||||
unset VERSION_NAME
|
||||
package --fail-silently || build
|
||||
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.
|
||||
declare -a before_hooks after_hooks
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
before_install() {
|
||||
local hook="$1"
|
||||
before_hooks["${#before_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
after_install() {
|
||||
local hook="$1"
|
||||
after_hooks["${#after_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks install)" || true
|
||||
# shellcheck disable=SC1090
|
||||
for script in "${scripts[@]}"; do source "$script"; done
|
||||
|
||||
|
||||
# Set VERSION_NAME from $DEFINITION, if it is not already set. Then
|
||||
# compute the installation prefix.
|
||||
[ -n "$VERSION_NAME" ] || VERSION_NAME="${DEFINITION##*/}"
|
||||
PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
|
||||
|
||||
[ -d "${PREFIX}" ] && PREFIX_EXISTS=1
|
||||
|
||||
# If the installation prefix exists, prompt for confirmation unless
|
||||
# the --force option was specified.
|
||||
if [ -d "${PREFIX}/bin" ]; then
|
||||
if [ -z "$FORCE" ] && [ -z "$SKIP_EXISTING" ]; then
|
||||
echo "rbenv: $PREFIX already exists" >&2
|
||||
if [ ! -t 0 ]; then
|
||||
echo "rbenv: must use \`--force' or \`--skip-existing' in non-interactive mode" >&2
|
||||
exit 1
|
||||
fi
|
||||
read -rp "continue with installation? (y/N) "
|
||||
|
||||
case "$REPLY" in
|
||||
y* | Y* ) ;;
|
||||
* ) exit 1 ;;
|
||||
esac
|
||||
elif [ -n "$SKIP_EXISTING" ]; then
|
||||
# Since we know the ruby version is already installed, and are opting to
|
||||
# not force installation of existing versions, we just `exit 0` here to
|
||||
# leave things happy
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# If RBENV_BUILD_ROOT is set, always pass keep options to ruby-build.
|
||||
if [ -n "${RBENV_BUILD_ROOT}" ]; then
|
||||
export RUBY_BUILD_BUILD_PATH="${RBENV_BUILD_ROOT}/${VERSION_NAME}"
|
||||
KEEP="-k"
|
||||
fi
|
||||
|
||||
# Set RUBY_BUILD_CACHE_PATH to $RBENV_ROOT/cache, if the directory
|
||||
# exists and the variable is not already set.
|
||||
if [ -z "${RUBY_BUILD_CACHE_PATH}" ] && [ -d "${RBENV_ROOT}/cache" ]; then
|
||||
export RUBY_BUILD_CACHE_PATH="${RBENV_ROOT}/cache"
|
||||
fi
|
||||
|
||||
# Default RBENV_VERSION to the globally-specified Ruby version. (The
|
||||
# REE installer requires an existing Ruby installation to run. An
|
||||
# unsatisfied local .ruby-version file can cause the installer to
|
||||
# fail.)
|
||||
# shellcheck disable=SC2155
|
||||
export RBENV_VERSION="$(rbenv-global 2>/dev/null || true)"
|
||||
|
||||
|
||||
# Execute `before_install` hooks.
|
||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
# Plan cleanup on unsuccessful installation.
|
||||
cleanup() {
|
||||
[ -z "${PREFIX_EXISTS}" ] && rm -rf "$PREFIX"
|
||||
}
|
||||
|
||||
trap cleanup SIGINT
|
||||
|
||||
build_args=(${KEEP:+--keep} ${VERBOSE:+--verbose} ${HAS_PATCH:+--patch} "$DEFINITION" "$PREFIX")
|
||||
[ ${#EXTRA_ARGUMENTS[@]} -eq 0 ] || build_args+=(-- "${EXTRA_ARGUMENTS[@]}")
|
||||
|
||||
# Invoke `ruby-build` and record the exit status in $STATUS.
|
||||
STATUS=0
|
||||
ruby-build "${build_args[@]}" || STATUS="$?"
|
||||
|
||||
# Display a more helpful message if the definition wasn't found.
|
||||
if [ "$STATUS" == "2" ]; then
|
||||
{ candidates="$(definitions "$DEFINITION")"
|
||||
here="$(dirname "${0%/*}")"
|
||||
if [ -n "$candidates" ]; then
|
||||
echo
|
||||
echo "The following versions contain \`$DEFINITION' in the name:"
|
||||
echo "$candidates" | indent
|
||||
fi
|
||||
echo
|
||||
echo "See all available versions with \`rbenv install --list-all'."
|
||||
echo
|
||||
echo -n "If the version you need is missing, try upgrading ruby-build"
|
||||
if [ "$here" != "${here#"$(brew --prefix 2>/dev/null)"}" ]; then
|
||||
printf ":\n\n"
|
||||
echo " brew upgrade ruby-build"
|
||||
elif [ -d "${here}/.git" ]; then
|
||||
display_here="$here"
|
||||
[[ -z "${HOME%/}" || $here != "${HOME}/"* ]] || display_here="~${here#"$HOME"}"
|
||||
printf ":\n\n"
|
||||
echo " git -C $display_here pull"
|
||||
else
|
||||
printf ".\n"
|
||||
fi
|
||||
} >&2
|
||||
fi
|
||||
|
||||
# Execute `after_install` hooks.
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
# Run `rbenv-rehash` after a successful installation.
|
||||
if [ "$STATUS" == "0" ]; then
|
||||
rbenv-rehash
|
||||
suggest_selecting_global
|
||||
else
|
||||
cleanup
|
||||
fi
|
||||
|
||||
exit "$STATUS"
|
||||
rbenv rehash
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Summary: Uninstall a specific Ruby version
|
||||
#
|
||||
# Usage: rbenv uninstall [-f|--force] <version>
|
||||
#
|
||||
# -f Attempt to remove the specified version without prompting
|
||||
# for confirmation. If the version does not exist, do not
|
||||
# display an error message.
|
||||
#
|
||||
# See `rbenv versions` for a complete list of installed versions.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Provide rbenv completions
|
||||
if [ "$1" = "--complete" ]; then
|
||||
echo --force
|
||||
exec rbenv versions --bare
|
||||
fi
|
||||
|
||||
usage() {
|
||||
rbenv-help uninstall 2>/dev/null
|
||||
[ -z "$1" ] || exit "$1"
|
||||
}
|
||||
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
usage 0
|
||||
fi
|
||||
|
||||
unset FORCE
|
||||
if [ "$1" = "-f" ] || [ "$1" = "--force" ]; then
|
||||
FORCE=true
|
||||
shift
|
||||
fi
|
||||
|
||||
[ "$#" -eq 1 ] || usage 1 >&2
|
||||
|
||||
DEFINITION="$1"
|
||||
case "$DEFINITION" in
|
||||
"" | -* )
|
||||
usage 1 >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
declare -a before_hooks after_hooks
|
||||
|
||||
before_uninstall() {
|
||||
local hook="$1"
|
||||
before_hooks["${#before_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
after_uninstall() {
|
||||
local hook="$1"
|
||||
after_hooks["${#after_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n' scripts=(`rbenv-hooks uninstall`)
|
||||
IFS="$OLDIFS"
|
||||
for script in "${scripts[@]}"; do source "$script"; done
|
||||
|
||||
|
||||
VERSION_NAME="${DEFINITION##*/}"
|
||||
PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
|
||||
|
||||
if [ -z "$FORCE" ]; then
|
||||
if [ ! -d "$PREFIX" ]; then
|
||||
echo "rbenv: version \`$VERSION_NAME' not installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -t 0 ]; then
|
||||
echo "rbenv: must use \`--force' in non-interactive mode" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "rbenv: remove $PREFIX? [yN] "
|
||||
case "$REPLY" in
|
||||
y* | Y* ) ;;
|
||||
* ) exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
if [ -d "$PREFIX" ]; then
|
||||
rm -rf "$PREFIX"
|
||||
rbenv-rehash
|
||||
fi
|
||||
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
1712
bin/ruby-build
1712
bin/ruby-build
File diff suppressed because it is too large
Load diff
47
bin/ruby-package
Executable file
47
bin/ruby-package
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) $1
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: ruby-package <command> [<args>]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
bin_dir="$(abs_dirname "$0")"
|
||||
export PATH="${bin_dir}/../libexec:${bin_dir}:$PATH"
|
||||
|
||||
command="$1"
|
||||
command_path="$(command -v ruby-package-"$1" || true)"
|
||||
|
||||
if [ -z "$TMPDIR" ]; then
|
||||
export TMPDIR="/tmp"
|
||||
else
|
||||
export TMPDIR="${TMPDIR%/}"
|
||||
fi
|
||||
|
||||
if [ -z "$command" ]; then
|
||||
usage
|
||||
elif [ -z "$command_path" ]; then
|
||||
echo "ruby-package: ${command}: command not found" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
shift
|
||||
exec "$command_path" "$@"
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue