Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify gem version or always use the latest one?

I code a RoR webapp on my sparetime. Like anybody (I guess), I use gems (about 20).

A few times, I had errors when deploying the app in production environment because I wasn't specifying the exact version for all my gems, so some of them were updated which led to bugs.

I'm worried about staying in a particular version for all my gems and when I need to update one (or some) of them, the whole thing break down (I had problems making gems for flying-sphinx and twitter to work together after an update).

My question is : should a part-time coder fix once-for-all the version of the gems used or is it worth the time to check each update ? How do you manage your Gemfile ?

Also I think that when you're full-time, you should always keep to date (security, performance) but is it really true ?

like image 676
teriiehina Avatar asked Nov 30 '25 16:11

teriiehina


1 Answers

I mostly stick with this kind of version specification:

gem "blah", "~> 1.4.2"

which means a version number >= 1.4.2 but < 1.5.0

Most gems follow a semantic versioning scheme or at least only break stuff when doing a version jump. This way, I am 'safe', but still get the good parts (bug fixes etc.).

Locking down the exact version numbers is the idea behind Gemfile.lock, so I check this into version control, too. This approach has worked perfectly for me so far and I have never had problems with this approach.

like image 136
Patrick Oscity Avatar answered Dec 02 '25 06:12

Patrick Oscity



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!