Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Merge #7247
Browse files Browse the repository at this point in the history
7247: Drop rubygems 2.5.0 and 2.5.1 support r=hsbt a=deivid-rodriguez

### What was the end-user problem that led to this PR?

The problem was that we have some conditional code in bundler dependent on the rubygems version being used, that could be easily removed if we dropped support for rubygems 2.5.0 and 2.5.1.

### What was your diagnosis of the problem?

My diagnosis was that we could drop support for these versions now, to remove all of those conditionals and simplify the integration.

### What is your fix for the problem, implemented in this PR?

My fix is to drop support for rubygems 2.5.0 and 2.5.1.

### Why did you choose this fix out of the possible options?

I chose this fix because the oldest ruby we currently support, 2.3, ships with rubygems 2.5.2, so it's very unlikely that any user of the next bundler version will be using these old rubygems versions, because they would need to explicitly downgrade rubygems!

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
  • Loading branch information
bundlerbot and deivid-rodriguez committed Jul 12, 2019
2 parents 2eec310 + 8ecd722 commit 53bc81e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bundler.gemspec
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |s|
end

s.required_ruby_version = ">= 2.3.0"
s.required_rubygems_version = ">= 2.5.0"
s.required_rubygems_version = ">= 2.5.2"

s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }

Expand Down
14 changes: 0 additions & 14 deletions lib/bundler/rubygems_integration.rb
Expand Up @@ -314,19 +314,6 @@ def reverse_rubygems_kernel_mixin
end
end

# RubyGems-generated binstubs call Kernel#gem
def binstubs_call_gem?
!provides?(">= 2.5.2")
end

# only 2.5.2+ has all of the stub methods we want to use, and since this
# is a performance optimization _only_,
# we'll restrict ourselves to the most
# recent RG versions instead of all versions that have stubs
def stubs_provide_full_functionality?
provides?(">= 2.5.2")
end

def replace_gem(specs, specs_by_name)
reverse_rubygems_kernel_mixin

Expand All @@ -335,7 +322,6 @@ def replace_gem(specs, specs_by_name)
kernel = (class << ::Kernel; self; end)
[kernel, ::Kernel].each do |kernel_class|
redefine_method(kernel_class, :gem) do |dep, *reqs|
executables ||= specs.map(&:executables).flatten if ::Bundler.rubygems.binstubs_call_gem?
if executables && executables.include?(File.basename(caller.first.split(":").first))
break
end
Expand Down
10 changes: 4 additions & 6 deletions lib/bundler/source/git.rb
Expand Up @@ -314,12 +314,10 @@ def fetch
# no-op, since we validate when re-serializing the gemspec
def validate_spec(_spec); end

if Bundler.rubygems.stubs_provide_full_functionality?
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
StubSpecification.from_stub(stub)
end
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
StubSpecification.from_stub(stub)
end

def git_scope
Expand Down
6 changes: 2 additions & 4 deletions lib/bundler/stub_specification.rb
Expand Up @@ -63,10 +63,8 @@ def loaded_from
stub.loaded_from
end

if Bundler.rubygems.stubs_provide_full_functionality?
def matches_for_glob(glob)
stub.matches_for_glob(glob)
end
def matches_for_glob(glob)
stub.matches_for_glob(glob)
end

def raw_require_paths
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/exec_spec.rb
Expand Up @@ -851,7 +851,7 @@ def bin_path(a,b,c)
bundle :install, :system_bundler => true, :path => "vendor/bundler"
end

it "overrides disable_shared_gems so bundler can be found", :ruby_repo, :rubygems => ">= 2.6.2" do
it "overrides disable_shared_gems so bundler can be found", :ruby_repo do
system_gems :bundler
file = bundled_app("file_that_bundle_execs.rb")
create_file(file, <<-RB)
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/info_spec.rb
Expand Up @@ -104,7 +104,7 @@
expect(out).to include("foo (1.0 #{sha[0..6]})")
end

it "handles when a version is a '-' prerelease", :rubygems => "2.1" do
it "handles when a version is a '-' prerelease" do
@git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo"))
install_gemfile <<-G
gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}"
Expand Down

0 comments on commit 53bc81e

Please sign in to comment.