[前][次][番号順一覧][スレッド一覧]

ruby-changes:68023

From: Jose <ko1@a...>
Date: Fri, 17 Sep 2021 20:46:35 +0900 (JST)
Subject: [ruby-changes:68023] b45fe48fbb (master): [rubygems/rubygems] Trigger install command by default on remove

https://git.ruby-lang.org/ruby.git/commit/?id=b45fe48fbb

From b45fe48fbb20e334ef6dd1a85d5b7a37e6701d40 Mon Sep 17 00:00:00 2001
From: Jose Galisteo <ceritium@g...>
Date: Wed, 1 Sep 2021 09:34:21 +0200
Subject: [rubygems/rubygems] Trigger install command by default on remove

Closes https://github.com/rubygems/rubygems/issues/4889

https://github.com/rubygems/rubygems/commit/2b1754479c
---
 lib/bundler/cli.rb                           |  1 +
 lib/bundler/cli/remove.rb                    |  3 +--
 spec/bundler/commands/remove_spec.rb         |  3 ++-
 spec/bundler/other/major_deprecation_spec.rb | 19 +++++++++++++++++++
 spec/bundler/support/builders.rb             |  5 +++++
 5 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index a72f0fe..d5de72e 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -184,6 +184,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L184
     method_option "install", :type => :boolean, :banner =>
       "Runs 'bundle install' after removing the gems from the Gemfile"
     def remove(*gems)
+      SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
       require_relative "cli/remove"
       Remove.new(gems, options).run
     end
diff --git a/lib/bundler/cli/remove.rb b/lib/bundler/cli/remove.rb
index cd6a2ce..44a4d89 100644
--- a/lib/bundler/cli/remove.rb
+++ b/lib/bundler/cli/remove.rb
@@ -11,8 +11,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/remove.rb#L11
       raise InvalidOption, "Please specify gems to remove." if @gems.empty?
 
       Injector.remove(@gems, {})
-
-      Installer.install(Bundler.root, Bundler.definition) if @options["install"]
+      Installer.install(Bundler.root, Bundler.definition)
     end
   end
 end
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index 170545f..9e2586b 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe "bundle remove" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/remove_spec.rb#L13
     end
   end
 
-  context "when --install flag is specified" do
+  context "when --install flag is specified", :bundler => "< 3" do
     it "removes gems from .bundle" do
       gemfile <<-G
         source "#{file_uri_for(gem_repo1)}"
@@ -40,6 +40,7 @@ RSpec.describe "bundle remove" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/remove_spec.rb#L40
         bundle "remove rack"
 
         expect(out).to include("rack was removed.")
+        expect(the_bundle).to_not include_gems "rack"
         gemfile_should_be <<-G
           source "#{file_uri_for(gem_repo1)}"
         G
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index daebdbe..873366a 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -624,6 +624,25 @@ The :gist git source is deprecated, and will be removed in the future. Add this https://github.com/ruby/ruby/blob/trunk/spec/bundler/other/major_deprecation_spec.rb#L624
     end
   end
 
+  context "bundle remove" do
+    before do
+      gemfile <<-G
+        source "#{file_uri_for(gem_repo1)}"
+        gem "rack"
+      G
+    end
+
+    context "with --install" do
+      it "shows a deprecation warning", :bundler => "< 3" do
+        bundle "remove rack --install"
+
+        expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default."
+      end
+
+      pending "fails with a helpful message", :bundler => "3"
+    end
+  end
+
   context "bundle console" do
     before do
       bundle "console", :raise_on_error => false
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 10beba1..c9ddc2c 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -35,6 +35,11 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/builders.rb#L35
       build_repo gem_repo1 do
         FileUtils.cp rake_path, "#{gem_repo1}/gems/"
 
+        build_gem "coffee-script-source"
+        build_gem "git"
+        build_gem "puma"
+        build_gem "minitest"
+
         build_gem "rack", %w[0.9.1 1.0.0] do |s|
           s.executables = "rackup"
           s.post_install_message = "Rack's post install message"
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]