Hopstream Hopstream - 6 months ago 13
Ruby Question

Gem versioning: difference between syntax?

Whats the difference between the following two syntaxes for including a gem into a rails app?

gem 'apartment', '~> 1.0', '>= 1.0.2'


vs

gem 'apartment', '~> 1.0'

Answer

This line says "any 1.0 version":

gem 'apartment', '~> 1.0'

This line says "any 1.0 version at least 1.0.2"

gem 'apartment', '~> 1.0', '>= 1.0.2'

Neither should allow version 2.0 or higher.

Comments