PLEASE NOTE: Application A, Application B and GemX are to help illustrate the example only, they are not real Applications or Ruby Gems.
I am developing "Application A." On my local dev environment, I install all the gems I need to.
Then, I start developing "Application B." Application B requires all the gems that Application A does with on addition "Gem X."
I do a ruby install gemx on my local dev environment, but in my absentmindedness, I forget to add the gemx entry to my gemfile.
I send my ruby source somewhere else (for example, to a friend who wants to use application B, or a production environment). But the application fails because it depends on gemx, but gemx is not installed as part of the bundling.
How can I test if my gemfile is correct in my local dev environment? I assume there is an easier way than to do the following in my local dev environment
This shouldn’t be an issue if you’re using Bundler properly since it modifies the $LOAD_PATH
so that only the gems listed in the Gemfile are able to be required. Ensure you are calling:
require 'bundler'
Bundler.setup
somewhere in your code. In some cases (notably gems) this will likely only be in tests. In applications themselves it’s typically in your “boot” file.