Which version of gem to use in semantic versioning?

724 views Asked by At

Lets say you're using the Devise gem. Which version of the following should you use in your Gemfile:

'devise', '~> 3.5.1'

OR

'devise', '~> 3.5'

What are the pros and cons of using one over the other?

According to RubyGems:

PATCH 0.0.x level changes for implementation level detail changes, such as small bug fixes

MINOR 0.x.0 level changes for any backwards compatible API changes, such as new functionality/features

MAJOR x.0.0 level changes for backwards incompatible API changes, such as changes that will break existing users code if they update

Wouldn't then it make sense to use 'devise', '~> 3.5' as those will get small bug fixes once bundle update is ran?

1

There are 1 answers

0
floum On

I think that you should use the full version number in Rails applications (or at least include your Gemfile.lock), and the other minor version number in libraries / rails engines.

I'm interpreting Gem Versioning and Bundler: Doing it Right by Yehuda Katz here. I might be wrong, but I'm doing it and works well so far.