bundler 2.3.0 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da1ab3c83c3a4866cc0407d08af4381e5cecfc146e1ca50fa00d078601ef7f64
4
- data.tar.gz: db6130a6580eec314b8b8c33e3b648ac2022293734dc7513c3de8ab0b508cf2c
3
+ metadata.gz: '07833d3c4b77a6566dce7964d5a9aa188967a39df2a81a78d145de9f27159019'
4
+ data.tar.gz: eb3e37e52c9ec73e4f59a63fca82d09b0469910a7f01f86ed734e4799926856c
5
5
  SHA512:
6
- metadata.gz: 7ba12ac5e1afd3073be1a7bc8e5d95e369b465c4025a69db0d05ab87bc673ccb70d4f031bc17b1390b0dbbb3833fdebca0691bce3f8b3c8730ec83b9df407d88
7
- data.tar.gz: 91dc119191fdbe40b5211e02a75349246e9f952d520cd58f3997b0e710a2caae0f17c96aaedf9ad25526ce44d38c9d67df9a6e5f7cc0e186b971033b412ad316
6
+ metadata.gz: 3c58cbd37d07fff2205a51f8157146d80eca0f155c1ec5d7396801bc5bc482767ec7e418e6549d7fed88904ab7fa9588b47f36b8bce8f2176dbe2062ffcd397b
7
+ data.tar.gz: '0118cc34cd853d7b51d116eb88d692b2637ab894a8029ee9d853ee2824705b55d6685ecfeaf51dd102fe8361afef0e606a581a511beaf91a92fef50403a56cec'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # 2.3.4 (December 29, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Improve error message when `BUNDLED WITH` version does not exist [#5205](https://github.com/rubygems/rubygems/pull/5205)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix `bundle update --bundler` no longer updating lockfile [#5224](https://github.com/rubygems/rubygems/pull/5224)
10
+
11
+ # 2.3.3 (December 24, 2021)
12
+
13
+ ## Bug fixes:
14
+
15
+ - Fix locked bundler not installed to the right path when `deployment` is set [#5217](https://github.com/rubygems/rubygems/pull/5217)
16
+
17
+ # 2.3.2 (December 23, 2021)
18
+
19
+ ## Enhancements:
20
+
21
+ - Remove unnecessary lockfile upgrade warning [#5209](https://github.com/rubygems/rubygems/pull/5209)
22
+
23
+ # 2.3.1 (December 22, 2021)
24
+
25
+ ## Enhancements:
26
+
27
+ - Vendor latest `thor` with fixes for latest `did_you_mean` deprecations [#5202](https://github.com/rubygems/rubygems/pull/5202)
28
+ - Avoid unnecessary `shellwords` require on newer rubygems [#5195](https://github.com/rubygems/rubygems/pull/5195)
29
+ - Re-exec prepending command with `Gem.ruby` if `$PROGRAM_NAME` is not executable [#5193](https://github.com/rubygems/rubygems/pull/5193)
30
+
1
31
  # 2.3.0 (December 21, 2021)
2
32
 
3
33
  ## Features:
@@ -0,0 +1 @@
1
+ # not in RDoc
@@ -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 = "2021-12-21".freeze
8
- @git_commit_sha = "e7167b9a42".freeze
7
+ @built_at = "2021-12-29".freeze
8
+ @git_commit_sha = "2296a0d6cc".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -165,9 +165,6 @@ module Bundler
165
165
 
166
166
  def normalize_settings
167
167
  Bundler.settings.set_command_option :path, nil if options[:system]
168
- Bundler.settings.temporary(:path_relative_to_cwd => false) do
169
- Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
170
- end
171
168
  Bundler.settings.set_command_option_if_given :path, options[:path]
172
169
  Bundler.settings.temporary(:path_relative_to_cwd => false) do
173
170
  Bundler.settings.set_command_option :path, "bundle" if options["standalone"] && Bundler.settings[:path].nil?
@@ -292,10 +292,7 @@ module Bundler
292
292
  locked_major = @locked_bundler_version.segments.first
293
293
  current_major = Gem::Version.create(Bundler::VERSION).segments.first
294
294
 
295
- if updating_major = locked_major < current_major
296
- Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
297
- "after which you will be unable to return to Bundler #{locked_major}."
298
- end
295
+ updating_major = locked_major < current_major
299
296
  end
300
297
 
301
298
  preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
@@ -103,7 +103,7 @@ module Bundler
103
103
 
104
104
  def self.system
105
105
  ruby_engine = RUBY_ENGINE.dup
106
- ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
106
+ ruby_version = RUBY_VERSION.dup
107
107
  ruby_engine_version = RUBY_ENGINE_VERSION.dup
108
108
  patchlevel = RUBY_PATCHLEVEL.to_s
109
109
 
@@ -67,7 +67,7 @@ module Bundler
67
67
  def build_extensions
68
68
  extension_cache_path = options[:bundler_extension_cache_path]
69
69
  unless extension_cache_path && extension_dir = spec.extension_dir
70
- require "shellwords" # compensate missing require in rubygems before version 3.2.25
70
+ require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
71
71
  return super
72
72
  end
73
73
 
@@ -15,10 +15,6 @@ module Bundler
15
15
  def install_locked_bundler_and_restart_with_it_if_needed
16
16
  return unless needs_switching?
17
17
 
18
- Bundler.ui.info \
19
- "Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
20
- "Installing Bundler #{lockfile_version} and restarting using that version."
21
-
22
18
  install_and_restart_with_locked_bundler
23
19
  end
24
20
 
@@ -26,8 +22,14 @@ module Bundler
26
22
 
27
23
  def install_and_restart_with_locked_bundler
28
24
  bundler_dep = Gem::Dependency.new("bundler", lockfile_version)
25
+ spec = fetch_spec_for(bundler_dep)
26
+ return if spec.nil?
27
+
28
+ Bundler.ui.info \
29
+ "Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
30
+ "Installing Bundler #{lockfile_version} and restarting using that version."
29
31
 
30
- Gem.install(bundler_dep)
32
+ spec.source.install(spec)
31
33
  rescue StandardError => e
32
34
  Bundler.ui.trace e
33
35
  Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
@@ -35,14 +37,28 @@ module Bundler
35
37
  restart_with_locked_bundler
36
38
  end
37
39
 
40
+ def fetch_spec_for(bundler_dep)
41
+ source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org")
42
+ source.remote!
43
+ source.add_dependency_names("bundler")
44
+ spec = source.specs.search(bundler_dep).first
45
+ if spec.nil?
46
+ Bundler.ui.warn "Your lockfile is locked to a version of bundler (#{lockfile_version}) that doesn't exist at https://rubygems.org/. Going on using #{current_version}"
47
+ end
48
+ spec
49
+ end
50
+
38
51
  def restart_with_locked_bundler
39
52
  configured_gem_home = ENV["GEM_HOME"]
40
53
  configured_gem_path = ENV["GEM_PATH"]
41
54
 
55
+ cmd = [$PROGRAM_NAME, *ARGV]
56
+ cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
57
+
42
58
  Bundler.with_original_env do
43
59
  Kernel.exec(
44
60
  { "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
45
- $PROGRAM_NAME, *ARGV
61
+ *cmd
46
62
  )
47
63
  end
48
64
  end
@@ -53,7 +69,12 @@ module Bundler
53
69
  SharedHelpers.in_bundle? &&
54
70
  lockfile_version &&
55
71
  !lockfile_version.end_with?(".dev") &&
56
- lockfile_version != current_version
72
+ lockfile_version != current_version &&
73
+ !updating?
74
+ end
75
+
76
+ def updating?
77
+ "update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
57
78
  end
58
79
 
59
80
  def installed?
@@ -219,6 +219,7 @@ module Bundler
219
219
  def path
220
220
  configs.each do |_level, settings|
221
221
  path = value_for("path", settings)
222
+ path = "vendor/bundle" if value_for("deployment", settings) && path.nil?
222
223
  path_system = value_for("path.system", settings)
223
224
  disabled_shared_gems = value_for("disable_shared_gems", settings)
224
225
  next if path.nil? && path_system.nil? && disabled_shared_gems.nil?
@@ -210,9 +210,9 @@ class Bundler::Thor
210
210
  #
211
211
  # ==== Examples
212
212
  #
213
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
213
+ # inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
214
214
  #
215
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController do
215
+ # inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
216
216
  # " filter_parameter :password\n"
217
217
  # end
218
218
  #
@@ -233,9 +233,9 @@ class Bundler::Thor
233
233
  #
234
234
  # ==== Examples
235
235
  #
236
- # inject_into_module "app/helpers/application_helper.rb", ApplicationHelper, " def help; 'help'; end\n"
236
+ # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
237
237
  #
238
- # inject_into_module "app/helpers/application_helper.rb", ApplicationHelper do
238
+ # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
239
239
  # " def help; 'help'; end\n"
240
240
  # end
241
241
  #
@@ -252,7 +252,7 @@ class Bundler::Thor
252
252
  # flag<Regexp|String>:: the regexp or string to be replaced
253
253
  # replacement<String>:: the replacement, can be also given as a block
254
254
  # config<Hash>:: give :verbose => false to not log the status, and
255
- # :force => true, to force the replacement regardless of runner behavior.
255
+ # :force => true, to force the replacement regardles of runner behavior.
256
256
  #
257
257
  # ==== Example
258
258
  #
@@ -331,7 +331,7 @@ class Bundler::Thor
331
331
  path = File.expand_path(path, destination_root)
332
332
 
333
333
  say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)
334
- if !options[:pretend] && File.exist?(path)
334
+ if !options[:pretend] && (File.exist?(path) || File.symlink?(path))
335
335
  require "fileutils"
336
336
  ::FileUtils.rm_rf(path)
337
337
  end
@@ -106,12 +106,14 @@ class Bundler::Thor
106
106
  # Adds the content to the file.
107
107
  #
108
108
  def replace!(regexp, string, force)
109
- return if pretend?
110
109
  content = File.read(destination)
111
- if force || !content.include?(replacement)
110
+ before, after = content.split(regexp, 2)
111
+ snippet = (behavior == :after ? after : before).to_s
112
+
113
+ if force || !snippet.include?(replacement)
112
114
  success = content.gsub!(regexp, string)
113
115
 
114
- File.open(destination, "wb") { |file| file.write(content) }
116
+ File.open(destination, "wb") { |file| file.write(content) } unless pretend?
115
117
  success
116
118
  end
117
119
  end
@@ -161,6 +161,8 @@ class Bundler::Thor
161
161
  # to the block you provide. The path is set back to the previous path when
162
162
  # the method exits.
163
163
  #
164
+ # Returns the value yielded by the block.
165
+ #
164
166
  # ==== Parameters
165
167
  # dir<String>:: the directory to move to.
166
168
  # config<Hash>:: give :verbose => true to log and use padding.
@@ -179,16 +181,18 @@ class Bundler::Thor
179
181
  FileUtils.mkdir_p(destination_root)
180
182
  end
181
183
 
184
+ result = nil
182
185
  if pretend
183
186
  # In pretend mode, just yield down to the block
184
- block.arity == 1 ? yield(destination_root) : yield
187
+ result = block.arity == 1 ? yield(destination_root) : yield
185
188
  else
186
189
  require "fileutils"
187
- FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield }
190
+ FileUtils.cd(destination_root) { result = block.arity == 1 ? yield(destination_root) : yield }
188
191
  end
189
192
 
190
193
  @destination_stack.pop
191
194
  shell.padding -= 1 if verbose
195
+ result
192
196
  end
193
197
 
194
198
  # Goes to the root and execute the given block.
@@ -28,6 +28,12 @@ class Bundler::Thor
28
28
  super(convert_key(key))
29
29
  end
30
30
 
31
+ def except(*keys)
32
+ dup.tap do |hash|
33
+ keys.each { |key| hash.delete(convert_key(key)) }
34
+ end
35
+ end
36
+
31
37
  def fetch(key, *args)
32
38
  super(convert_key(key), *args)
33
39
  end
@@ -102,9 +102,14 @@ class Bundler::Thor
102
102
  end
103
103
 
104
104
  if Correctable
105
- DidYouMean::SPELL_CHECKERS.merge!(
106
- 'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
107
- 'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
108
- )
105
+ if DidYouMean.respond_to?(:correct_error)
106
+ DidYouMean.correct_error(Bundler::Thor::UndefinedCommandError, UndefinedCommandError::SpellChecker)
107
+ DidYouMean.correct_error(Bundler::Thor::UnknownArgumentError, UnknownArgumentError::SpellChecker)
108
+ else
109
+ DidYouMean::SPELL_CHECKERS.merge!(
110
+ 'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
111
+ 'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
112
+ )
113
+ end
109
114
  end
110
115
  end
@@ -45,6 +45,7 @@ class Bundler::Thor
45
45
  @switches = {}
46
46
  @extra = []
47
47
  @stopped_parsing_after_extra_index = nil
48
+ @is_treated_as_value = false
48
49
 
49
50
  options.each do |option|
50
51
  @switches[option.switch_name] = option
@@ -74,8 +75,19 @@ class Bundler::Thor
74
75
  end
75
76
  end
76
77
 
78
+ def shift
79
+ @is_treated_as_value = false
80
+ super
81
+ end
82
+
83
+ def unshift(arg, is_value: false)
84
+ @is_treated_as_value = is_value
85
+ super(arg)
86
+ end
87
+
77
88
  def parse(args) # rubocop:disable MethodLength
78
89
  @pile = args.dup
90
+ @is_treated_as_value = false
79
91
  @parsing_options = true
80
92
 
81
93
  while peek
@@ -88,7 +100,10 @@ class Bundler::Thor
88
100
  when SHORT_SQ_RE
89
101
  unshift($1.split("").map { |f| "-#{f}" })
90
102
  next
91
- when EQ_RE, SHORT_NUM
103
+ when EQ_RE
104
+ unshift($2, is_value: true)
105
+ switch = $1
106
+ when SHORT_NUM
92
107
  unshift($2)
93
108
  switch = $1
94
109
  when LONG_RE, SHORT_RE
@@ -148,6 +163,7 @@ class Bundler::Thor
148
163
  # Two booleans are returned. The first is true if the current value
149
164
  # starts with a hyphen; the second is true if it is a registered switch.
150
165
  def current_is_switch?
166
+ return [false, false] if @is_treated_as_value
151
167
  case peek
152
168
  when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
153
169
  [true, switch?($1)]
@@ -159,6 +175,7 @@ class Bundler::Thor
159
175
  end
160
176
 
161
177
  def current_is_switch_formatted?
178
+ return false if @is_treated_as_value
162
179
  case peek
163
180
  when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE
164
181
  true
@@ -168,6 +185,7 @@ class Bundler::Thor
168
185
  end
169
186
 
170
187
  def current_is_value?
188
+ return true if @is_treated_as_value
171
189
  peek && (!parsing_options? || super)
172
190
  end
173
191
 
@@ -103,6 +103,23 @@ class Bundler::Thor
103
103
  stdout.flush
104
104
  end
105
105
 
106
+ # Say (print) an error to the user. If the sentence ends with a whitespace
107
+ # or tab character, a new line is not appended (print + flush). Otherwise
108
+ # are passed straight to puts (behavior got from Highline).
109
+ #
110
+ # ==== Example
111
+ # say_error("error: something went wrong")
112
+ #
113
+ def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
114
+ return if quiet?
115
+
116
+ buffer = prepare_message(message, *color)
117
+ buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
118
+
119
+ stderr.print(buffer)
120
+ stderr.flush
121
+ end
122
+
106
123
  # Say a status with the given color and appends the message. Since this
107
124
  # method is used frequently by actions, it allows nil or false to be given
108
125
  # in log_status, avoiding the message from being shown. If a Symbol is
@@ -111,13 +128,14 @@ class Bundler::Thor
111
128
  def say_status(status, message, log_status = true)
112
129
  return if quiet? || log_status == false
113
130
  spaces = " " * (padding + 1)
114
- color = log_status.is_a?(Symbol) ? log_status : :green
115
-
116
131
  status = status.to_s.rjust(12)
132
+ margin = " " * status.length + spaces
133
+
134
+ color = log_status.is_a?(Symbol) ? log_status : :green
117
135
  status = set_color status, color, true if color
118
136
 
119
- buffer = "#{status}#{spaces}#{message}"
120
- buffer = "#{buffer}\n" unless buffer.end_with?("\n")
137
+ message = message.to_s.chomp.gsub(/(?<!\A)^/, margin)
138
+ buffer = "#{status}#{spaces}#{message}\n"
121
139
 
122
140
  stdout.print(buffer)
123
141
  stdout.flush
@@ -21,7 +21,7 @@ class Bundler::Thor
21
21
  end
22
22
 
23
23
  module Shell
24
- SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
24
+ SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_error, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
25
25
  attr_writer :shell
26
26
 
27
27
  autoload :Basic, File.expand_path("shell/basic", __dir__)
@@ -211,7 +211,7 @@ class Bundler::Thor
211
211
  #
212
212
  def globs_for(path)
213
213
  path = escape_globs(path)
214
- ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"]
214
+ ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/**/*.thor"]
215
215
  end
216
216
 
217
217
  # Return the path to the ruby interpreter taking into account multiple
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.0".freeze
4
+ VERSION = "2.3.4".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
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: 2.3.0
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2021-12-21 00:00:00.000000000 Z
25
+ date: 2021-12-29 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -41,6 +41,7 @@ files:
41
41
  - exe/bundle
42
42
  - exe/bundler
43
43
  - lib/bundler.rb
44
+ - lib/bundler/.document
44
45
  - lib/bundler/build_metadata.rb
45
46
  - lib/bundler/capistrano.rb
46
47
  - lib/bundler/cli.rb
@@ -369,7 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
370
  - !ruby/object:Gem::Version
370
371
  version: 2.5.2
371
372
  requirements: []
372
- rubygems_version: 3.3.0
373
+ rubygems_version: 3.3.4
373
374
  signing_key:
374
375
  specification_version: 4
375
376
  summary: The best way to manage your application's dependencies