Вопрос

I'm trying to modify a gem which currently has a dependency on activeresource defined as:

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

In order to get the gem working with Rails 4, I need to extend the dependency to work with either version 3 or 4 of activeresource. I don't want to simply add the following as it could cause problems later:

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

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

Это было полезно?

Решение

Accordly to the documentation, if you want to have all version between 3 and 4, you can do this :

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

The specifier accepted are : >=, ~>, <=, >, <.

Другие советы

I think you should write it with < 5.x, because this will prevent beta versions like 5.0.beta1 to be installed.

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

Because with < 5.0, 5.0.beta1 can be installed - 5.0.beta1 is smaller than 5.0.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top