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

ruby-changes:59482

From: Yusuke <ko1@a...>
Date: Wed, 25 Dec 2019 18:08:18 +0900 (JST)
Subject: [ruby-changes:59482] 75dca097b8 (master): [bundler/bundler] Do `require "rubygems"` only when needed

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

From 75dca097b873222eaf3c70b7f43e3ffb98b7f2ed Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 25 Dec 2019 14:13:15 +0900
Subject: [bundler/bundler] Do `require "rubygems"` only when needed

This require causes circular require.

```
$ touch empty_file

$ RUBYGEMS_GEMDEPS=empty_file ./local/bin/ruby -w -e ''
/home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92: warning: /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92: warning: loading in progress, circular require considered harmful - /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems.rb
	from <internal:gem_prelude>:1:in  `<internal:gem_prelude>'
	from <internal:gem_prelude>:1:in  `require'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems.rb:1417:in  `<top (required)>'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems.rb:1203:in  `use_gemdeps'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/user_interaction.rb:47:in  `use_ui'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems.rb:1204:in  `block in use_gemdeps'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in  `require'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in  `require'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/bundler.rb:11:in  `<top (required)>'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/bundler.rb:11:in  `require_relative'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/bundler/rubygems_integration.rb:3:in  `<top (required)>'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in  `require'
	from /home/mame/work/ruby/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in  `require'
```

https://github.com/bundler/bundler/commit/c7c5bcea92

diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 18da591..d97621c 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/rubygems_integration.rb#L1
 # frozen_string_literal: true
 
-require "rubygems"
+require "rubygems" unless defined?(Gem)
 
 module Bundler
   class RubygemsIntegration
-- 
cgit v0.10.2


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

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