How to determine if Gemfile or gemspec has all required gem dependencies


Say you have a Ruby project A and you install the gem make_everything_work so that project A will work on the system you are developing on. It would have a line in the gemfile like this

# Project A: Gemfile
gem 'make_everything_work', '~> 1.0'

as well as a line elsewhere in the code like this

# Project A: other file
require 'make_everything_work'

Then you start another project B that also makes use of the gem make_everything_work, however, you never list it in your Gemfile or gemspec file.

# Project B: other file
require 'make_everything_work'

The project still works on your machine, because you already installed the gem for project A, even though you never included it in your Gemfile dependencies.

Is there a way to check that any gems required by your project are listed as a dependency in your Gemfile/gemspec file?

Show source
| ruby   | rubygems   | gemfile   | require   2016-10-07 23:10 1 Answers

Answers ( 1 )

  1. 2016-10-07 23:10

    You can test this by setting up rvm or rbenv

    Meaning a clean separate environments for Project A and Project B.

◀ Go back