@@ -74,7 +74,8 @@ The build process may be configured through the following environment variables:
74
74
| ` RUBY_BUILD_CURL_OPTS ` | Additional options to pass to ` curl ` for downloading. |
75
75
| ` RUBY_BUILD_WGET_OPTS ` | Additional options to pass to ` wget ` for downloading. |
76
76
| ` 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). |
78
79
| ` RUBY_BUILD_SKIP_MIRROR ` | Bypass the download mirror and fetch all package files from their original URLs. |
79
80
| ` RUBY_BUILD_ROOT ` | Custom build definition directory. (Default: ` share/ruby-build ` ) |
80
81
| ` 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
142
143
The default ruby-build download mirror is sponsored by
143
144
[ Basecamp] ( https://basecamp.com/ ) .
144
145
146
+ #### More flexible mirror URL
147
+
148
+ For more flexible mirror URL, you can export a shell function 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
+ mirror_cmd () {
156
+ echo " ${1/ cache.ruby-lang.org/ mirror.example.com} "
157
+ }
158
+
159
+ export -f mirror_cmd
160
+ export RUBY_BUILD_MIRROR_CMD=mirror_cmd
161
+ ```
162
+
163
+ After ` source ` ing the above script in your shell, install a version as usual.
164
+
145
165
#### Keeping the build directory after installation
146
166
147
167
Both ` ruby-build ` and ` rbenv install ` accept the ` -k ` or ` --keep ` flag, which
0 commit comments