[rubygems/rubygems] Fix bundle remove
sometimes not removing gems
https://github.com/rubygems/rubygems/commit/e7f5f067e8
This commit is contained in:
parent
ac5661db7b
commit
890c83e607
@ -184,7 +184,7 @@ module Bundler
|
||||
# @param [Array] gems Array of names of gems to be removed.
|
||||
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
|
||||
def remove_gems_from_gemfile(gems, gemfile_path)
|
||||
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
|
||||
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2.*\)/
|
||||
new_gemfile = []
|
||||
multiline_removal = false
|
||||
File.readlines(gemfile_path).each do |line|
|
||||
|
@ -729,4 +729,23 @@ RSpec.describe "bundle remove" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when gem definition has parentheses" do
|
||||
it "removes the gem" do
|
||||
gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
|
||||
gem("myrack")
|
||||
gem("myrack", ">= 0")
|
||||
gem("myrack", require: false)
|
||||
G
|
||||
|
||||
bundle "remove myrack"
|
||||
|
||||
expect(out).to include("myrack was removed.")
|
||||
expect(gemfile).to eq <<~G
|
||||
source "https://gem.repo1"
|
||||
G
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user