diff --git a/README.md b/README.md index fca697c6..d1dbc61a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,13 @@ Configurable options, shown here with defaults: set :bundle_without, %w{development test}.join(' ') set :bundle_binstubs, -> { shared_path.join('bin') } set :bundle_roles, :all + set :bundle_bins, %w(gem rake ruby) + +By default, the plugin adds `bundle exec` prefix to common executables listed in `bundle_bins` option. You can add any custom executable to this list: + +```ruby +set :bundle_bins, fetch(:bundle_bins).push %w(my_new_binary) +``` ## Contributing diff --git a/capistrano-bundler.gemspec b/capistrano-bundler.gemspec index bb26d255..68090673 100644 --- a/capistrano-bundler.gemspec +++ b/capistrano-bundler.gemspec @@ -18,6 +18,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'capistrano', '>= 3.0.0.pre' + spec.add_dependency 'sshkit', '>= 1.2.0' spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' diff --git a/lib/capistrano/tasks/bundler.cap b/lib/capistrano/tasks/bundler.cap index 729a13f6..7a61bee7 100644 --- a/lib/capistrano/tasks/bundler.cap +++ b/lib/capistrano/tasks/bundler.cap @@ -26,9 +26,19 @@ namespace :bundler do end end + task :map_bins do + fetch(:bundle_bins).each do |command| + SSHKit.config.command_map.prefix[command.to_sym].push("bundle exec") + end + end + before 'deploy:updated', 'bundler:install' end +Capistrano::DSL.stages.each do |stage| + after stage, 'bundler:map_bins' +end + namespace :load do task :defaults do set :bundle_gemfile, -> { release_path.join('Gemfile') } @@ -37,5 +47,6 @@ namespace :load do set :bundle_without, %w{development test}.join(' ') set :bundle_binstubs, -> { shared_path.join('bin') } set :bundle_roles, :all + set :bundle_bins, %w{gem rake ruby} end end