bundler 2.2.31 → 2.3.2

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +83 -0
  3. data/exe/bundle +7 -8
  4. data/lib/bundler/.document +1 -0
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli/doctor.rb +3 -2
  7. data/lib/bundler/cli/gem.rb +2 -1
  8. data/lib/bundler/cli/info.rb +6 -1
  9. data/lib/bundler/cli/install.rb +2 -0
  10. data/lib/bundler/cli/update.rb +2 -2
  11. data/lib/bundler/cli.rb +7 -1
  12. data/lib/bundler/compact_index_client/updater.rb +0 -5
  13. data/lib/bundler/definition.rb +61 -119
  14. data/lib/bundler/dependency.rb +5 -7
  15. data/lib/bundler/dsl.rb +18 -30
  16. data/lib/bundler/endpoint_specification.rb +0 -8
  17. data/lib/bundler/environment_preserver.rb +4 -1
  18. data/lib/bundler/fetcher/compact_index.rb +9 -4
  19. data/lib/bundler/fetcher.rb +2 -5
  20. data/lib/bundler/gem_helper.rb +2 -2
  21. data/lib/bundler/injector.rb +10 -1
  22. data/lib/bundler/installer/gem_installer.rb +1 -6
  23. data/lib/bundler/installer.rb +1 -4
  24. data/lib/bundler/lazy_specification.rb +17 -1
  25. data/lib/bundler/lockfile_parser.rb +10 -13
  26. data/lib/bundler/man/bundle-add.1 +10 -2
  27. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  28. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  29. data/lib/bundler/man/bundle-cache.1 +1 -1
  30. data/lib/bundler/man/bundle-check.1 +1 -1
  31. data/lib/bundler/man/bundle-clean.1 +1 -1
  32. data/lib/bundler/man/bundle-config.1 +3 -3
  33. data/lib/bundler/man/bundle-config.1.ronn +3 -3
  34. data/lib/bundler/man/bundle-doctor.1 +1 -1
  35. data/lib/bundler/man/bundle-exec.1 +1 -1
  36. data/lib/bundler/man/bundle-gem.1 +1 -1
  37. data/lib/bundler/man/bundle-info.1 +1 -1
  38. data/lib/bundler/man/bundle-init.1 +1 -1
  39. data/lib/bundler/man/bundle-inject.1 +1 -1
  40. data/lib/bundler/man/bundle-install.1 +2 -2
  41. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  42. data/lib/bundler/man/bundle-list.1 +1 -1
  43. data/lib/bundler/man/bundle-lock.1 +1 -1
  44. data/lib/bundler/man/bundle-open.1 +1 -1
  45. data/lib/bundler/man/bundle-outdated.1 +1 -1
  46. data/lib/bundler/man/bundle-platform.1 +1 -1
  47. data/lib/bundler/man/bundle-pristine.1 +1 -1
  48. data/lib/bundler/man/bundle-remove.1 +1 -1
  49. data/lib/bundler/man/bundle-show.1 +1 -1
  50. data/lib/bundler/man/bundle-update.1 +2 -2
  51. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  52. data/lib/bundler/man/bundle-viz.1 +1 -1
  53. data/lib/bundler/man/bundle.1 +1 -1
  54. data/lib/bundler/man/gemfile.5 +28 -2
  55. data/lib/bundler/man/gemfile.5.ronn +9 -1
  56. data/lib/bundler/plugin/api/source.rb +1 -0
  57. data/lib/bundler/plugin/installer.rb +1 -1
  58. data/lib/bundler/process_lock.rb +1 -1
  59. data/lib/bundler/psyched_yaml.rb +1 -13
  60. data/lib/bundler/resolver.rb +34 -31
  61. data/lib/bundler/rubygems_ext.rb +2 -0
  62. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  63. data/lib/bundler/rubygems_integration.rb +11 -48
  64. data/lib/bundler/self_manager.rb +76 -0
  65. data/lib/bundler/shared_helpers.rb +4 -12
  66. data/lib/bundler/source/git/git_proxy.rb +2 -2
  67. data/lib/bundler/source/metadata.rb +1 -1
  68. data/lib/bundler/source/rubygems.rb +16 -12
  69. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  70. data/lib/bundler/source.rb +1 -1
  71. data/lib/bundler/source_list.rb +7 -29
  72. data/lib/bundler/templates/Executable.bundler +1 -1
  73. data/lib/bundler/templates/Gemfile +0 -2
  74. data/lib/bundler/templates/gems.rb +0 -3
  75. data/lib/bundler/templates/newgem/Rakefile.tt +10 -1
  76. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
  77. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  78. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  79. data/lib/bundler/templates/newgem/standard.yml.tt +0 -2
  80. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  81. data/lib/bundler/ui/shell.rb +1 -1
  82. data/lib/bundler/vendor/.document +1 -0
  83. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  84. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +5 -3
  85. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  86. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  87. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  88. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  89. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  90. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  91. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  92. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  93. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  94. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  95. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  96. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  97. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  98. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  99. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  100. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  101. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  102. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  103. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  104. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  105. data/lib/bundler/version.rb +1 -1
  106. data/lib/bundler.rb +9 -3
  107. metadata +10 -5
  108. data/lib/bundler/gemdeps.rb +0 -29
