At present, ruby-build only supports the mirrorUrl/checksum format for mirrored package URLs. (https://github.com/rbenv/ruby-build/blob/ffef60696af59a73f935459fd128adb8bfd369a7/bin/ruby-build#L356) For node-build, we had need to support a different default mirrored URL scheme. In doing so, we have extended the mirror support to not only accept a *_MIRROR_URL environment variable, but also to accept a *_MIRROR_CMD variable with the name of a function or command which can _construct_ a full mirrored package URL (given the original package URL and checksum as arguments). In this manner, node-build can default to a common mirror scheme for node mirrors, but also be flexible enough to allow users to construct URLs as necessary for their specific mirror sites.
The core of this feature is in https://github.com/nodenv/node-build/pull/210/commits/c73fbe20bc7459a928291e85e1d30c2c28e3787b as part of https://github.com/nodenv/node-build/pull/210
We haven't yet merged this feature into node-build. If everything goes as planned and it _is_ merged to node-build, I intend to also submit this feature here to ruby-build. In hopes of gathering feedback ahead of time, I would love some comments on this feature.
What would be the use-case for ruby-build?
Currently, the mirror supported by rbenv and ruby-build has a customized directory structure.
The mirror url format is
$RUBY_BUILD_MIRROR_URL/$checksum
but not like
$RUBY_BUILD_MIRROR_URL/2.3/ruby-2.3.1.tar.bz2
It means that I can't download ruby from any existing "plain mirror". I have to make my own "custom mirror" for ruby-build. For example, there are some ruby mirrors (ruby-china & ustc) in mainland China, but Chinese users cannot use ruby-build to download ruby from there.
A Chinese developer has written an rbenv plugin called rbenv-china-mirror to solve this problem. But I think it's just a hack. This problem should be solved by ruby-build.
Most helpful comment
Currently, the mirror supported by rbenv and ruby-build has a customized directory structure.
The mirror url format is
but not like
It means that I can't download ruby from any existing "plain mirror". I have to make my own "custom mirror" for ruby-build. For example, there are some ruby mirrors (ruby-china & ustc) in mainland China, but Chinese users cannot use ruby-build to download ruby from there.
A Chinese developer has written an rbenv plugin called rbenv-china-mirror to solve this problem. But I think it's just a hack. This problem should be solved by ruby-build.