In a ruby ​​.gemspec file, how do I specify multiple versions of a dependency?

I am trying to change a gem that currently has a dependency on activeresource defined as:

s.add_dependency              "activeresource", "~> 3.0"

To get a gem that works with Rails 4, I need to expand the dependency to work with version 3 or 4 from activeresource. I do not want to simply add the following, as this may cause problems later:

s.add_dependency              "activeresource", ">= 3.0"

Is there a way to specify a list of valid versions? ~> 3.0 or ~> 4.0?

+4
source share
2 answers

According to the documentation , if you want to have the whole version from 3 to 4, you can do this:

s.add_dependency "activeresource", ">= 3.0", "< 5.0"

Adopted specifier: >=, ~>, <=, >, <.

+6

, < 5.x, -, 5.0.beta1.

 s.add_dependency "activeresource", ">= 3.0", "< 5.x"

< 5.0, 5.0.beta1 - 5.0.beta1 5.0.

0

Source: https://habr.com/ru/post/1539619/


All Articles