Why does the Gemfile semantic versioning operator (~>) produce inconsistent results with one number?

前端 未结 1 1229
青春惊慌失措
青春惊慌失措 2021-01-18 13:46

The gemspec semantic versioning operator ~> (aka twiddle-wakka, aka pessimistic operator) allows a gem version to be constrained yet allow some upgrades.

I have oft

相关标签:
1条回答
  • 2021-01-18 14:32

    By peeking into rubygems sources (esp. requirement.rb, version.rb) the pessimistic operator needs at least two versioning segments.

    It also does make a sense. As ~> v.r is just a syntactic sugar for inequality

    v.r <= current_version.current_release < (v+1).0

    what would be the upper bound if there is only one version number ? Yep, ∞ (infinity), so there is no point why it should work. You can simply write it as >= v .

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