aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/dsl.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-07-07 14:07:29 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-07-07 15:31:52 +0900
commitc082c6eb7c786a432bea23cf78839f64585cb630 (patch)
treee3c608264fe03645e905fe7284d713cff87b87dd /lib/bundler/dsl.rb
parent6e2240a2f954c84ed12357382c9c065ae4b91e11 (diff)
downloadruby-c082c6eb7c786a432bea23cf78839f64585cb630.tar.gz
Sync RubyGems and Bundler with upstream
Diffstat (limited to 'lib/bundler/dsl.rb')
-rw-r--r--lib/bundler/dsl.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 313d1a9a41..dc72bf0d93 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -24,9 +24,6 @@ module Bundler
def initialize
@source = nil
@sources = SourceList.new
-
- @global_rubygems_sources = []
-
@git_sources = {}
@dependencies = []
@groups = []
@@ -48,7 +45,6 @@ module Bundler
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
- check_primary_source_safety
rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
@@ -168,7 +164,7 @@ module Bundler
elsif block_given?
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
else
- @global_rubygems_sources << source
+ @sources.add_global_rubygems_remote(source)
end
end
@@ -222,6 +218,7 @@ module Bundler
end
def to_definition(lockfile, unlock)
+ check_primary_source_safety
Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles)
end
@@ -453,12 +450,7 @@ repo_name ||= user_name
end
def check_rubygems_source_safety
- @sources.global_rubygems_source = @global_rubygems_sources.shift
- return if @global_rubygems_sources.empty?
-
- @global_rubygems_sources.each do |source|
- @sources.add_rubygems_remote(source)
- end
+ return unless @sources.aggregate_global_source?
if Bundler.feature_flag.bundler_3_mode?
msg = "This Gemfile contains multiple primary sources. " \