capistrano / bundler

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

Set bundle options before check via bundle config #101

Closed spajic closed 4 years ago

spajic commented 7 years ago

Hello, @mattbrictson !

This PR is advances idea, discussed in #97

Here I take two more options into account: bundle_frozen and bundle_disable_shared_gems

97 still has problem I'm trying to solve here, setting 3 options is happened to be not enough.

# default values for new options
set :bundle_frozen, '1'
set :bundle_disable_shared_gems, true

Now I set 5 bundle config options before bundle check:

execute :bundle, :config, "--local path #{bundle_path}" if bundle_path
execute :bundle, :config, "--local without #{bundle_without.split(' ').join(':')}" if bundle_without
execute :bundle, :config, "--local gemfile #{bundle_gemfile}" if bundle_gemfile
execute :bundle, :config, "--local frozen #{bundle_frozen}" if bundle_frozen
execute :bundle, :config, "--local disable_shared_gems #{bundle_disable_shared_gems}" if bundle_disable_shared_gems

Code from this PR is battle-tested, we already use it in production.

Though we are adding 5 more commands, we still have order-of-magnitude win. bundle command may take more than 25 seconds to fetch metadata.

5 bundle config commands take about 1,5 seconds for us in deploy to 3 app-servers with 50ms ping.

With faster ping 5 bundle config will take even less time.

capistrano-bot commented 7 years ago
1 Warning
:warning: Please update CHANGELOG.md with a description of your changes. If this PR is not a user-facing change (e.g. just refactoring), you can disregard this.

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.

Here's an example of a CHANGELOG.md entry (place it immediately under the * Your contribution here! line):

* [#101](https://github.com/capistrano/bundler/pull/101): Set bundle options before check via bundle config - [@spajic](https://github.com/spajic)

Generated by :no_entry_sign: Danger

spajic commented 7 years ago

@mattbrictson May be it would be better to combine 5 config commands into 1? What do you think?

mattbrictson commented 4 years ago

Closing in favor of #122