@@ -74,7 +74,8 @@ The build process may be configured through the following environment variables:
7474| ` RUBY_BUILD_CURL_OPTS ` | Additional options to pass to ` curl ` for downloading. |
7575| ` RUBY_BUILD_WGET_OPTS ` | Additional options to pass to ` wget ` for downloading. |
7676| ` RUBY_BUILD_MIRROR_URL ` | Custom mirror URL root. |
77- | ` RUBY_BUILD_MIRROR_PACKAGE_URL ` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz). |
77+ | ` RUBY_BUILD_MIRROR_PACKAGE_URL ` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz). |
78+ | ` RUBY_BUILD_MIRROR_CMD ` | Custom mirror command (see [ below] ( #more-flexible-mirror-url ) for the usage). |
7879| ` RUBY_BUILD_SKIP_MIRROR ` | Bypass the download mirror and fetch all package files from their original URLs. |
7980| ` RUBY_BUILD_ROOT ` | Custom build definition directory. (Default: ` share/ruby-build ` ) |
8081| ` RUBY_BUILD_DEFINITIONS ` | Additional paths to search for build definitions. (Colon-separated list) |
@@ -142,6 +143,25 @@ complete URL by setting `RUBY_BUILD_MIRROR_PACKAGE_URL`. It behaves the same as
142143The default ruby-build download mirror is sponsored by
143144[ Basecamp] ( https://basecamp.com/ ) .
144145
146+ #### More flexible mirror URL
147+
148+ For more flexible mirror URL, you can provide a custom command to output the
149+ desired mirror URL, as shown below:
150+
151+ ``` sh
152+ # There are two arguments:
153+ # 1st arg: the original URL without checksum
154+ # 2nd arg: the checksum
155+ $ cat << 'EOF ' >./get_mirror_url && chmod +x ./get_mirror_url
156+ #!/bin/sh
157+ echo "$1" | sed "s/cache.ruby-lang.org/mirror.example.com/"
158+ EOF
159+
160+ $ export RUBY_BUILD_MIRROR_CMD=" $( pwd) /get_mirror_url"
161+ ```
162+
163+ After executing the above script in your shell, install a version as usual.
164+
145165#### Keeping the build directory after installation
146166
147167Both ` ruby-build ` and ` rbenv install ` accept the ` -k ` or ` --keep ` flag, which
0 commit comments