Pergunta

I have the following custom Refinery CMS engines in my gemfile:

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'

If I take these out, capistrano deploys fine. However, if I leave them in capistrano pukes like a sick dog:

 * 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

its like it sees those vendor/engines and thinks it needs to install them for some reason. I haven't figured out how to exclude them. I tried to put them in groups but then the app would not run.

Does anyone have any ideas?

Thanks, Craig

Foi útil?

Solução

This seems to be an issue with bundler. The docs say that bundler is supposed to run from the directory where the Gemfile is located, however this doesn't seem to be the case. I got around that be creating my own bundle task and explicitly changing the directory before running bundle.

Change your #require 'bundler/capistrano' to this in your deploy.rb file

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top