bundler 4.0.11 → 4.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1eb2d32f3dd6dc576ac4fc1cf263101ae709911da9a91d58d05e51f94a22f94a
4
- data.tar.gz: 0df681b631b0be9801622df725900061a487c8a8855cc932c0bf1c978d1c6fe2
3
+ metadata.gz: 94fc49b469e2eb2c15c70f7bb43e4503f0de0962380b5b6eea5909bff3a08d1e
4
+ data.tar.gz: 301b0eb9cb089ba4fda55fcbcd1ad1e65c608c35107906a415546245d58d1368
5
5
  SHA512:
6
- metadata.gz: '0852662046057ee2680a9a0b975f169493da3681b08e2ce4b08cbad86ef1537b7598b87e24109a3b51c3c6b93dbc2863ca7259a18c45126b849a2e1885eefedf'
7
- data.tar.gz: 00f14095e674ce91531777ab01f883de1e3e612fbbb3ee3a59a6eccfa6188be0fcbfadf237a7cf8133d05ed360ad6cc8fa6a7d0da588c3aad73501fb7af36a8b
6
+ metadata.gz: ca630b85c261a32145258e2264627f9beca9c45c72cc21ad195a72774d28808fbe57a9b6242af937ac2ee85d636f0f7f73278c97aeae7cf8a7b1de58f7480f50
7
+ data.tar.gz: 40329f0aa226b3e314c740e765ae8d22e298666fcf05454bb9b1788639e4ef1b8bea18cb74f2da33245b0faefcd2dac70175169067f375841decc36bd01523d7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.12 / 2026-05-20
4
+
5
+ ### Enhancements:
6
+
7
+ * Make `bundle config get` return status 1 when the value is not set. Pull request [#9505](https://github.com/ruby/rubygems/pull/9505) by willnet
8
+ * Use Pathname#absolute?. Pull request [#9529](https://github.com/ruby/rubygems/pull/9529) by nobu
9
+ * Deprecate parsing non-lockfile content in LockfileParser. Pull request [#9502](https://github.com/ruby/rubygems/pull/9502) by kurotaky
10
+ * Print a warning for a potential confusion from the indirect dependencies. Pull request [#5029](https://github.com/ruby/rubygems/pull/5029) by junaruga
11
+ * Respect Gemfile bundler setting in `Bundler.setup`. Pull request [#4892](https://github.com/ruby/rubygems/pull/4892) by godfat
12
+
13
+ ### Bug fixes:
14
+
15
+ * Gracefully handle missing checksums in Compact Index. Pull request [#9492](https://github.com/ruby/rubygems/pull/9492) by jneen
16
+ * Skip git source exclusion when lockfile cannot backfill. Pull request [#9544](https://github.com/ruby/rubygems/pull/9544) by yahonda
17
+ * Fix bundle config gemfile unset behavior. Pull request [#9514](https://github.com/ruby/rubygems/pull/9514) by afurm
18
+
3
19
  ## 4.0.11 / 2026-04-30
4
20
 
5
21
  ### Enhancements:
@@ -5,7 +5,7 @@ module Bundler
5
5
  module BuildMetadata
6
6
  # begin ivars
7
7
  @built_at = nil
8
- @git_commit_sha = "b7155a3865".freeze
8
+ @git_commit_sha = "665f998196".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -87,16 +87,21 @@ module Bundler
87
87
 
88
88
  if value.nil?
89
89
  warn_unused_scope "Ignoring --#{scope} since no value to set was given"
90
+ current_value = Bundler.settings[name]
90
91
 
91
92
  if options[:parseable]
92
93
  if value = Bundler.settings[name]
93
94
  Bundler.ui.info("#{name}=#{value}")
94
95
  end
95
- return
96
+ else
97
+ confirm(name)
96
98
  end
97
99
 
98
- confirm(name)
99
- return
100
+ if current_value.nil?
101
+ exit 1
102
+ else
103
+ return
104
+ end
100
105
  end
101
106
 
102
107
  Bundler.ui.info(message) if message
data/lib/bundler/cli.rb CHANGED
@@ -61,18 +61,18 @@ module Bundler
61
61
 
62
62
  current_cmd = args.last[:current_command].name
63
63
 
64
- custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
65
- if custom_gemfile && !custom_gemfile.empty?
66
- Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
67
- reset_settings = true
68
- end
69
-
70
- # lock --lockfile works differently than install --lockfile
71
- unless current_cmd == "lock"
72
- custom_lockfile = options[:lockfile] || ENV["BUNDLE_LOCKFILE"] || Bundler.settings[:lockfile]
73
- if custom_lockfile && !custom_lockfile.empty?
74
- Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", File.expand_path(custom_lockfile)
75
- reset_settings = true
64
+ # `bundle config` manages stored settings, so avoid promoting settings
65
+ # like `gemfile` or `lockfile` to environment variables before it runs.
66
+ unless current_cmd == "config"
67
+ Bundler.configure_custom_gemfile(options[:gemfile])
68
+
69
+ # lock --lockfile works differently than install --lockfile
70
+ unless current_cmd == "lock"
71
+ custom_lockfile = options[:lockfile] || ENV["BUNDLE_LOCKFILE"] || Bundler.settings[:lockfile]
72
+ if custom_lockfile && !custom_lockfile.empty?
73
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", File.expand_path(custom_lockfile)
74
+ reset_settings = true
75
+ end
76
76
  end
77
77
  end
78
78
 
@@ -71,7 +71,10 @@ module Bundler
71
71
  # This method gets called at least once for every gem when parsing versions.
72
72
  def parse_version_checksum(line, checksums)
73
73
  return unless (name_end = line.index(" ")) # Artifactory bug causes blank lines in artifactor index files
74
- return unless (checksum_start = line.index(" ", name_end + 1) + 1)
74
+ checksum_start = line.index(" ", name_end + 1)
75
+ return unless checksum_start
76
+ checksum_start += 1
77
+
75
78
  checksum_end = line.size - checksum_start
76
79
 
77
80
  line.freeze # allows slicing into the string to not allocate a copy of the line
@@ -783,7 +783,25 @@ module Bundler
783
783
  end
784
784
 
785
785
  def precompute_source_requirements_for_indirect_dependencies?
786
- sources.non_global_rubygems_sources.all?(&:dependency_api_available?)
786
+ if sources.non_global_rubygems_sources.all?(&:dependency_api_available?)
787
+ true
788
+ else
789
+ non_dependency_api_warning
790
+ false
791
+ end
792
+ end
793
+
794
+ def non_dependency_api_warning
795
+ non_api_sources = sources.non_global_rubygems_sources.reject(&:dependency_api_available?)
796
+ non_api_source_names = non_api_sources.map {|d| " * #{d}" }.join("\n")
797
+
798
+ msg = String.new
799
+ msg << "Your Gemfile contains scoped sources that don't implement a dependency API, namely:\n\n"
800
+ msg << non_api_source_names
801
+ msg << "\n\nUsing the above gem servers may result in installing unexpected gems. " \
802
+ "To resolve this warning, make sure you use gem servers that implement dependency APIs, " \
803
+ "such as gemstash or geminabox gem servers."
804
+ Bundler.ui.warn msg
787
805
  end
788
806
 
789
807
  def current_platform_locked?
@@ -1159,16 +1177,20 @@ module Bundler
1159
1177
  def find_source_requirements
1160
1178
  preload_git_sources
1161
1179
 
1180
+ # Only safe to exclude when locked_requirements (merged below) backfills the gap.
1181
+ nothing_changed = nothing_changed?
1182
+ excluded = nothing_changed ? excluded_git_sources : []
1183
+
1162
1184
  # Record the specs available in each gem's source, so that those
1163
1185
  # specs will be available later when the resolver knows where to
1164
1186
  # look for that gemspec (or its dependencies)
1165
1187
  source_requirements = if precompute_source_requirements_for_indirect_dependencies?
1166
- all_requirements = source_map.all_requirements(excluded_git_sources)
1188
+ all_requirements = source_map.all_requirements(excluded)
1167
1189
  { default: default_source }.merge(all_requirements)
1168
1190
  else
1169
- { default: Source::RubygemsAggregate.new(sources, source_map, excluded_git_sources) }.merge(source_map.direct_requirements)
1191
+ { default: Source::RubygemsAggregate.new(sources, source_map, excluded) }.merge(source_map.direct_requirements)
1170
1192
  end
1171
- source_requirements.merge!(source_map.locked_requirements) if nothing_changed?
1193
+ source_requirements.merge!(source_map.locked_requirements) if nothing_changed
1172
1194
  metadata_dependencies.each do |dep|
1173
1195
  source_requirements[dep.name] = sources.metadata_source
1174
1196
  end
@@ -115,6 +115,17 @@ module Bundler
115
115
  "Run `git checkout HEAD -- #{@lockfile_path}` first to get a clean lock."
116
116
  end
117
117
 
118
+ @valid = lockfile.strip.empty? ||
119
+ lockfile.split(/(?:\r?\n)+/).any? {|l| KNOWN_SECTIONS.include?(l) }
120
+
121
+ unless @valid
122
+ SharedHelpers.feature_deprecated!(
123
+ "Your #{@lockfile_path} does not appear to be a valid lockfile. " \
124
+ "Run `rm #{@lockfile_path}` and then `bundle install` to generate a new lockfile. " \
125
+ "This will raise a LockfileError in a future version of Bundler."
126
+ )
127
+ end
128
+
118
129
  lockfile.split(/((?:\r?\n)+)/) do |line|
119
130
  # split alternates between the line and the following whitespace
120
131
  next @pos.advance!(line) if line.match?(/^\s*$/)
@@ -164,6 +175,10 @@ module Bundler
164
175
  bundler_version.nil? || bundler_version < Gem::Version.new("1.16.2")
165
176
  end
166
177
 
178
+ def valid?
179
+ @valid
180
+ end
181
+
167
182
  private
168
183
 
169
184
  TYPES = {
@@ -220,10 +220,11 @@ module Bundler
220
220
  # Some gem authors put absolute paths in their gemspec
221
221
  # and we have to save them from themselves
222
222
  spec.files = spec.files.filter_map do |path|
223
- next path unless /\A#{Pathname::SEPARATOR_PAT}/o.match?(path)
223
+ pathname = Pathname.new(path)
224
+ next path unless pathname.absolute?
224
225
  next if File.directory?(path)
225
226
  begin
226
- Pathname.new(path).relative_path_from(gem_dir).to_s
227
+ pathname.relative_path_from(gem_dir).to_s
227
228
  rescue ArgumentError
228
229
  path
229
230
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.11".freeze
4
+ VERSION = "4.0.12".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
data/lib/bundler.rb CHANGED
@@ -156,6 +156,7 @@ module Bundler
156
156
  # Return if all groups are already loaded
157
157
  return @setup if defined?(@setup) && @setup
158
158
 
159
+ configure_custom_gemfile
159
160
  definition.validate_runtime!
160
161
 
161
162
  SharedHelpers.print_major_deprecations!
@@ -586,6 +587,15 @@ module Bundler
586
587
  Bundler.rubygems.clear_paths
587
588
  end
588
589
 
590
+ def configure_custom_gemfile(custom_gemfile = nil)
591
+ custom_gemfile ||= Bundler.settings[:gemfile]
592
+
593
+ if custom_gemfile && !custom_gemfile.empty?
594
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
595
+ reset_settings_and_root!
596
+ end
597
+ end
598
+
589
599
  def self_manager
590
600
  @self_manager ||= begin
591
601
  require_relative "bundler/self_manager"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.11
4
+ version: 4.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  - !ruby/object:Gem::Version
403
403
  version: 3.4.1
404
404
  requirements: []
405
- rubygems_version: 4.0.6
405
+ rubygems_version: 4.0.10
406
406
  specification_version: 4
407
407
  summary: The best way to manage your application's dependencies
408
408
  test_files: []