使用Capistrano部署Refinery CMS的问题

时间:2010-11-09 02:04:58

标签: ruby-on-rails capistrano bundler refinerycms

我的gemfile中有以下自定义Refinery 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'

如果我把它拿出来,卡皮斯特拉诺会很好。但是,如果我把他们留在卡皮斯特拉诺呕吐物中,就像病狗一样:

 * 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

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

有没有人有任何想法?

谢谢, 克雷格

1 个答案:

答案 0 :(得分:0)

这似乎是捆绑商的问题。文档说Bundler应该从Gemfile所在的目录运行,但事实并非如此。我开始创建自己的bundle任务并在运行bundle之前显式更改目录。

在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