English 中文(简体)
文本要求中的til(~)
原标题:Meaning of tilde-greater-than (~>) in version requirement?

<代码>~>在光谱中的要求是什么?

hanna-0.1.12 depends on [haml (~> 2.2.8)]
最佳回答

The RubyGems manual calls this a pessimistic version constraint.

Assume you have specified an n-part version number, e.g. 1.3 (2-part) or 3.5.6.2 (4-part) as the constraint. Then, in order to fulfill the constraint, a version number must satisfy both of the following conditions

  1. The first n-1 parts of the version number must be identical to the first n-1 parts of the constraint (e.g. 1.x or 3.5.6.x match, but 0.x or 3.5.7.x don t) and

  2. The last part of the version number must be greater than or equal to the last part of the constraint (e.g. 1.9999 and 3.5.6.2 match, but 1.2 or 3.5.6.1 don t).

换言之,

~> x1.x2.x3. … .xn-2.xn-1.xn

配对

x1.x2.x3. … .xn-2.xn-1.y, y >= xn

The reason this is called a "pessimistic" constraint, and also the use case for it, is that when you just say > x.y.z, you are being optimistic: you assume that from here on out, until all eternity, the API will never ever change. This is of course a pretty bold assumption. However, most projects have rules about when they are allowed to break backwards compatibility, and how they have to change their version number when they do break backwards compatibility. You can encode those version numbering rules using a pessimistic constraint, and thus you can be sure that your code will always continue to work (assuming that the author of the other project actually adheres to his own rules, which unfortunately isn t always the case).

问题回答

换言之,你可以利用这一文号,不断更新你的大体,不作任何微小的更新,避免作出可能破坏你的更新。

例如,“~> 1.2”将更新贵重至1.3(如果公布这一版本),但未能将其更新到2.0。

它与任何具有相同主要/次要部分的版本相吻合。 也就是说,在这种情况下,haml ~> 2.2.8将符合任何2.2.x版本。

这可以用来确保转录新胶片的变换不会导致依赖新出现但已改变的树脂,从而在这个案例中打破大麻。





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签