2

我的 gemfile 中有以下自定义炼油厂 CMS 引擎:

gem 'refinerycms-venues', '1.0', :path => 'vendor/engines', :require => 'venues'
gem 'refinerycms-events', '1.0', :path => 'vendor/engines', :require => 'events'
gem 'refinerycms-available_spaces', '1.0', :path => 'vendor/engines', :require => 'available_spaces'

如果我把这些拿出来,capistrano 部署得很好。但是,如果我把它们留在 capistrano pukes 中,就像一只生病的狗:

 * executing "bundle install --gemfile /home/some_user/our-website.com/releases/20101109020214/Gemfile --path /home/some_user/our-website.com/shared/bundle --deployment --quiet --without development test engines"
    servers: ["our-website.com"]
    [our-website.com] executing command
 ** [out :: our-website.com] The path `/home/some_user/vendor/engines` does not exist.
    command finished
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/some_user/our-website.com/releases/20101109020214; true"
    servers: ["our-website.com"]
    [our-website.com] executing command
    command finished
failed: "sh -c 'bundle install --gemfile /home/some_user/our-website.com/releases/20101109020214/Gemfile --path /home/some_user/our-website.com/shared/bundle --deployment --quiet --without development test engines'" on our-website.com

就像它看到那些供应商/引擎并认为出于某种原因需要安装它们。我还没有弄清楚如何排除它们。我试图将它们分组,但应用程序无法运行。

有没有人有任何想法?

谢谢,克雷格

4

1 回答 1

0

这似乎是捆绑程序的问题。文档说捆绑器应该从 Gemfile 所在的目录运行,但情况似乎并非如此。我解决了创建自己的捆绑任务并在运行捆绑之前显式更改目录的问题。

在您的 deploy.rb 文件中将您更改#require 'bundler/capistrano'为此

after 'deploy:update_code' do
  bundle_cmd     = fetch(:bundle_cmd, "bundle")
  bundle_flags   = fetch(:bundle_flags, "--deployment --quiet")
  bundle_dir     = fetch(:bundle_dir, File.join(fetch(:shared_path), 'bundle'))
  bundle_gemfile = fetch(:bundle_gemfile, "Gemfile")
  bundle_without = [*fetch(:bundle_without, [:development, :test])].compact

  args = ["--gemfile #{File.join(fetch(:current_release), bundle_gemfile)}"]
  args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
  args << bundle_flags.to_s
  args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?


  run_cmd = "cd \"#{fetch(:current_release)}\"; "
  run_cmd << "#{bundle_cmd} install #{args.join(' ')}"

  run run_cmd, :shell => '/bin/bash'
end
于 2010-11-20T01:27:05.520 回答