Skip to content

Commit 91a4926

Browse files
hsbtk0kubun
authored andcommitted
Merge RubyGems/Bundler 4.0.4
1 parent d5d3fb8 commit 91a4926

19 files changed

Lines changed: 246 additions & 16 deletions

File tree

lib/bundler/cli/add.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ def inject_dependencies
3636
end
3737

3838
def validate_options!
39+
raise InvalidOption, "You cannot specify `--git` and `--github` at the same time." if options["git"] && options["github"]
40+
41+
unless options["git"] || options["github"]
42+
raise InvalidOption, "You cannot specify `--branch` unless `--git` or `--github` is specified." if options["branch"]
43+
44+
raise InvalidOption, "You cannot specify `--ref` unless `--git` or `--github` is specified." if options["ref"]
45+
end
46+
47+
raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
48+
3949
raise InvalidOption, "You cannot specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
4050

4151
# raise error when no gems are specified

lib/bundler/current_ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def self.current_ruby
1111
end
1212

1313
class CurrentRuby
14-
ALL_RUBY_VERSIONS = [*18..27, *30..34, 40].freeze
14+
ALL_RUBY_VERSIONS = [*18..27, *30..34, *40..41].freeze
1515
KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
1616
KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
1717
PLATFORM_MAP = {

lib/bundler/definition.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,22 @@ def converge_specs(specs)
10661066

10671067
deps << dep if !replacement_source || lockfile_source.include?(replacement_source) || new_deps.include?(dep)
10681068
else
1069-
replacement_source = sources.get(lockfile_source)
1069+
parent_dep = @dependencies.find do |d|
1070+
next unless d.source && d.source != lockfile_source
1071+
next if d.source.is_a?(Source::Gemspec)
1072+
1073+
parent_locked_specs = @originally_locked_specs[d.name]
1074+
1075+
parent_locked_specs.any? do |parent_spec|
1076+
parent_spec.runtime_dependencies.any? {|rd| rd.name == s.name }
1077+
end
1078+
end
1079+
1080+
if parent_dep
1081+
replacement_source = parent_dep.source
1082+
else
1083+
replacement_source = sources.get(lockfile_source)
1084+
end
10701085
end
10711086

10721087
# Replace the locked dependency's source with the equivalent source from the Gemfile

lib/bundler/rubygems_integration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def default_specs
432432
end
433433

434434
def find_bundler(version)
435-
find_name("bundler").find {|s| s.version.to_s == version }
435+
find_name("bundler").find {|s| s.version.to_s == version.to_s }
436436
end
437437

438438
def find_name(name)

lib/bundler/runtime.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,14 @@ def clean(dry_run = false)
174174
spec_cache_paths = []
175175
spec_gemspec_paths = []
176176
spec_extension_paths = []
177-
Bundler.rubygems.add_default_gems_to(specs).values.each do |spec|
177+
specs_to_keep = Bundler.rubygems.add_default_gems_to(specs).values
178+
179+
current_bundler = Bundler.rubygems.find_bundler(Bundler.gem_version)
180+
if current_bundler
181+
specs_to_keep << current_bundler
182+
end
183+
184+
specs_to_keep.each do |spec|
178185
spec_gem_paths << spec.full_gem_path
179186
# need to check here in case gems are nested like for the rails git repo
180187
md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)

lib/bundler/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22

33
module Bundler
4-
VERSION = "4.0.3".freeze
4+
VERSION = "4.0.4".freeze
55

66
def self.bundler_major_version
77
@bundler_major_version ||= gem_version.segments.first

lib/rubygems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require "rbconfig"
1010

1111
module Gem
12-
VERSION = "4.0.3"
12+
VERSION = "4.0.4"
1313
end
1414

1515
require_relative "rubygems/defaults"

lib/rubygems/commands/rebuild_command.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "date"
43
require "digest"
54
require "fileutils"
65
require "tmpdir"

lib/rubygems/installer.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,12 @@ def build_args
943943
end
944944

