Managing Ruby dependencies

  • Use bundler to manage ruby dependecies.

Version locking

  • Prefer not to lock gem versions. Locking gem version prevents dependencies from being updated as well. This applies to other gems in your Gemfile. Lock gem version only when necessary (newest version has known bugs, security issues, etc.).
  • Always make a comment why specific version needs to be locked.

Choose between big and small steps

Usually when updating gems each month bundle update should do the trick just fine. However, when there are a lot of gems the risk of introducing breaking changes becomes higher. In case you updated all your gems and have all the specs failing it is unlikely that you will be able to detect which gem introduced those breaking changes. In that case, follow these steps instead:

  • Update only a subset of gems (e.g bundle update pg rails) or even one by one.
  • Run the specs and make sure everything works.
  • Continue with other gems in the same way.

Updating Rails

When updating Rails follow these steps:

  • Make sure all tests pass.
  • Updated all dependencies except Rails.
  • Update Rails and gems which were not updated yet because of previous rails version.
  • Check official updating guide.
  • Update code and make tests pass.
  • Assign application to tester for manual testing.