@@ -98,7 +98,7 @@ module Bundler
98
98
  end
99
99
 
100
100
  def get(source)
101
- source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
101
+ source_list_for(source).find {|s| equivalent_source?(source, s) }
102
102
  end
103
103
 
104
104
  def lock_sources
@@ -106,14 +106,14 @@ module Bundler
106
106
  end
107
107
 
108
108
  def lock_other_sources
109
- (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
109
+ (path_sources + git_sources + plugin_sources).sort_by(&:identifier)
110
110
  end
111
111
 
112
112
  def lock_rubygems_sources
113
113
  if merged_gem_lockfile_sections?
114
114
  [combine_rubygems_sources]
115
115
  else
116
- rubygems_sources.sort_by(&:to_s)
116
+ rubygems_sources.sort_by(&:identifier)
117
117
  end
118
118
  end
119
119
 
@@ -173,7 +173,7 @@ module Bundler
173
173
  end
174
174
 
175
175
  def different_sources?(lock_sources, replacement_sources)
176
- !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
176
+ !equivalent_sources?(lock_sources, replacement_sources)
177
177
  end
178
178
 
179
179
  def rubygems_aggregate_class
@@ -210,34 +210,12 @@ module Bundler
210
210
  end
211
211
  end
212
212
 
213
- def equal_sources?(lock_sources, replacement_sources)
214
- lock_sources.sort_by(&:to_s) == replacement_sources.sort_by(&:to_s)
215
- end
216
-
217
- def equal_source?(source, other_source)
218
- return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems)
219
-
220
- source == other_source
221
- end
222
-
223
- def equivalent_source?(source, other_source)
224
- return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
225
-
226
- equivalent_rubygems_sources?([source], [other_source])
227
- end
228
-
229
213
  def equivalent_sources?(lock_sources, replacement_sources)
230
- return false unless Bundler.settings[:allow_deployment_source_credential_changes]
231
-
232
- lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
233
- replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
234
-
235
- equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources)
214
+ lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
236
215
  end
237
216
 
238
- def equivalent_rubygems_sources?(lock_sources, replacement_sources)
239
- actual_remotes = replacement_sources.map(&:remotes).flatten.uniq
240
- lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
217
+ def equivalent_source?(source, other_source)
218
+ source == other_source
241
219
  end
242
220
  end
243
221
  end
@@ -73,7 +73,7 @@ m = Module.new do
73
73
 
74
74
  requirement = bundler_gem_version.approximate_recommendation
75
75
 
76
- return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
76
+ return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
77
 
78
78
  requirement += ".a" if bundler_gem_version.prerelease?
79
79
 
@@ -2,6 +2,4 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
5
  # gem "rails"
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # A sample gems.rb
4
3
  source "https://rubygems.org"
5
4
 
6
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
-
8
5
  # gem "rails"
@@ -3,7 +3,16 @@
3
3
  require "bundler/gem_tasks"
4
4
  <% default_task_names = [config[:test_task]].compact -%>
5
5
  <% case config[:test] -%>
6
- <% when "minitest", "test-unit" -%>
6
+ <% when "minitest" -%>
7
+ require "rake/testtask"
8
+
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << "test"
11
+ t.libs << "lib"
12
+ t.test_files = FileList["test/**/test_*.rb"]
13
+ end
14
+
15
+ <% when "test-unit" -%>
7
16
  require "rake/testtask"
8
17
 
9
18
  Rake::TestTask.new(:test) do |t|
@@ -10,11 +10,11 @@ on:
10
10
  jobs:
11
11
  build:
12
12
  runs-on: ubuntu-latest
13
-
13
+ name: Ruby ${{ matrix.ruby }}
14
14
  strategy:
15
15
  matrix:
16
16
  ruby:
17
- - <%= RUBY_VERSION %>
17
+ - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -39,6 +39,6 @@ Gem::Specification.new do |spec|
39
39
  # Uncomment to register a new dependency of your gem
40
40
  # spec.add_dependency "example-gem", "~> 1.0"
41
41
 
