-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add explicit bundler:config step to support 2.1+ #122
Conversation
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 🚫 Danger |
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 running `bundle 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`, or `bundle clean`, Capistrano will now run a new `bundler:config` task. This task executes the following command as many times as needed: ``` bundle config --local KEY VALUE ``` Each execution sets the external Bundler configuration KEY to VALUE. The following Capistrano variables are automatically consulted to get theses KEYs and VALUEs: - :bundle_gemfile - :bundle_path - :bundle_without This commit also introduces a new variable: - bundle_config 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: ``` set :bundle_config, { deployment: true } ``` 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.
15fcdf8
to
89ade7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and works as expected, changes LGTM
@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. |
The 'features/bundler-2.1-support' branch works perfectly when deploying to staging and production environments. The necessary bundle config commands run as such:
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: 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 |
👍 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 rubygems/rubygems#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