I’d like to understand the differences between the following Ruby/Bundler/RubyGems commands:
bundle installbundle updategem install my_gem.gemgem update my_gem.gem
Assume 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
Gemfileis what you change to add/remove/update the gems (or just the versions of gems) running in your app.Gemfile.lockis the file that’s automatically updated by bundler. In fact, you shouldn’t try to manually updateGemfile.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 installinstalls any new/updated gems and dependencies – but if they are already installed, nothing is donebundle updateruns through your installed gems, and grabs the newest, allowed versions, as defined in yourGemfilegem install my_gem.gembypasses bundler, and installs the gem at the system level (i.e. outside your application’s code bundle)gem update my_gem.gembypasses 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.