42
- # For more information and examples about making a new gem, checkout our
42
+ # For more information and examples about making a new gem, check out our
43
43
  # guide at: https://bundler.io/guides/creating_gem.html
44
44
  end
@@ -0,0 +1,8 @@
1
+ <%- config[:constant_array].each_with_index do |c, i| -%>
2
+ <%= " " * i %>module <%= c %>
3
+ <%- end -%>
4
+ <%= " " * config[:constant_array].size %>VERSION: String
5
+ <%= " " * config[:constant_array].size %># See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+ <%- (config[:constant_array].size-1).downto(0) do |i| -%>
7
+ <%= " " * i %>end
8
+ <%- end -%>
@@ -1,4 +1,2 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
-
4
- default_ignores: false
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- class <%= config[:constant_name] %>Test < Minitest::Test
5
+ class Test<%= config[:constant_name] %> < Minitest::Test
6
6
  def test_that_it_has_a_version_number
7
7
  refute_nil ::<%= config[:constant_name] %>::VERSION
8
8
  end
@@ -81,7 +81,7 @@ module Bundler
81
81
  def trace(e, newline = nil, force = false)
82
82
  return unless debug? || force
83
83
  msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}"
84
- tell_me(msg, nil, newline)
84
+ tell_err(msg, nil, newline)
85
85
  end
86
86
 
87
87
  def silence(&blk)
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -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
@@ -3,7 +3,6 @@
3
3
  # = uri/common.rb
4
4
  #
5
5
  # Author:: Akira Yamada <akira@ruby-lang.org>
6
- # Revision:: $Id$
7
6
  # License::
8
7
  # You can redistribute it and/or modify it under the same term as Ruby.
9
8
  #
@@ -61,82 +60,6 @@ module Bundler::URI
61
60
  module_function :make_components_hash
62
61
  end
63
62
 
64
- # Module for escaping unsafe characters with codes.
65
- module Escape
66
- #
67
- # == Synopsis
68
- #
69
- # Bundler::URI.escape(str [, unsafe])
70
- #
71
- # == Args
72
- #
73
- # +str+::
74
- # String to replaces in.
75
- # +unsafe+::
76
- # Regexp that matches all symbols that must be replaced with codes.
77
- # By default uses <tt>UNSAFE</tt>.
78
- # When this argument is a String, it represents a character set.
79
- #
80
- # == Description
81
- #
82
- # Escapes the string, replacing all unsafe characters with codes.
83
- #
84
- # This method is obsolete and should not be used. Instead, use
85
- # CGI.escape, Bundler::URI.encode_www_form or Bundler::URI.encode_www_form_component
86
- # depending on your specific use case.
87
- #
88
- # == Usage
89
- #
90
- # require 'bundler/vendor/uri/lib/uri'
91
- #
92
- # enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
93
- # # => "http://example.com/?a=%09%0D"
94
- #
95
- # Bundler::URI.unescape(enc_uri)
96
- # # => "http://example.com/?a=\t\r"
97
- #
98
- # Bundler::URI.escape("@?@!", "!?")
99
- # # => "@%3F@%21"
100
- #
101
- def escape(*arg)
102
- warn "Bundler::URI.escape is obsolete", uplevel: 1
103
- DEFAULT_PARSER.escape(*arg)
104
- end
105
- alias encode escape
106
- #
107
- # == Synopsis
108
- #
109
- # Bundler::URI.unescape(str)
110
- #
111
- # == Args
112
- #
113
- # +str+::
114
- # String to unescape.
115
- #
116
- # == Description
117
- #
118
- # This method is obsolete and should not be used. Instead, use
119
- # CGI.unescape, Bundler::URI.decode_www_form or Bundler::URI.decode_www_form_component
120
- # depending on your specific use case.
121
- #
122
- # == Usage
123
- #
124
- # require 'bundler/vendor/uri/lib/uri'
125
- #
126
- # enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
127
- # # => "http://example.com/?a=%09%0D"
128
- #
129
- # Bundler::URI.unescape(enc_uri)
130
- # # => "http://example.com/?a=\t\r"
131
- #
132
- def unescape(*arg)
133
- warn "Bundler::URI.unescape is obsolete", uplevel: 1
134
- DEFAULT_PARSER.unescape(*arg)
135
- end
136
- alias decode unescape
137
- end # module Escape
138
-
139
- extend Escape
140
63
  include REGEXP
141
64
 
142
65
  @@schemes = {}
@@ -145,6 +68,20 @@ module Bundler::URI
145
68
  @@schemes
146
69
  end
147
70
 
