diff options
author | Bundlerbot <bot@bundler.io> | 2019-03-29 04:02:39 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2019-04-04 22:46:30 +1100 |
commit | 79b479c70101444da81f6b7c87bde80f26a0b882 (patch) | |
tree | 1c420d78f9171ba6f14a89273040ccaf47ec79f3 | |
parent | f674ead086636f2a79e33e235b991445a2caba33 (diff) | |
download | bundler-79b479c70101444da81f6b7c87bde80f26a0b882.tar.gz |
Merge #7078
7078: Allow `update` to install when `--no-install` used r=colby-swandale a=deivid-rodriguez
Fixes #7077.
### What was the end-user problem that led to this PR?
The problem was #7077. When the `no_install` configuration is activated, this prevents `bundle update` from installing gems, but `no_install` is only meant to affect `bundle package`.
### What was your diagnosis of the problem?
My diagnosis was that `bundle update` needs to ignore this setting.
### What is your fix for the problem, implemented in this PR?
My fix is to the same `bundle install` does to fix this problem.
### Why did you choose this fix out of the possible options?
I chose this fix because it's the most straightforward solution, although the handling of this flag could probably use some refactoring.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
(cherry picked from commit 91912a1da92a5c1d0c6c29b03f35ed4fc024021f)
-rw-r--r-- | lib/bundler/cli.rb | 4 | ||||
-rw-r--r-- | spec/commands/package_spec.rb | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 3efe193613..988c3168a6 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -277,7 +277,9 @@ module Bundler def update(*gems) SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require "bundler/cli/update" - Update.new(options, gems).run + Bundler.settings.temporary(:no_install => false) do + Update.new(options, gems).run + end end desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem" diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index a8426e6322..083e636576 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -179,6 +179,18 @@ RSpec.describe "bundle package" do expect(the_bundle).to include_gems "rack 1.0.0" end + + it "does not prevent installing gems with bundle update" do + gemfile <<-D + source "file://#{gem_repo1}" + gem "rack", "1.0.0" + D + + bundle! "package --no-install" + bundle! "update" + + expect(the_bundle).to include_gems "rack 1.0.0" + end end context "with --all-platforms" do |