Reputation: 2693
I'm trying to understand what exactly happen when I'm installing gems. At first I thought that using the "gem install gem_name" command (and after it the "bundle install) will make sure I have the proper files and dependencies and then it will update the gemfile.
But I've noticed that whenever I add gem using the commend line it doesn't appears at the gemfile yet I'm still able to use its functionality.
so is there is any reason to use the comment "gem install gem_name" insted of just adding the gem name to the gemfile?
Upvotes: 16
Views: 6900
Reputation: 6274
The reason to use a Gemfile is that you can install all required gems in a single go.
Imagine that you work in a development team and a new member starts contributing to your application.
Al he has to do is checkout the repository and run bundle install
.
Only use the command gem install
if you just want to install a gem that is not nessecarily relevant to your project.
If the project requires the gem; put it in the Gemfile.
Upvotes: 23