Gemfile Dependencies in Rails

In a Rails application, if one of the gems included in the Gemfile depends on another that I want to use, do I need to include the second in the Gemfile?

Let's say I am using a gem cucumber-rails

. Upon running bundle dependency cucumber-rails

, I see that it depends on "database_cleaner" and factory_girl

. Do I need to include the first two in the Gemfile or not?

Thank!

+3


source to share


3 answers


If you are using bundler then it will install any dependency when installing gem

you can see the dependencies in gemfile.lock



but note that having a dependency installed is not always a good idea to assume that the installed dependency is the version of the gem you want. The installed dependency is the version required for the gem to work. If you want the factory-girl in the latest version (or any other version) then it is best to include it ingemfile

+2


source


No, you don't need to explicitly request them in the Gemfile. Bundler will detect the dependencies, include them in your Gemfile.lock, and install them.



+3


source


I looked around and apparently you shouldn't use the eyepiece-bundle setting function:

https://makandracards.com/makandra/12741-don-t-update-gems-with-bundle-update-unless-you-re-feeling-lucky

+1


source







All Articles