ruby-changes:61498
From: David <ko1@a...>
Date: Fri, 5 Jun 2020 07:33:27 +0900 (JST)
Subject: [ruby-changes:61498] 332ecb0ad1 (master): [rubygems/rubygems] Fix `bundle install` unintentionally saving configuration
https://git.ruby-lang.org/ruby.git/commit/?id=332ecb0ad1 From 332ecb0ad1fd5cda138a36cc40891d78517d1fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Thu, 28 May 2020 22:38:04 +0200 Subject: [rubygems/rubygems] Fix `bundle install` unintentionally saving configuration Even if no explicit flags were passed to it. https://github.com/rubygems/rubygems/commit/0598cbb68c diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 40ff470..dcd8d7c 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -164,13 +164,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L164 options[:with] = with options[:without] = without - unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with] - # need to nil them out first to get around validation for backwards compatibility - Bundler.settings.set_command_option :without, nil - Bundler.settings.set_command_option :with, nil - Bundler.settings.set_command_option :without, options[:without] - options[:with] - Bundler.settings.set_command_option :with, options[:with] - end + # need to nil them out first to get around validation for backwards compatibility + Bundler.settings.set_command_option :without, nil + Bundler.settings.set_command_option :with, nil + Bundler.settings.set_command_option :without, options[:without] - options[:with] + Bundler.settings.set_command_option :with, options[:with] end def normalize_settings @@ -197,7 +195,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L195 Bundler.settings.set_command_option_if_given :clean, options["clean"] - normalize_groups + normalize_groups if options[:without] || options[:with] options[:force] = options[:redownload] end diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb index 0d3cc60..8ace671 100644 --- a/spec/bundler/install/gemfile/groups_spec.rb +++ b/spec/bundler/install/gemfile/groups_spec.rb @@ -90,6 +90,15 @@ RSpec.describe "bundle install with groups" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/groups_spec.rb#L90 expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] end + it "respects global `without` configuration, but does not save it locally" do + bundle "config without emo" + bundle! :install + expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] + bundle "config list" + expect(out).not_to include("Set for your local app (#{bundled_app(".bundle/config")}): [:emo]") + expect(out).to include("Set for the current user (#{home(".bundle/config")}): [:emo]") + end + it "does not install gems from the excluded group" do bundle :install, :without => "emo" expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/