diff --git a/README.md b/README.md index 0d4408e..52d39dc 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ So make sure to properly setup `capistrano-rbenv` and you'll be good. For example, in `config/deploy.rb`: set :rbenv_ruby, '2.0.0-p247' + set :rbenv_bundler_version, '> 2.0' + set :rbenv_bundler_options, '--quiet --no-documents' + +Note: bundler 2 replace options --no-ri --no-rdoc with --no-documents Other than that, this plugin does not need any setup. diff --git a/lib/capistrano/tasks/rbenv_install.rake b/lib/capistrano/tasks/rbenv_install.rake index e6bbd1c..e3d22aa 100644 --- a/lib/capistrano/tasks/rbenv_install.rake +++ b/lib/capistrano/tasks/rbenv_install.rake @@ -49,8 +49,18 @@ namespace :rbenv do desc 'Install bundler gem' task install_bundler: ['rbenv:map_bins'] do on roles fetch(:rbenv_roles) do - next if test :gem, :query, '--quiet --installed --name-matches ^bundler$' - execute :gem, :install, :bundler, '--quiet --no-rdoc --no-ri' + test_options = String.new('--quiet --installed --name-matches ^bundler$') + install_options = String.new(fetch(:rbenv_bundler_options, '--quiet --no-rdoc --no-ri')) + + if fetch(:rbenv_bundler_version) + with_version = " -v '#{fetch(:rbenv_bundler_version)}'" + test_options << with_version + install_options << with_version + end + + next if test :gem, :query, test_options + + execute :gem, :install, :bundler, install_options end end