From 79b479c70101444da81f6b7c87bde80f26a0b882 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Fri, 29 Mar 2019 04:02:39 +0000 Subject: Merge #7078 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 91912a1da92a5c1d0c6c29b03f35ed4fc024021f) --- lib/bundler/cli.rb | 4 +++- spec/commands/package_spec.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1