bundler 4.0.0.beta1 → 4.0.0.beta2

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: 1ea78831fde425df537d3ff1df353f5a3aca9f487ce4afa9e46299fa9dc97156
4
- data.tar.gz: 6a00156d2407d372ee1e53ea9e8410a47c3ab253f022316001781e051c9cdb48
3
+ metadata.gz: 634a5d5342f3171f45785382c66e37eadd9e233782cf590ebe1163a857d7d75c
4
+ data.tar.gz: 2a4f5c89ba76155d05341c6651cf3583cb778f1912adf64647c752fafad03a46
5
5
  SHA512:
6
- metadata.gz: b019a26c02b28e3f2e9d09dc52651549395248978130e40413800ebd738140bc3451639a112a0475a4cfa43818798aaff4d88b0105633e035133f7cc985d3003
7
- data.tar.gz: dead007ff8a70c1bde02642b9c22c4eeb038cddb9751d175c4106ad030284ed2a71b84f4861e23e83d9be48e47bf3c5085e0ba0e80d9a10902ce042b6a78939b
6
+ metadata.gz: 4ef623469cfa6abb93f3bb7932a739824ae25285f29f59895786b041347b23d01b8f0f604ad133a5827b9f84862b0ac75a313376fbb20f480b5c44fb10a063bb
7
+ data.tar.gz: 2b07593c43df7d7b8e1cd4f4fbe6a83e44656804c6b10a9f5ce908057bd8c175e4f0f8683c3251bbcdd05d7aec607a43cb21e4674c405c5a7dbbea6cde669ef7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.0.beta2 (2025-11-26)
4
+
5
+ ### Features:
6
+
7
+ - Support bundle install --lockfile option [#9111](https://github.com/ruby/rubygems/pull/9111)
8
+ - Add support for lockfile in Gemfile and bundle install --no-lock [#9059](https://github.com/ruby/rubygems/pull/9059)
9
+
10
+ ### Performance:
11
+
12
+ - Run git operations in parallel to speed things up: [#9100](https://github.com/ruby/rubygems/pull/9100)
13
+
14
+ ### Enhancements:
15
+
16
+ - Fixup GH-9085 [#9108](https://github.com/ruby/rubygems/pull/9108)
17
+ - Add go_gem/rake_task for Go native extention gem skeleton [#9105](https://github.com/ruby/rubygems/pull/9105)
18
+ - Keep legacy windows platform, not removed them [#9104](https://github.com/ruby/rubygems/pull/9104)
19
+
20
+ ### Bug fixes:
21
+
22
+ - Check for file existence before deletion from cache [#9095](https://github.com/ruby/rubygems/pull/9095)
23
+
3
24
  ## 4.0.0.beta1 (2025-11-20)
4
25
 
5
26
  ### Security:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2025-11-20".freeze
8
- @git_commit_sha = "9be811c01a".freeze
7
+ @built_at = "2025-11-26".freeze
8
+ @git_commit_sha = "743810236c".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -44,6 +44,8 @@ module Bundler
44
44
  # (rather than some optimizations we perform at app runtime).
45
45
  definition = Bundler.definition(strict: true)
46
46
  definition.validate_runtime!
47
+ definition.lockfile = options["lockfile"] if options["lockfile"]
48
+ definition.lockfile = false if options["no-lock"]
47
49
 
48
50
  installer = Installer.install(Bundler.root, definition, options)
49
51
 
data/lib/bundler/cli.rb CHANGED
@@ -59,17 +59,29 @@ module Bundler
59
59
  def initialize(*args)
60
60
  super
61
61
 
62
+ current_cmd = args.last[:current_command].name
63
+
62
64
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
63
65
  if custom_gemfile && !custom_gemfile.empty?
64
66
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
65
- Bundler.reset_settings_and_root!
67
+ reset_settings = true
66
68
  end
67
69
 
70
+ # lock --lockfile works differently than install --lockfile
71
+ unless current_cmd == "lock"
72
+ custom_lockfile = options[: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
76
+ end
77
+ end
78
+
79
+ Bundler.reset_settings_and_root! if reset_settings
80
+
68
81
  Bundler.auto_switch
69
82
 
70
83
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
71
84
 
72
- current_cmd = args.last[:current_command].name
73
85
  Bundler.auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
74
86
  rescue UnknownArgumentError => e
75
87
  raise InvalidOption, e.message
@@ -232,8 +244,10 @@ module Bundler
232
244
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
233
245
  method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
234
246
  method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
247
+ method_option "lockfile", type: :string, banner: "Use the specified lockfile instead of the default."
235
248
  method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
236
249
  method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
250
+ method_option "no-lock", type: :boolean, banner: "Don't create a lockfile."
237
251
  method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
238
252
  method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache (removed)."
239
253
  method_option "path", type: :string, banner: "Specify a different path than the system default, namely, $BUNDLE_PATH or $GEM_HOME (removed)."
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "lockfile_parser"
4
+ require_relative "worker"
4
5
 
5
6
  module Bundler
6
7
  class Definition
@@ -9,6 +10,8 @@ module Bundler
9
10
  attr_accessor :no_lock
10
11
  end
11
12
 
13
+ attr_writer :lockfile
14
+
12
15
  attr_reader(
13
16
  :dependencies,
14
17
  :locked_checksums,
@@ -379,7 +382,7 @@ module Bundler
379
382
  end
380
383
 
381
384
  def write_lock(file, preserve_unknown_sections)
382
- return if Definition.no_lock || file.nil?
385
+ return if Definition.no_lock || !lockfile || file.nil?
383
386
 
384
387
  contents = to_lock
385
388
 
@@ -1100,7 +1103,23 @@ module Bundler
1100
1103
  @source_requirements ||= find_source_requirements
1101
1104
  end
1102
1105
 
1106
+ def preload_git_source_worker
1107
+ @preload_git_source_worker ||= Bundler::Worker.new(5, "Git source preloading", ->(source, _) { source.specs })
1108
+ end
1109
+
1110
+ def preload_git_sources
1111
+ sources.git_sources.each {|source| preload_git_source_worker.enq(source) }
1112
+ ensure
1113
+ preload_git_source_worker.stop
1114
+ end
1115
+
1103
1116
  def find_source_requirements
1117
+ if Gem.ruby_version >= Gem::Version.new("3.3")
1118
+ # Ruby 3.2 has a bug that incorrectly triggers a circular dependency warning. This version will continue to
1119
+ # fetch git repositories one by one.
1120
+ preload_git_sources
1121
+ end
1122
+
1104
1123
  # Record the specs available in each gem's source, so that those
1105
1124
  # specs will be available later when the resolver knows where to
1106
1125
  # look for that gemspec (or its dependencies)
data/lib/bundler/dsl.rb CHANGED
@@ -9,8 +9,9 @@ module Bundler
9
9
 
10
10
  def self.evaluate(gemfile, lockfile, unlock)
11
11
  builder = new
12
+ builder.lockfile(lockfile)
12
13
  builder.eval_gemfile(gemfile)
13
- builder.to_definition(lockfile, unlock)
14
+ builder.to_definition(builder.lockfile_path, unlock)
14
15
  end
15
16
 
16
17
  VALID_PLATFORMS = Bundler::CurrentRuby::PLATFORM_MAP.keys.freeze
@@ -38,6 +39,7 @@ module Bundler
38
39
  @gemspecs = []
39
40
  @gemfile = nil
40
41
  @gemfiles = []
42
+ @lockfile = nil
41
43
  add_git_sources
42
44
  end
43
45
 
@@ -101,6 +103,15 @@ module Bundler
101
103
  add_dependency(name, version, options)
102
104
  end
103
105
 
106
+ # For usage in Dsl.evaluate, since lockfile is used as part of the Gemfile.
107
+ def lockfile_path
108
+ @lockfile
109
+ end
110
+
111
+ def lockfile(file)
112
+ @lockfile = file
113
+ end
114
+
104
115
  def source(source, *args, &blk)
105
116
  options = args.last.is_a?(Hash) ? args.pop.dup : {}
106
117
  options = normalize_hash(options)
@@ -175,6 +186,7 @@ module Bundler
175
186
 
176
187
  def to_definition(lockfile, unlock)
177
188
  check_primary_source_safety
189
+ lockfile = @lockfile unless @lockfile.nil?
178
190
  Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles)
179
191
  end
180
192
 
@@ -415,8 +427,8 @@ module Bundler
415
427
  windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
416
428
  if windows_platforms.any?
417
429
  windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
418
- removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
419
- Bundler::SharedHelpers.feature_removed! removed_message
430
+ deprecated_message = "Platform #{windows_platforms} will be removed in the future. Please use platform :windows instead."
431
+ Bundler::SharedHelpers.feature_deprecated! deprecated_message
420
432
  end
421
433
 
422
434
  # Save sources passed in a key
@@ -6,6 +6,7 @@ module Bundler
6
6
  BUNDLER_KEYS = %w[
7
7
  BUNDLE_BIN_PATH
8
8
  BUNDLE_GEMFILE
9
+ BUNDLE_LOCKFILE
9
10
  BUNDLER_VERSION
10
11
  BUNDLER_SETUP
11
12
  GEM_HOME
@@ -44,12 +44,14 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
44
44
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
45
45
 
46
46
  old_gemfile = ENV["BUNDLE_GEMFILE"]
47
+ old_lockfile = ENV["BUNDLE_LOCKFILE"]
47
48
 
48
49
  Bundler.unbundle_env!
49
50
 
50
51
  begin
51
52
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
52
53
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
54
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", "Gemfile.lock"
53
55
 
54
56
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.settings[:plugins]
55
57
  builder = Bundler::Dsl.new
@@ -94,5 +96,11 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
94
96
  else
95
97
  ENV["BUNDLE_GEMFILE"] = ""
96
98
  end
99
+
100
+ if old_lockfile
101
+ ENV["BUNDLE_LOCKFILE"] = old_lockfile
102
+ else
103
+ ENV["BUNDLE_LOCKFILE"] = ""
104
+ end
97
105
  end
98
106
  end
@@ -145,6 +145,9 @@ Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init
145
145
  \fBjobs\fR (\fBBUNDLE_JOBS\fR)
146
146
  The number of gems Bundler can install in parallel\. Defaults to the number of available processors\.
147
147
  .TP
148
+ \fBlockfile\fR (\fBBUNDLE_LOCKFILE\fR)
149
+ The path to the lockfile that bundler should use\. By default, Bundler adds \fB\.lock\fR to the end of the \fBgemfile\fR entry\. Can be set to \fBfalse\fR in the Gemfile to disable lockfile creation entirely (see gemfile(5))\.
150
+ .TP
148
151
  \fBlockfile_checksums\fR (\fBBUNDLE_LOCKFILE_CHECKSUMS\fR)
149
152
  Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources\. Defaults to true\.
150
153
  .TP
@@ -189,6 +189,10 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
189
189
  * `jobs` (`BUNDLE_JOBS`):
190
190
  The number of gems Bundler can install in parallel. Defaults to the number of
191
191
  available processors.
192
+ * `lockfile` (`BUNDLE_LOCKFILE`):
193
+ The path to the lockfile that bundler should use. By default, Bundler adds
194
+ `.lock` to the end of the `gemfile` entry. Can be set to `false` in the
195
+ Gemfile to disable lockfile creation entirely (see gemfile(5)).
192
196
  * `lockfile_checksums` (`BUNDLE_LOCKFILE_CHECKSUMS`):
193
197
  Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources. Defaults to true.
194
198
  * `no_install` (`BUNDLE_NO_INSTALL`):
@@ -4,7 +4,7 @@
4
4
  .SH "NAME"
5
5
  \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
6
6
  .SH "SYNOPSIS"
7
- \fBbundle install\fR [\-\-force] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-prefer\-local] [\-\-quiet] [\-\-retry=NUMBER] [\-\-standalone[=GROUP[ GROUP\|\.\|\.\|\.]]] [\-\-trust\-policy=TRUST\-POLICY] [\-\-target\-rbconfig=TARGET\-RBCONFIG]
7
+ \fBbundle install\fR [\-\-force] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-lockfile=LOCKFILE] [\-\-no\-cache] [\-\-no\-lock] [\-\-prefer\-local] [\-\-quiet] [\-\-retry=NUMBER] [\-\-standalone[=GROUP[ GROUP\|\.\|\.\|\.]]] [\-\-trust\-policy=TRUST\-POLICY] [\-\-target\-rbconfig=TARGET\-RBCONFIG]
8
8
  .SH "DESCRIPTION"
9
9
  Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\.
10
10
  .P
@@ -28,12 +28,20 @@ The maximum number of parallel download and install jobs\. The default is the nu
28
28
  \fB\-\-local\fR
29
29
  Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems' cache or in \fBvendor/cache\fR\. Note that if an appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\.
30
30
  .TP
31
+ \fB\-\-lockfile=LOCKFILE\fR
32
+ The location of the lockfile which Bundler should use\. This defaults to the Gemfile location with \fB\.lock\fR appended\.
33
+ .TP
31
34
  \fB\-\-prefer\-local\fR
32
35
  Force using locally installed gems, or gems already present in Rubygems' cache or in \fBvendor/cache\fR, when resolving, even if newer versions are available remotely\. Only attempt to connect to \fBrubygems\.org\fR for gems that are not present locally\.
33
36
  .TP
34
37
  \fB\-\-no\-cache\fR
35
38
  Do not update the cache in \fBvendor/cache\fR with the newly bundled gems\. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install\.
36
39
  .TP
40
+ \fB\-\-no\-lock\fR
41
+ Do not create a lockfile\. Useful if you want to install dependencies but not lock versions of gems\. Recommended for library development, and other situations where the code is expected to work with a range of dependency versions\.
42
+ .IP
43
+ This has the same effect as using \fBlockfile false\fR in the Gemfile\. See gemfile(5) for more information\.
44
+ .TP
37
45
  \fB\-\-quiet\fR
38
46
  Do not print progress information to the standard output\.
39
47
  .TP
@@ -8,7 +8,9 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
8
8
  [--gemfile=GEMFILE]
9
9
  [--jobs=NUMBER]
10
10
  [--local]
11
+ [--lockfile=LOCKFILE]
11
12
  [--no-cache]
13
+ [--no-lock]
12
14
  [--prefer-local]
13
15
  [--quiet]
14
16
  [--retry=NUMBER]
@@ -60,6 +62,10 @@ update process below under [CONSERVATIVE UPDATING][].
60
62
  appropriate platform-specific gem exists on `rubygems.org` it will not be
61
63
  found.
62
64
 
65
+ * `--lockfile=LOCKFILE`:
66
+ The location of the lockfile which Bundler should use. This defaults
67
+ to the Gemfile location with `.lock` appended.
68
+
63
69
  * `--prefer-local`:
64
70
  Force using locally installed gems, or gems already present in Rubygems' cache
65
71
  or in `vendor/cache`, when resolving, even if newer versions are available
@@ -71,6 +77,15 @@ update process below under [CONSERVATIVE UPDATING][].
71
77
  does not remove any gems in the cache but keeps the newly bundled gems from
72
78
  being cached during the install.
73
79
 
80
+ * `--no-lock`:
81
+ Do not create a lockfile. Useful if you want to install dependencies but not
82
+ lock versions of gems. Recommended for library development, and other
83
+ situations where the code is expected to work with a range of dependency
84
+ versions.
85
+
86
+ This has the same effect as using `lockfile false` in the Gemfile.
87
+ See gemfile(5) for more information.
88
+
74
89
  * `--quiet`:
75
90
  Do not print progress information to the standard output.
76
91
 
@@ -469,4 +469,35 @@ For implicit gems (dependencies of explicit gems), any source, git, or path repo
469
469
  .IP "3." 4
470
470
  If neither of the above conditions are met, the global source will be used\. If multiple global sources are specified, they will be prioritized from last to first, but this is deprecated since Bundler 1\.13, so Bundler prints a warning and will abort with an error in the future\.
471
471
  .IP "" 0
472
+ .SH "LOCKFILE"
473
+ By default, Bundler will create a lockfile by adding \fB\.lock\fR to the end of the Gemfile name\. To change this, use the \fBlockfile\fR method:
474
+ .IP "" 4
475
+ .nf
476
+ lockfile "/path/to/lockfile\.lock"
477
+ .fi
478
+ .IP "" 0
479
+ .P
480
+ This is useful when you want to use different lockfiles per ruby version or platform\.
481
+ .P
482
+ To avoid writing a lock file, use \fBfalse\fR as the argument:
483
+ .IP "" 4
484
+ .nf
485
+ lockfile false
486
+ .fi
487
+ .IP "" 0
488
+ .P
489
+ This is useful for library development and other situations where the code is expected to work with a range of dependency versions\.
490
+ .SS "LOCKFILE PRECEDENCE"
491
+ When determining path to the lockfile or whether to create a lockfile, the following precedence is used:
492
+ .IP "1." 4
493
+ The \fBbundle install\fR \fB\-\-no\-lock\fR option (which disables lockfile creation)\.
494
+ .IP "2." 4
495
+ The \fBbundle install\fR \fB\-\-lockfile\fR option\.
496
+ .IP "3." 4
497
+ The \fBlockfile\fR method in the Gemfile\.
498
+ .IP "4." 4
499
+ The \fBBUNDLE_LOCKFILE\fR environment variable\.
500
+ .IP "5." 4
501
+ The default behavior of adding \fB\.lock\fR to the end of the Gemfile name\.
502
+ .IP "" 0
472
503
 
@@ -556,3 +556,31 @@ bundler uses the following priority order:
556
556
  If multiple global sources are specified, they will be prioritized from
557
557
  last to first, but this is deprecated since Bundler 1.13, so Bundler prints
558
558
  a warning and will abort with an error in the future.
559
+
560
+ ## LOCKFILE
561
+
562
+ By default, Bundler will create a lockfile by adding `.lock` to the end of the
563
+ Gemfile name. To change this, use the `lockfile` method:
564
+
565
+ lockfile "/path/to/lockfile.lock"
566
+
567
+ This is useful when you want to use different lockfiles per ruby version or
568
+ platform.
569
+
570
+ To avoid writing a lock file, use `false` as the argument:
571
+
572
+ lockfile false
573
+
574
+ This is useful for library development and other situations where the code is
575
+ expected to work with a range of dependency versions.
576
+
577
+ ### LOCKFILE PRECEDENCE
578
+
579
+ When determining path to the lockfile or whether to create a lockfile, the
580
+ following precedence is used:
581
+
582
+ 1. The `bundle install` `--no-lock` option (which disables lockfile creation).
583
+ 1. The `bundle install` `--lockfile` option.
584
+ 1. The `lockfile` method in the Gemfile.
585
+ 1. The `BUNDLE_LOCKFILE` environment variable.
586
+ 1. The default behavior of adding `.lock` to the end of the Gemfile name.
@@ -240,7 +240,11 @@ module Bundler
240
240
 
241
241
  cached.each do |path|
242
242
  Bundler.ui.info " * #{File.basename(path)}"
243
- File.delete(path)
243
+
244
+ begin
245
+ File.delete(path)
246
+ rescue Errno::ENOENT
247
+ end
244
248
  end
245
249
  end
246
250
  end
@@ -65,6 +65,7 @@ module Bundler
65
65
  gem.rubocop
66
66
  gem.test
67
67
  gemfile
68
+ lockfile
68
69
  path
69
70
  shebang
70
71
  simulate_version
@@ -23,6 +23,9 @@ module Bundler
23
23
  end
24
24
 
25
25
  def default_lockfile
26
+ given = ENV["BUNDLE_LOCKFILE"]
27
+ return Pathname.new(given) if given && !given.empty?
28
+
26
29
  gemfile = default_gemfile
27
30
 
28
31
  case gemfile.basename.to_s
@@ -297,6 +300,7 @@ module Bundler
297
300
  def set_bundle_variables
298
301
  Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", bundle_bin_path
299
302
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
303
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", default_lockfile.to_s
300
304
  Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
301
305
  Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__)
302
306
  end
@@ -59,6 +59,11 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
59
59
  end
60
60
  <% end -%>
61
61
 
62
+ <% if config[:ext] == "go" -%>
63
+ require "go_gem/rake_task"
64
+
65
+ GoGem::RakeTask.new("<%= config[:underscored_name] %>")
66
+ <% end -%>
62
67
  <% end -%>
63
68
  <% if default_task_names.size == 1 -%>
64
69
  task default: <%= default_task_names.first.inspect %>
@@ -17,6 +17,7 @@ module Bundler
17
17
  @level = ENV["DEBUG"] ? "debug" : "info"
18
18
  @warning_history = []
19
19
  @output_stream = :stdout
20
+ @thread_safe_logger_key = "logger_level_#{object_id}"
20
21
  end
21
22
 
22
23
  def add_color(string, *color)
@@ -97,11 +98,13 @@ module Bundler
97
98
  end
98
99
 
99
100
  def level(name = nil)
100
- return @level unless name
101
+ current_level = Thread.current.thread_variable_get(@thread_safe_logger_key) || @level
102
+ return current_level unless name
103
+
101
104
  unless index = LEVELS.index(name)
102
105
  raise "#{name.inspect} is not a valid level"
103
106
  end
104
- index <= LEVELS.index(@level)
107
+ index <= LEVELS.index(current_level)
105
108
  end
106
109
 
107
110
  def output_stream=(symbol)
@@ -167,12 +170,13 @@ module Bundler
167
170
  end * "\n"
168
171
  end
169
172
 
170
- def with_level(level)
171
- original = @level
172
- @level = level
173
+ def with_level(desired_level)
174
+ old_level = level
175
+ Thread.current.thread_variable_set(@thread_safe_logger_key, desired_level)
176
+
173
177
  yield
174
178
  ensure
175
- @level = original
179
+ Thread.current.thread_variable_set(@thread_safe_logger_key, old_level)
176
180
  end
177
181
 
178
182
  def with_output_stream(symbol)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.0.beta1".freeze
4
+ VERSION = "4.0.0.beta2".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
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.0.beta1
4
+ version: 4.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko