What does the ->
mean next to a version number in a Gemfile?
For example:
gem 'sass-rails', '~> 3.1.5'
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
It means "equal to or greater than in the last digit", so e.g. ~> 2.3 means "equal to 2.3 or greater than 2.3, but less than 3.0", while ~> 2.3.
Ruby apps will now have the `BUNDLED WITH` declaration in their `Gemfile. lock` removed after detecting Bundler version. The version listed in the BUNDLED WITH key of the Gemfile. lock is used by Heroku to detect what version of Bundler to use.
The Gem Development guide says that the Gemfile. lock file "should always be checked into version control." However, this is NOT true for Gems. For Applications, like your Rails apps, Sinatra apps, etc., it is true. The same does not go for Gems.
From the bundler website:
The specifier ~> has a special meaning, best shown by example:
'~> 2.0.3'
is identical to'>= 2.0.3
' and'< 2.1.'
'~> 2.1'
is identical to'>= 2.1'
and'< 3.0'
.'~> 2.2.beta'
will match prerelease versions like'2.2.beta.12'
.
See https://bundler.io/gemfile.html and http://guides.rubygems.org/patterns/#pessimistic-version-constraint
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With