945945
def build_jobs
946-
@build_jobs ||= Etc.nprocessors + 1
946+
@build_jobs ||= begin
947+
require "etc"
948+
Etc.nprocessors + 1
949+
rescue LoadError
950+
1
951+
end
947952
end
948953

949954
def rb_config

spec/bundler/bundler/current_ruby_spec.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ruby_33: Gem::Platform::RUBY,
2424
ruby_34: Gem::Platform::RUBY,
2525
ruby_40: Gem::Platform::RUBY,
26+
ruby_41: Gem::Platform::RUBY,
2627
mri: Gem::Platform::RUBY,
2728
mri_18: Gem::Platform::RUBY,
2829
mri_19: Gem::Platform::RUBY,
@@ -40,6 +41,7 @@
4041
mri_33: Gem::Platform::RUBY,
4142
mri_34: Gem::Platform::RUBY,
4243
mri_40: Gem::Platform::RUBY,
44+
mri_41: Gem::Platform::RUBY,
4345
rbx: Gem::Platform::RUBY,
4446
truffleruby: Gem::Platform::RUBY,
4547
jruby: Gem::Platform::JAVA,
@@ -61,7 +63,8 @@
6163
windows_32: Gem::Platform::WINDOWS,
6264
windows_33: Gem::Platform::WINDOWS,
6365
windows_34: Gem::Platform::WINDOWS,
64-
windows_40: Gem::Platform::WINDOWS }
66+
windows_40: Gem::Platform::WINDOWS,
67+
windows_41: Gem::Platform::WINDOWS }
6568
end
6669

6770
let(:deprecated) do
@@ -82,6 +85,7 @@
8285
mswin_33: Gem::Platform::MSWIN,
8386
mswin_34: Gem::Platform::MSWIN,
8487
mswin_40: Gem::Platform::MSWIN,
88+
mswin_41: Gem::Platform::MSWIN,
8589
mswin64: Gem::Platform::MSWIN64,
8690
mswin64_19: Gem::Platform::MSWIN64,
8791
mswin64_20: Gem::Platform::MSWIN64,
@@ -98,6 +102,7 @@
98102
mswin64_33: Gem::Platform::MSWIN64,
99103
mswin64_34: Gem::Platform::MSWIN64,
100104
mswin64_40: Gem::Platform::MSWIN64,
105+
mswin64_41: Gem::Platform::MSWIN64,
101106
mingw: Gem::Platform::UNIVERSAL_MINGW,
102107
mingw_18: Gem::Platform::UNIVERSAL_MINGW,
103108
mingw_19: Gem::Platform::UNIVERSAL_MINGW,
@@ -115,6 +120,7 @@
115120
mingw_33: Gem::Platform::UNIVERSAL_MINGW,
116121
mingw_34: Gem::Platform::UNIVERSAL_MINGW,
117122
mingw_40: Gem::Platform::UNIVERSAL_MINGW,
123+
mingw_41: Gem::Platform::UNIVERSAL_MINGW,
118124
x64_mingw: Gem::Platform::UNIVERSAL_MINGW,
119125
x64_mingw_20: Gem::Platform::UNIVERSAL_MINGW,
120126
x64_mingw_21: Gem::Platform::UNIVERSAL_MINGW,
@@ -129,7 +135,8 @@
129135
x64_mingw_32: Gem::Platform::UNIVERSAL_MINGW,
130136
x64_mingw_33: Gem::Platform::UNIVERSAL_MINGW,
131137
x64_mingw_34: Gem::Platform::UNIVERSAL_MINGW,
132-
x64_mingw_40: Gem::Platform::UNIVERSAL_MINGW }
138+
x64_mingw_40: Gem::Platform::UNIVERSAL_MINGW,
139+
x64_mingw_41: Gem::Platform::UNIVERSAL_MINGW }
133140
end
134141
# rubocop:enable Naming/VariableNumber
135142

0 commit comments

Comments
 (0)