Rubygems: How do I add platform-specific dependency?

后端 未结 1 1601
星月不相逢
星月不相逢 2020-12-02 20:44

I\'ve a ruby gem that has different dependencies for each OS. I have to explicitly write all of them down:

On Mac OS X:

gem install li         


        
1条回答
  •  有刺的猬
    2020-12-02 21:07

    The proper way to do this is outlined here. Since the gemspec is evaluated at package time, you need to do it in a native extension. Don't worry, it's not that scary since its still just Ruby code (not compiling C or anything).

    We are currently using this approach for some client tools for OpenShift (source). Then in your gemspec/Rakefile, instead of adding dependencies, you would add an extension. Note that the file needs to be named ext/mkrf_conf.rb for this to work.

    0 讨论(0)
提交回复
热议问题