How do I add conditional rubygem requirements to a gem specification?

后端 未结 7 684
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 03:00

Is it possible to add a gem dependency only if the person is using a certain version of ruby?

Background: I\'m working on a fork of a project that u

7条回答
  •  执念已碎
    2021-01-06 03:18

    hay ... i'm kind of a ruby newbie ... if this is the best way to do it.

    any way ... i wish i can do that using only Ruby .... though u can use your operating system shell to do that, by using this in your program installer, just execute (works for Linux based operating systems):

    $ruby --version
    

    (u can execute that from a ruby installer file, just like: ruby --version) and put a possibility according to output, if it's 1.9.1 add an extra line to execute:

    $ sudo gem install gem_name
    

    else, just leave it be.

提交回复
热议问题