18 points · by ajsharp · 15y ago · 17 comments
Just make sure you do your `bundle update` and then immediately run your test suite and then immediately commit to your repo, before touching any actual code. Mods to Gemfile.lock should always exist in a commit on their own so that you can easily trace any bugs back to dependency upgrades.
If you don't have source control or a test suite, you are fucked. But then you're probably fucked anyway.
One point I was trying to make in the post (maybe made poorly), was that you probably never want to update the entire gem dependency graph in one fell swoop, just for the hell of it.
My read on this is that people tend to do this because they don't fully understand what bundle update is doing when run without any arguments. In the pre-1.0 days, the difference between those commands, at least in my eyes, was extremely ambiguous.
So IMHO, updating all gem dependencies to their latest versions, if only for the purpose of "staying current", usually doesn't make practical sense. Sure, there will be bugfixes included in these updates, but unless they were critical security patches, you can probably live without them, unless those bugs are affecting you directly. Even in that case, I would say the solution would be to run bundle update gem-name, only for that gem.
When I am working on code that is already being used by others and the changes are aimed to be pushed out pretty much as soon as they're 'ready,' I am much more careful and selective about dependency updates.
I'd prefer this b/c it's usually easy to roll back one or two before deploying if they conflict on my laptop, and having a defined version is preferable to blindly going with the latest.
I'd love to be able to ask bundler which of the gems that I have locked in a version for have a newer version available, so that I can test and decide if I should update.
gem "rails", "3.0.0"
gem "formtastic", ">=1.0.0"
Running bundle update (with no arguments) won't update the rails gem to a more recent version (if it exists), but it will update any of rails' dependencies, if updates exist.So, rails has a "specific" dependency on actionpack = 3.0.0, and actionpack 3.0.0 has a dependency on erubis ~> 2.6.6. Let's say (hypothetically) the most recent published version of erubis is 2.6.7 (which matches the ~> operator), but the version in your Gemfile.lock is 2.6.6, running bundle update will pull down that new version of erubis 2.6.7.
Similarly, if a newer version of formtastic were available than the one in your Gemfile.lock, bundle update would pull this down as well.
It's not as simple as saying never use it.