How do I add optional dependencies to rubygems, as it does not support it?
Use cases:
One approach I though about is highjacking extconf.rb
. I could do system checks there. However, this feels wrong. Moreover, if this is the only way, how do I go about it? How do I trigger installing additional gems from there? system 'gem install ...'
?
Have you tried giving informative error messages for unmet dependencies to clear up those misconceptions? With zombie-chaser, I don't make gosu a dependency, but if people try to use the graphical version of it without gosu, I inform them that they need to install gosu.
I know of a couple gems that take the "hijacking extconf.rb
" approach:
Both use Gem::DependencyInstaller#install
to do the installation, which is probably preferable to system 'gem install ...'
.
See also this rubygems feature request: specify dependencies per ruby version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With