71
+ #
72
+ # Construct a Bundler::URI instance, using the scheme to detect the appropriate class
73
+ # from +Bundler::URI.scheme_list+.
74
+ #
75
+ def self.for(scheme, *arguments, default: Generic)
76
+ if scheme
77
+ uri_class = @@schemes[scheme.upcase] || default
78
+ else
79
+ uri_class = default
80
+ end
81
+
82
+ return uri_class.new(scheme, *arguments)
83
+ end
84
+
148
85
  #
149
86
  # Base class for all Bundler::URI exceptions.
150
87
  #
@@ -315,7 +252,7 @@ module Bundler::URI
315
252
  #
316
253
  # Returns a Regexp object which matches to Bundler::URI-like strings.
317
254
  # The Regexp object returned by this method includes arbitrary
318
- # number of capture group (parentheses). Never rely on it's number.
255
+ # number of capture group (parentheses). Never rely on its number.
319
256
  #
320
257
  # == Usage
321
258
  #
@@ -362,7 +299,7 @@ module Bundler::URI
362
299
  # If +enc+ is given, convert +str+ to the encoding before percent encoding.
363
300
  #
364
301
  # This is an implementation of
365
- # http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
302
+ # https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
366
303
  #
367
304
  # See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
368
305
  def self.encode_www_form_component(str, enc=nil)
@@ -403,7 +340,7 @@ module Bundler::URI
403
340
  # This method doesn't handle files. When you send a file, use
404
341
  # multipart/form-data.
405
342
  #
406
- # This refers http://url.spec.whatwg.org/#concept-urlencoded-serializer
343
+ # This refers https://url.spec.whatwg.org/#concept-urlencoded-serializer
407
344
  #
408
345
  # Bundler::URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
409
346
  # #=> "q=ruby&lang=en"
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # Author:: Akira Yamada <akira@ruby-lang.org>
6
6
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
7
- # Revision:: $Id$
8
7
  #
9
8
  # See Bundler::URI for general documentation
10
9
  #
@@ -1098,7 +1097,7 @@ module Bundler::URI
1098
1097
  # # => "http://my.example.com/main.rbx?page=1"
1099
1098
  #
1100
1099
  def merge(oth)
1101
- rel = parser.send(:convert_to_uri, oth)
1100
+ rel = parser.__send__(:convert_to_uri, oth)
1102
1101
 
1103
1102
  if rel.absolute?
1104
1103
  #raise BadURIError, "both Bundler::URI are absolute" if absolute?
@@ -1183,7 +1182,7 @@ module Bundler::URI
1183
1182
 
1184
1183
  # :stopdoc:
1185
1184
  def route_from0(oth)
1186
- oth = parser.send(:convert_to_uri, oth)
1185
+ oth = parser.__send__(:convert_to_uri, oth)
1187
1186
  if self.relative?
1188
1187
  raise BadURIError,
1189
1188
  "relative Bundler::URI: #{self}"
@@ -1291,7 +1290,7 @@ module Bundler::URI
1291
1290
  # #=> #<Bundler::URI::Generic /main.rbx?page=1>
1292
1291
  #
1293
1292
  def route_to(oth)
1294
- parser.send(:convert_to_uri, oth).route_from(self)
1293
+ parser.__send__(:convert_to_uri, oth).route_from(self)
1295
1294
  end
1296
1295
 
1297
1296
  #
@@ -1405,7 +1404,7 @@ module Bundler::URI
1405
1404
  # Returns an Array of the components defined from the COMPONENT Array.
1406
1405
  def component_ary
1407
1406
  component.collect do |x|
1408
- self.send(x)
1407
+ self.__send__(x)
1409
1408
  end
1410
1409
  end
1411
1410
  protected :component_ary
@@ -1430,7 +1429,7 @@ module Bundler::URI
1430
1429
  def select(*components)
1431
1430
  components.collect do |c|
1432
1431
  if component.include?(c)
1433
- self.send(c)
1432
+ self.__send__(c)
1434
1433
  else
1435
1434
  raise ArgumentError,
1436
1435
  "expected of components of #{self.class} (#{self.class.component.join(', ')})"
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -7,7 +7,6 @@
7
7
  # License::
8
8
  # Bundler::URI::LDAP is copyrighted free software by Takaaki Tateishi and Akira Yamada.
9
9
  # You can redistribute it and/or modify it under the same term as Ruby.
10
- # Revision:: $Id$
11
10
  #
12
11
  # See Bundler::URI for general documentation
13
12
  #
@@ -119,6 +118,7 @@ module Bundler::URI
119
118
 
120
119
  # Private method to cleanup +dn+ from using the +path+ component attribute.
121
120
  def parse_dn
121
+ raise InvalidURIError, 'bad LDAP URL' unless @path
122
122
  @dn = @path[1..-1]
123
123
  end
124
124
  private :parse_dn