After a long overdue reading of the bunder documents, I pretty much understand why it's a great thing compared to manual gem install.
经过长时间的阅读Bunder文档之后,我非常理解为什么与手动gem安装相比这是一件好事。
But this came to me (and others) only recently, and now we have a hybrid environment. Our development machines are mostly fine. But when we deploy to production, Bundler tells capistrano to put the gems in shared/bundle/gems
, which makes sense. But we still have manually installed gems in the normal .rvm location.
但这最近才出现给我(和其他人),现在我们有了混合环境。我们的开发机器大多都很好。但是当我们部署到生产时,Bundler告诉capistrano将宝石放在共享/捆绑/宝石中,这是有道理的。但我们仍然在正常的.rvm位置手动安装了宝石。
So now we know not to use "gem install" on production, but we're dealing with version mismatches when we run Rake tasks directly. We can use "bundle exec rake foo:bar" to force the correct behavior, I think. But for now we have a bunch of outdated gems:
所以现在我们知道不要在生产中使用“gem install”,但是当我们直接运行Rake任务时,我们正在处理版本不匹配问题。我认为,我们可以使用“捆绑exec rake foo:bar”来强制执行正确的行为。但是现在我们有一堆过时的宝石:
- Outdated gems installed by Bundler, and
- Bundler安装的过时宝石,和
- Gems we manually installed using
gem install
- 我们使用gem install手动安装的Gems
I would like to get things pristine. Is there any reason I shouldn't use gem cleanup
?
我想把事情弄得一团糟。有什么理由我不应该使用宝石清理?
Hope this isn't too convoluted :-)
希望这不是太复杂:-)
Thanks in advance.
提前致谢。
1 个解决方案
#1
1
gem cleanup
will keep the latest version of all gems, and remove older versions. What I think you want is this:
gem cleanup将保留所有gem的最新版本,并删除旧版本。我认为你想要的是:
- (Optional) create an RVM gemset for your project. (I like to do this; some people rely entirely on Bundler, which also works.)
- (可选)为项目创建RVM gemset。 (我喜欢这样做;有些人完全依赖Bundler,它也有效。)
- Make sure all your top-level dependencies are specified in your Gemfile.
- 确保在Gemfile中指定了所有*依赖项。
- Remove all gems (
rvm gemset empty
may be helpful) except Bundler. - 删除除Bundler之外的所有宝石(rvm gemset为空可能有帮助)。
bundle install
- 捆绑安装
- Run everything with
bundle exec
from now on. - 从现在开始使用bundle exec运行所有内容。
#1
1
gem cleanup
will keep the latest version of all gems, and remove older versions. What I think you want is this:
gem cleanup将保留所有gem的最新版本,并删除旧版本。我认为你想要的是:
- (Optional) create an RVM gemset for your project. (I like to do this; some people rely entirely on Bundler, which also works.)
- (可选)为项目创建RVM gemset。 (我喜欢这样做;有些人完全依赖Bundler,它也有效。)
- Make sure all your top-level dependencies are specified in your Gemfile.
- 确保在Gemfile中指定了所有*依赖项。
- Remove all gems (
rvm gemset empty
may be helpful) except Bundler. - 删除除Bundler之外的所有宝石(rvm gemset为空可能有帮助)。
bundle install
- 捆绑安装
- Run everything with
bundle exec
from now on. - 从现在开始使用bundle exec运行所有内容。