Search code examples
ruby-on-railsrubygemsyard

Gemfile: Make sure some gems are available on the machine, but don't need to be loaded for the project


I didn't work with RoR for 2-3 years, but now I'm back in business, and I really like the bundle command. But I'm a bit unsure how to make sure my fellow developers have all gems installed that are not strictly part of the Rails application.

For example, we use YARD for documentation. YARD doesn't have anything to do with the Rails project we are working on, so I'm not sure whether I should add it to its Gemfile. On the other hand, this is the only way to make sure every developer has it installed automatically.

And if I add it to Gemfile, how exactly should I do it? In the :development group, so it doesn't get loaded for production? But strictly speaking, it also shouldn't be loaded in development, it simply just be installed so it can be used manually.

So how should I add it? Thanks, guys, for help.


Solution

  • The :development group in the Gemfile is exactly the right place for this. There are nice commands that mean users can install only specific groups they need. See the docs for more information on groups with Bundler.

    You can look at the Rails project's Gemfile itself to note that they have a group called :doc which they use to the same effect.