Skip to content

Commit

Permalink
[rubygems/rubygems] Remove extension building sync stuff no longer pr…
Browse files Browse the repository at this point in the history
…esent in RubyGems

rubygems/rubygems@59a85388b9
  • Loading branch information
deivid-rodriguez authored and hsbt committed Dec 14, 2023
1 parent 41095f4 commit d718654
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 35 deletions.
28 changes: 2 additions & 26 deletions lib/bundler/rubygems_integration.rb
Expand Up @@ -4,17 +4,12 @@

module Bundler
class RubygemsIntegration
if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR
else
require "monitor"
require "monitor"

EXT_LOCK = Monitor.new
end
EXT_LOCK = Monitor.new

def initialize
@replaced_methods = {}
backport_ext_builder_monitor
end

def version
Expand Down Expand Up @@ -479,25 +474,6 @@ def all_specs
end
end

def backport_ext_builder_monitor
# So we can avoid requiring "rubygems/ext" in its entirety
Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
module Ext
end
RUBY

require "rubygems/ext/builder"

Gem::Ext::Builder.class_eval do
unless const_defined?(:CHDIR_MONITOR)
const_set(:CHDIR_MONITOR, EXT_LOCK)
end

remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
end
end

def find_bundler(version)
find_name("bundler").find {|s| s.version.to_s == version }
end
Expand Down
1 change: 0 additions & 1 deletion spec/bundler/bundler/plugin/installer_spec.rb
Expand Up @@ -6,7 +6,6 @@
describe "cli install" do
it "uses Gem.sources when non of the source is provided" do
sources = double(:sources)
Bundler.settings # initialize it before we have to touch rubygems.ext_lock
allow(Gem).to receive(:sources) { sources }

allow(installer).to receive(:install_rubygems).
Expand Down
4 changes: 0 additions & 4 deletions spec/bundler/bundler/rubygems_integration_spec.rb
@@ -1,10 +1,6 @@
# frozen_string_literal: true

RSpec.describe Bundler::RubygemsIntegration do
it "uses the same chdir lock as rubygems" do
expect(Bundler.rubygems.ext_lock).to eq(Gem::Ext::Builder::CHDIR_MONITOR)
end

context "#validate" do
let(:spec) do
Gem::Specification.new do |s|
Expand Down
4 changes: 0 additions & 4 deletions spec/bundler/bundler/shared_helpers_spec.rb
@@ -1,12 +1,8 @@
# frozen_string_literal: true

RSpec.describe Bundler::SharedHelpers do
let(:ext_lock_double) { double(:ext_lock) }

before do
pwd_stub
allow(Bundler.rubygems).to receive(:ext_lock).and_return(ext_lock_double)
allow(ext_lock_double).to receive(:synchronize) {|&block| block.call }
end

let(:pwd_stub) { allow(subject).to receive(:pwd).and_return(bundled_app) }
Expand Down

0 comments on commit d718654

Please sign in to comment.