I'd like to understand the differences between the following Ruby/Bundler/RubyGems commands:
bundle installbundle updategem install my_gem.gemgem update my_gem.gemAssume my_gem is hosted on rubygems.org. I'm running Ruby 1.8.7, RubyGems 1.8.10 and Bundler 1.0.21. I also have rvm 1.8.6 available (but I'm not sure rvm is relevant when updating gems).
Also I'm using git for version control. Does it make sense for me to manually update the Gemfile? Or does this happen automatically when one of the above commands are run?
The Gemfile is what you change to add/remove/update the gems (or just the versions of gems) running in your app. Gemfile.lock is the file that's automatically updated by bundler. In fact, you shouldn't try to manually update Gemfile.lock: first, because it's auto-generated, and second it's not intended to be altered by hand, and you're likely to confuse bundler if you alter it yourself.
To answer you list:
bundle install installs any new/updated gems and dependencies - but if they are already installed, nothing is donebundle update runs through your installed gems, and grabs the newest, allowed versions, as defined in your Gemfilegem install my_gem.gem bypasses bundler, and installs the gem at the system level (i.e. outside your application's code bundle)gem update my_gem.gem bypasses bundler, and updates the gem at the system level (i.e. outside your application's code bundle)So, one set of commands installs (if not already installed), one set of command updates to latest versions the gems that are already installed, one set of commands does these things within the scope of your app only (your application code bundle), and one set of commands does these things at the system level.
Git is not relevant to your question here.
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