本文介绍了如何避免共享捆绑文件夹下有多个宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用capistrano命令进行部署时,如何避免共享包文件夹下的多个gem。在大多数情况下,当我将gem从一个版本迁移到另一个版本时,共享的bundle文件夹仍然包含两个版本,从而导致问题。我们应该如何避免这种情况?

How to avoid multiple gems under shared bundle folder, when doing a deploy using the capistrano command. Most of the times when I migrate a gem from a version to another the shared bundle folder still contains both the versions, causing issues. How should we avoid this?

推荐答案

我不确定我是否遇到过这样的冲突。但是我扩展了capistrano deploy:cleanup 任务,它可以清理过时的捆绑器宝石:

I am not sure I ever saw conflicts like this. But I have extended capistrano deploy:cleanup task with cleaning outdated bundler gems:

after "deploy:cleanup", "bundle:clean"

namespace :bundle do
  task :clean, :except => {:no_release => true} do
    bundle_cmd = fetch(:bundle_cmd, "bundle")
    run "cd #{latest_release} && #{bundle_cmd} clean"
  end
end

如果它引起您的冲突,则可以在部署后进行

If it causes you conflicts, you can probably do it after deploy instead.

这篇关于如何避免共享捆绑文件夹下有多个宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:56