@@ -84,6 +84,7 @@ The build process may be configured through the following environment variables:
8484| ` RUBY_BUILD_WGET_OPTS ` | Additional options to pass to ` wget ` for downloading. |
8585| ` RUBY_BUILD_MIRROR_URL ` | Custom mirror URL root. |
8686| ` RUBY_BUILD_MIRROR_PACKAGE_URL ` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz). |
87+ | ` RUBY_BUILD_MIRROR_CMD ` | Custom mirror command (see [ below] ( #more-flexible-mirror-url ) for the usage). |
8788| ` RUBY_BUILD_SKIP_MIRROR ` | Bypass the download mirror and fetch all package files from their original URLs. |
8889| ` RUBY_BUILD_TARBALL_OVERRIDE ` | Override the URL to fetch the ruby tarball from, optionally followed by ` #checksum ` . |
8990| ` RUBY_BUILD_DEFINITIONS ` | Colon-separated list of paths to search for build definition files. |
@@ -150,6 +151,25 @@ complete URL by setting `RUBY_BUILD_MIRROR_PACKAGE_URL`. It behaves the same as
150151The default ruby-build download mirror is sponsored by
151152[ Basecamp] ( https://basecamp.com/ ) .
152153
154+ #### More flexible mirror URL
155+
156+ For more flexible mirror URL, you can provide a custom command to output the
157+ desired mirror URL, as shown below:
158+
159+ ``` sh
160+ # There are two arguments:
161+ # 1st arg: the original URL without checksum
162+ # 2nd arg: the checksum
163+ $ cat << 'EOF ' >./get_mirror_url && chmod +x ./get_mirror_url
164+ #!/bin/sh
165+ echo "$1" | sed "s/cache.ruby-lang.org/mirror.example.com/"
166+ EOF
167+
168+ $ export RUBY_BUILD_MIRROR_CMD=" $( pwd) /get_mirror_url"
169+ ```
170+
171+ After executing the above script in your shell, install a version as usual.
172+
153173#### Keeping the build directory after installation
154174
155175Both ` ruby-build ` and ` rbenv install ` accept the ` -k ` or ` --keep ` flag, which
0 commit comments