I am pretty sure this is a very basic question but as a RoR newbie I'd like to understand why sometimes I use bundle install (which from my undertanding install all Gems and their dependecies from Gemfile) and gem install [gemname]?
What are the fundamental differences between both and when would I favour gem install instead of bundle install?
Thanks! Rog
Bundler prevents dependencies and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as running the bundle install command.
gem install , in its simplest form, does something kind of like this. It grabs the gem and puts its files into a special directory on your system. You can see where gem install will install your gems if you run gem environment (look for the INSTALLATION DIRECTORY: line):
The commands bundle & bundle install also have the same functionality. bundle uses Thor, and bundle 's default task is install .
bundle install is a command we use to install the dependencies specified in your Gemfile.
I'd say: by default on your local machine, no particular difference but...
The purpose of bundle install
is to setup everything for the application containing the Gemfile
. You can even pass arguments to make needed gems installed in whatever folder you want.
This way in production, you have clearly separated apps with their own gems.
On the other side, gem install gmaps4rails
(easy advertisement) gets the gem installed for your whole environment.
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