Closed mattbrictson closed 4 years ago
Thanks for the PR! This project lacks automated tests, which makes reviewing and approving PRs somewhat difficult. Please make sure that your contribution has not broken backwards compatibility or introduced any risky changes.
Generated by :no_entry_sign: Danger
I want to give a shout out to @spajic who proposed similar changes a few years ago in #97 and #101. Sorry it took so long. 😅
@will-in-wi @ansonhoyt @jamesw @tsechingho @patsch any thoughts on this PR? It would be great if you could test out this branch to see if it works prior to me merging this. Thanks!
You can test by modifying your Gemfile as follows:
gem "capistrano-bundler", git: "https://github.com/capistrano/bundler.git", branch: "features/bundler-2.1-support"
I had test this PR in my current projects, it works as old days. thanks @mattbrictson 😄
The 'features/bundler-2.1-support' branch works perfectly when deploying to staging and production environments. The necessary bundle config commands run as such:
00:10 bundler:config
01 /var/www/html/example.com/public/rvm1scripts/rvm-auto.sh . bundle config --local deployment true
✔ 01 user@192.168.1.107 2.421s
02 /var/www/html/example.com/public/rvm1scripts/rvm-auto.sh . bundle config --local path /var/www/html/example.com/public/shared/bundle
✔ 02 user@192.168.1.107 2.341s
03 /var/www/html/example.com/public/rvm1scripts/rvm-auto.sh . bundle config --local without development\ test
✔ 03 user@192.168.1.107 2.380s
00:18 bundler:install
01 /var/www/html/example.com/public/rvm1scripts/rvm-auto.sh . bundle install --jobs 4 --quiet
Thank you for making this change!
Alright I'm going to merge this and release a 2.0 version of this gem within the next few days. Thanks everyone!
There is a small issue with this patch: bundler install
wants a space separated list of groups, but bundler config
wants a ":" separated list of groups (see https://bundler.io/v2.0/man/bundle-config.1.html).
We now emit the options designed for install to config, so as a space separated list, which will show a warning in bundler, but otherwise seems to work. It would be better to replace the space with a ":" in bundler-capistrano. As a quick fix to get rid of the warning you can simply do set :bundle_without, %w{development test}.join(':')
@Fjan thanks for the heads up and the link to the docs. Somehow I missed this warning in my testing. Could you open a new issue with some more details, including the text of the warning so that others can search for it and find it? I can implement the fix that you mentioned.
👍 Just deployed with capistrano-bunder 2.0.1. No bundler warnings. Many thanks! ❤️
Sorry I wasn't available to test this before release, but glad several others were able to test it out.
Thanks for the work on this! FWIW, I'm asking Bundler if we could have a single call to set 3 options here https://github.com/rubygems/rubygems/issues/4392, in order to accelerate deployment further (since the 3 steps can take near 10 seconds in cases, which could be divided by three).
Starting with Bundler 2.1, the
--path
,--without
, and--deployment
options are deprecated. In other words you are no longer supposed to specify these when runningbundle install
.Instead, Bundler wants you to set these options externally from the install command. That way all subsequent invocations of bundler can use the same external configuration without you having to remember which flags to use each time.
There are two ways to specify this external configuration: providing environment variables, or running
bundle config
. This commit implements the latter.To summarize, prior to running
bundle check
,bundle install
, orbundle clean
, Capistrano will now run a newbundler:config
task. This task executes the following command as many times as needed:Each execution sets the external Bundler configuration KEY to VALUE.
The following Capistrano variables are automatically consulted to get these KEYs and VALUEs:
This commit also introduces a new variable:
It is a Hash that can contain any arbitrary KEY and VALUE pairs to send to
bundle config
. By default it has a single entry:Finally, this commit removes
--deployment
option from the default value of:bundle_flags
, since that flag is deprecated. It has been replaced by the default:bundle_config
as mentioned above.Fixes #115