0

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

  1. Uninstalling my dependencies
  2. Using bundler to reinstall all my dependencies
  3. Running app to make sure all dependencies have been installed
4

1 回答 1

3

如果您正确使用 Bundler,这应该不是问题,因为它会修改 Bundler,$LOAD_PATH以便仅需要 Gemfile 中列出的 gem。确保您正在调用:

require 'bundler'
Bundler.setup

在您的代码中的某处。在某些情况下(尤其是 gem),这可能只在测试中。在应用程序本身中,它通常位于您的“引导”文件中。

于 2013-10-27T01:28:16.740 回答