capistrano / bundler

Bundler support for Capistrano 3.x
MIT License
219 stars 83 forks source link

Question: How to execute a binary in the bundle in after:deploy stage #92

Closed vzamanillo closed 7 years ago

vzamanillo commented 7 years ago

Hi!

I would like to execute a binary located in the bundle (/var/www/app/shared/bundle/ruby/2.3.0/bin) after finished a deploy. I am actually using a task after the deploy

after  :deploy, 'doc:generate_doc'

namespace :doc do
  desc 'Refresh API doc'
  task :generate_doc do
    on roles(:all) do
      execute "cd #{release_path}; sdoc app/controllers/api"
    end
  end
end

But this implies that the sdoc gem needs to be installed in the global gemset, instead of the bundle gemset, how to exec sdoc using the /var/www/app/shared/bundle/ruby/2.3.0/bin/sdoc binary?.

Sorry for my ignorance and thanks for the help.

mattbrictson commented 7 years ago

I think this is a question best suited for Stack Overflow. However, to point you in the right direction, I think what you want to do is to add sdoc to the list of bundler-managed executables, as explained in the README:

set :bundle_bins, fetch(:bundle_bins, []).push('sdoc')

Then you can write:

on roles(:all) do
  within(release_path) do
    execute :sdoc,  "app/controllers/api"
  end
end

GitHub issues are for feature requests or bug reports. Since this is more of a how-to question, I am closing this issue. The Capistrano team recommends you use Stack Overflow for general questions. For more details, please see our contribution policy.

vzamanillo commented 7 years ago

Thank you very much for the help!