bundler 2.5.16 → 2.6.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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +194 -0
  3. data/bundler.gemspec +2 -2
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/add.rb +3 -1
  6. data/lib/bundler/cli/check.rb +3 -3
  7. data/lib/bundler/cli/console.rb +0 -4
  8. data/lib/bundler/cli/doctor.rb +4 -4
  9. data/lib/bundler/cli/exec.rb +1 -0
  10. data/lib/bundler/cli/gem.rb +6 -3
  11. data/lib/bundler/cli/info.rb +2 -2
  12. data/lib/bundler/cli/inject.rb +1 -1
  13. data/lib/bundler/cli/install.rb +13 -4
  14. data/lib/bundler/cli/lock.rb +25 -6
  15. data/lib/bundler/cli/outdated.rb +16 -18
  16. data/lib/bundler/cli/pristine.rb +1 -1
  17. data/lib/bundler/cli/show.rb +2 -2
  18. data/lib/bundler/cli.rb +38 -68
  19. data/lib/bundler/compact_index_client/cache_file.rb +0 -5
  20. data/lib/bundler/compact_index_client/updater.rb +0 -11
  21. data/lib/bundler/definition.rb +186 -119
  22. data/lib/bundler/dependency.rb +1 -1
  23. data/lib/bundler/dsl.rb +67 -52
  24. data/lib/bundler/endpoint_specification.rb +10 -1
  25. data/lib/bundler/errors.rb +17 -5
  26. data/lib/bundler/feature_flag.rb +1 -0
  27. data/lib/bundler/fetcher/compact_index.rb +1 -1
  28. data/lib/bundler/fetcher.rb +12 -5
  29. data/lib/bundler/force_platform.rb +0 -2
  30. data/lib/bundler/gem_helpers.rb +21 -5
  31. data/lib/bundler/injector.rb +2 -2
  32. data/lib/bundler/inline.rb +42 -17
  33. data/lib/bundler/installer/gem_installer.rb +4 -2
  34. data/lib/bundler/installer/parallel_installer.rb +3 -2
  35. data/lib/bundler/installer/standalone.rb +2 -2
  36. data/lib/bundler/installer.rb +11 -47
  37. data/lib/bundler/lazy_specification.rb +74 -26
  38. data/lib/bundler/lockfile_generator.rb +1 -1
  39. data/lib/bundler/lockfile_parser.rb +10 -2
  40. data/lib/bundler/man/bundle-add.1 +42 -25
  41. data/lib/bundler/man/bundle-add.1.ronn +52 -23
  42. data/lib/bundler/man/bundle-binstubs.1 +7 -4
  43. data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  44. data/lib/bundler/man/bundle-cache.1 +30 -2
  45. data/lib/bundler/man/bundle-cache.1.ronn +31 -2
  46. data/lib/bundler/man/bundle-check.1 +3 -3
  47. data/lib/bundler/man/bundle-check.1.ronn +4 -2
  48. data/lib/bundler/man/bundle-clean.1 +1 -1
  49. data/lib/bundler/man/bundle-config.1 +3 -5
  50. data/lib/bundler/man/bundle-config.1.ronn +2 -7
  51. data/lib/bundler/man/bundle-console.1 +2 -4
  52. data/lib/bundler/man/bundle-console.1.ronn +2 -7
  53. data/lib/bundler/man/bundle-doctor.1 +2 -2
  54. data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  55. data/lib/bundler/man/bundle-env.1 +9 -0
  56. data/lib/bundler/man/bundle-env.1.ronn +10 -0
  57. data/lib/bundler/man/bundle-exec.1 +5 -2
  58. data/lib/bundler/man/bundle-exec.1.ronn +4 -1
  59. data/lib/bundler/man/bundle-fund.1 +22 -0
  60. data/lib/bundler/man/bundle-fund.1.ronn +25 -0
  61. data/lib/bundler/man/bundle-gem.1 +17 -5
  62. data/lib/bundler/man/bundle-gem.1.ronn +27 -6
  63. data/lib/bundler/man/bundle-help.1 +1 -1
  64. data/lib/bundler/man/bundle-info.1 +5 -2
  65. data/lib/bundler/man/bundle-info.1.ronn +6 -2
  66. data/lib/bundler/man/bundle-init.1 +3 -3
  67. data/lib/bundler/man/bundle-init.1.ronn +3 -2
  68. data/lib/bundler/man/bundle-inject.1 +10 -2
  69. data/lib/bundler/man/bundle-inject.1.ronn +9 -1
  70. data/lib/bundler/man/bundle-install.1 +15 -12
  71. data/lib/bundler/man/bundle-install.1.ronn +22 -18
  72. data/lib/bundler/man/bundle-issue.1 +45 -0
  73. data/lib/bundler/man/bundle-issue.1.ronn +37 -0
  74. data/lib/bundler/man/bundle-licenses.1 +9 -0
  75. data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  76. data/lib/bundler/man/bundle-list.1 +1 -1
  77. data/lib/bundler/man/bundle-list.1.ronn +4 -1
  78. data/lib/bundler/man/bundle-lock.1 +21 -6
  79. data/lib/bundler/man/bundle-lock.1.ronn +25 -4
  80. data/lib/bundler/man/bundle-open.1 +2 -2
  81. data/lib/bundler/man/bundle-open.1.ronn +2 -1
  82. data/lib/bundler/man/bundle-outdated.1 +8 -5
  83. data/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  84. data/lib/bundler/man/bundle-platform.1 +1 -1
  85. data/lib/bundler/man/bundle-plugin.1 +1 -1
  86. data/lib/bundler/man/bundle-pristine.1 +1 -1
  87. data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  88. data/lib/bundler/man/bundle-remove.1 +1 -1
  89. data/lib/bundler/man/bundle-remove.1.ronn +1 -1
  90. data/lib/bundler/man/bundle-show.1 +5 -2
  91. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  92. data/lib/bundler/man/bundle-update.1 +13 -7
  93. data/lib/bundler/man/bundle-update.1.ronn +14 -6
  94. data/lib/bundler/man/bundle-version.1 +1 -1
  95. data/lib/bundler/man/bundle-viz.1 +4 -4
  96. data/lib/bundler/man/bundle-viz.1.ronn +7 -3
  97. data/lib/bundler/man/bundle.1 +1 -1
  98. data/lib/bundler/man/gemfile.5 +3 -1
  99. data/lib/bundler/man/gemfile.5.ronn +6 -0
  100. data/lib/bundler/man/index.txt +4 -0
  101. data/lib/bundler/materialization.rb +59 -0
  102. data/lib/bundler/plugin/api/source.rb +2 -1
  103. data/lib/bundler/plugin/events.rb +24 -0
  104. data/lib/bundler/plugin/installer.rb +1 -1
  105. data/lib/bundler/plugin.rb +20 -1
  106. data/lib/bundler/process_lock.rb +10 -14
  107. data/lib/bundler/remote_specification.rb +6 -1
  108. data/lib/bundler/resolver/base.rb +12 -6
  109. data/lib/bundler/resolver/candidate.rb +2 -2
  110. data/lib/bundler/resolver/package.rb +10 -1
  111. data/lib/bundler/resolver/spec_group.rb +4 -3
  112. data/lib/bundler/resolver.rb +36 -14
  113. data/lib/bundler/retry.rb +1 -1
  114. data/lib/bundler/ruby_version.rb +7 -1
  115. data/lib/bundler/rubygems_ext.rb +104 -51
  116. data/lib/bundler/rubygems_gem_installer.rb +7 -5
  117. data/lib/bundler/rubygems_integration.rb +23 -62
  118. data/lib/bundler/runtime.rb +22 -7
  119. data/lib/bundler/self_manager.rb +7 -7
  120. data/lib/bundler/settings.rb +6 -1
  121. data/lib/bundler/shared_helpers.rb +29 -17
  122. data/lib/bundler/source/git/git_proxy.rb +0 -2
  123. data/lib/bundler/source/git.rb +93 -40
  124. data/lib/bundler/source/metadata.rb +2 -3
  125. data/lib/bundler/source/path.rb +5 -3
  126. data/lib/bundler/source/rubygems.rb +6 -16
  127. data/lib/bundler/source_list.rb +1 -1
  128. data/lib/bundler/spec_set.rb +82 -57
  129. data/lib/bundler/stub_specification.rb +21 -2
  130. data/lib/bundler/templates/newgem/Gemfile.tt +0 -3
  131. data/lib/bundler/templates/newgem/README.md.tt +7 -3
  132. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  133. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
  134. data/lib/bundler/ui/shell.rb +24 -2
  135. data/lib/bundler/ui/silent.rb +12 -1
  136. data/lib/bundler/uri_credentials_filter.rb +1 -1
  137. data/lib/bundler/vendor/fileutils/COPYING +56 -0
  138. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  139. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +46 -8
  140. data/lib/bundler/vendor/securerandom/.document +1 -0
  141. data/lib/bundler/vendor/securerandom/COPYING +56 -0
  142. data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  143. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  144. data/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  145. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  146. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  147. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  148. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  149. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  150. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  151. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  152. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  153. data/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  154. data/lib/bundler/vendor/uri/COPYING +56 -0
  155. data/lib/bundler/vendor/uri/lib/uri/common.rb +37 -14
  156. data/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  157. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  158. data/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
  159. data/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  160. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  161. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  162. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  163. data/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  164. data/lib/bundler/vendored_securerandom.rb +12 -0
  165. data/lib/bundler/version.rb +1 -1
  166. data/lib/bundler/yaml_serializer.rb +1 -1
  167. data/lib/bundler.rb +68 -36
  168. metadata +20 -10
  169. data/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
  170. data/lib/bundler/vendor/uri/LICENSE.txt +0 -22
@@ -17,21 +17,21 @@ jobs:
17
17
  - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v4
21
21
  <%- if config[:ext] == 'rust' -%>
22
- - name: Set up Ruby & Rust
23
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
- with:
25
- ruby-version: ${{ matrix.ruby }}
26
- bundler-cache: true
27
- cargo-cache: true
28
- rubygems: '<%= ::Gem.rubygems_version %>'
22
+ - name: Set up Ruby & Rust
23
+ uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ cargo-cache: true
28
+ rubygems: '<%= ::Gem.rubygems_version %>'
29
29
  <%- else -%>
30
- - name: Set up Ruby
31
- uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- bundler-cache: true
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
35
  <%- end -%>
36
- - name: Run the default task
37
- run: bundle exec rake
36
+ - name: Run the default task
37
+ run: bundle exec rake
@@ -37,15 +37,15 @@ Gem::Specification.new do |spec|
37
37
  spec.bindir = "exe"
38
38
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
39
39
  spec.require_paths = ["lib"]
40
- <%- if config[:ext] == 'c' -%>
40
+ <%- if config[:ext] == 'c' || config[:ext] == 'rust' -%>
41
41
  spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
42
42
  <%- end -%>
43
- <%- if config[:ext] == 'rust' -%>
44
- spec.extensions = ["ext/<%= config[:underscored_name] %>/Cargo.toml"]
45
- <%- end -%>
46
43
 
47
44
  # Uncomment to register a new dependency of your gem
48
45
  # spec.add_dependency "example-gem", "~> 1.0"
46
+ <%- if config[:ext] == 'rust' -%>
47
+ spec.add_dependency "rb_sys", "~> 0.9.91"
48
+ <%- end -%>
49
49
 
50
50
  # For more information and examples about making a new gem, check out our
51
51
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -6,14 +6,17 @@ module Bundler
6
6
  module UI
7
7
  class Shell
8
8
  LEVELS = %w[silent error warn confirm info debug].freeze
9
+ OUTPUT_STREAMS = [:stdout, :stderr].freeze
9
10
 
10
11
  attr_writer :shell
12
+ attr_reader :output_stream
11
13
 
12
14
  def initialize(options = {})
13
15
  Thor::Base.shell = options["no-color"] ? Thor::Shell::Basic : nil
14
16
  @shell = Thor::Base.shell.new
15
17
  @level = ENV["DEBUG"] ? "debug" : "info"
16
18
  @warning_history = []
19
+ @output_stream = :stdout
17
20
  end
18
21
 
19
22
  def add_color(string, *color)
@@ -84,7 +87,7 @@ module Bundler
84
87
  @shell.yes?(msg)
85
88
  end
86
89
 
87
- def no?
90
+ def no?(msg)
88
91
  @shell.no?(msg)
89
92
  end
90
93
 
@@ -101,6 +104,11 @@ module Bundler
101
104
  index <= LEVELS.index(@level)
102
105
  end
103
106
 
107
+ def output_stream=(symbol)
108
+ raise ArgumentError unless OUTPUT_STREAMS.include?(symbol)
109
+ @output_stream = symbol
110
+ end
111
+
104
112
  def trace(e, newline = nil, force = false)
105
113
  return unless debug? || force
106
114
  msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}"
@@ -111,6 +119,10 @@ module Bundler
111
119
  with_level("silent", &blk)
112
120
  end
113
121
 
122
+ def progress(&blk)
123
+ with_output_stream(:stderr, &blk)
124
+ end
125
+
114
126
  def unprinted_warnings
115
127
  []
116
128
  end
@@ -119,6 +131,8 @@ module Bundler
119
131
 
120
132
  # valimism
121
133
  def tell_me(msg, color = nil, newline = nil)
134
+ return tell_err(msg, color, newline) if output_stream == :stderr
135
+
122
136
  msg = word_wrap(msg) if newline.is_a?(Hash) && newline[:wrap]
123
137
  if newline.nil?
124
138
  @shell.say(msg, color)
@@ -130,7 +144,7 @@ module Bundler
130
144
  def tell_err(message, color = nil, newline = nil)
131
145
  return if @shell.send(:stderr).closed?
132
146
 
133
- newline ||= !message.to_s.match?(/( |\t)\Z/)
147
+ newline = !message.to_s.match?(/( |\t)\Z/) if newline.nil?
134
148
  message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
135
149
 
136
150
  color = nil if color && !$stderr.tty?
@@ -160,6 +174,14 @@ module Bundler
160
174
  ensure
161
175
  @level = original
162
176
  end
177
+
178
+ def with_output_stream(symbol)
179
+ original = output_stream
180
+ self.output_stream = symbol
181
+ yield
182
+ ensure
183
+ @output_stream = original
184
+ end
163
185
  end
164
186
  end
165
187
  end
@@ -53,6 +53,13 @@ module Bundler
53
53
  false
54
54
  end
55
55
 
56
+ def output_stream=(_symbol)
57
+ end
58
+
59
+ def output_stream
60
+ nil
61
+ end
62
+
56
63
  def ask(message)
57
64
  end
58
65
 
@@ -60,7 +67,7 @@ module Bundler
60
67
  raise "Cannot ask yes? with a silent shell"
61
68
  end
62
69
 
63
- def no?
70
+ def no?(msg)
64
71
  raise "Cannot ask no? with a silent shell"
65
72
  end
66
73
 
@@ -77,6 +84,10 @@ module Bundler
77
84
  yield
78
85
  end
79
86
 
87
+ def progress
88
+ yield
89
+ end
90
+
80
91
  def unprinted_warnings
81
92
  @warnings
82
93
  end
@@ -16,7 +16,7 @@ module Bundler
16
16
 
17
17
  if uri.userinfo
18
18
  # oauth authentication
19
- if uri.password == "x-oauth-basic" || uri.password == "x"
19
+ if uri.password == "x-oauth-basic" || uri.password == "x" || uri.password.nil?
20
20
  # URI as string does not display with password if no user is set
21
21
  oauth_designation = uri.password
22
22
  uri.user = oauth_designation
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -180,7 +180,8 @@ end
180
180
  # - {CVE-2004-0452}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452].
181
181
  #
182
182
  module Bundler::FileUtils
183
- VERSION = "1.7.2"
183
+ # The version number.
184
+ VERSION = "1.7.3"
184
185
 
185
186
  def self.private_module_function(name) #:nodoc:
186
187
  module_function name
@@ -1651,7 +1652,7 @@ module Bundler::FileUtils
1651
1652
  when "a"
1652
1653
  mask | 07777
1653
1654
  else
1654
- raise ArgumentError, "invalid `who' symbol in file mode: #{chr}"
1655
+ raise ArgumentError, "invalid 'who' symbol in file mode: #{chr}"
1655
1656
  end
1656
1657
  end
1657
1658
  end
@@ -1705,7 +1706,7 @@ module Bundler::FileUtils
1705
1706
  copy_mask = user_mask(chr)
1706
1707
  (current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
1707
1708
  else
1708
- raise ArgumentError, "invalid `perm' symbol in file mode: #{chr}"
1709
+ raise ArgumentError, "invalid 'perm' symbol in file mode: #{chr}"
1709
1710
  end
1710
1711
  end
1711
1712
 
@@ -2028,21 +2029,22 @@ module Bundler::FileUtils
2028
2029
 
2029
2030
  private
2030
2031
 
2031
- module StreamUtils_
2032
+ module StreamUtils_ # :nodoc:
2033
+
2032
2034
  private
2033
2035
 
2034
2036
  case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
2035
2037
  when /mswin|mingw/
2036
- def fu_windows?; true end
2038
+ def fu_windows?; true end #:nodoc:
2037
2039
  else
2038
- def fu_windows?; false end
2040
+ def fu_windows?; false end #:nodoc:
2039
2041
  end
2040
2042
 
2041
2043
  def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
2042
2044
  IO.copy_stream(src, dest)
2043
2045
  end
2044
2046
 
2045
- def fu_stream_blksize(*streams)
2047
+ def fu_stream_blksize(*streams) #:nodoc:
2046
2048
  streams.each do |s|
2047
2049
  next unless s.respond_to?(:stat)
2048
2050
  size = fu_blksize(s.stat)
@@ -2051,14 +2053,14 @@ module Bundler::FileUtils
2051
2053
  fu_default_blksize()
2052
2054
  end
2053
2055
 
2054
- def fu_blksize(st)
2056
+ def fu_blksize(st) #:nodoc:
2055
2057
  s = st.blksize
2056
2058
  return nil unless s
2057
2059
  return nil if s == 0
2058
2060
  s
2059
2061
  end
2060
2062
 
2061
- def fu_default_blksize
2063
+ def fu_default_blksize #:nodoc:
2062
2064
  1024
2063
2065
  end
2064
2066
  end
@@ -2503,7 +2505,7 @@ module Bundler::FileUtils
2503
2505
  end
2504
2506
  private_module_function :fu_output_message
2505
2507
 
2506
- def fu_split_path(path)
2508
+ def fu_split_path(path) #:nodoc:
2507
2509
  path = File.path(path)
2508
2510
  list = []
2509
2511
  until (parent, base = File.split(path); parent == path or parent == ".")
@@ -2524,7 +2526,7 @@ module Bundler::FileUtils
2524
2526
  end
2525
2527
  private_module_function :fu_relative_components_from
2526
2528
 
2527
- def fu_clean_components(*comp)
2529
+ def fu_clean_components(*comp) #:nodoc:
2528
2530
  comp.shift while comp.first == "."
2529
2531
  return comp if comp.empty?
2530
2532
  clean = [comp.shift]
@@ -2543,11 +2545,11 @@ module Bundler::FileUtils
2543
2545
  private_module_function :fu_clean_components
2544
2546
 
2545
2547
  if fu_windows?
2546
- def fu_starting_path?(path)
2548
+ def fu_starting_path?(path) #:nodoc:
2547
2549
  path&.start_with?(%r(\w:|/))
2548
2550
  end
2549
2551
  else
2550
- def fu_starting_path?(path)
2552
+ def fu_starting_path?(path) #:nodoc:
2551
2553
  path&.start_with?("/")
2552
2554
  end
2553
2555
  end
@@ -68,6 +68,8 @@ autoload :OpenSSL, 'openssl'
68
68
  # #verify_callback :: For server certificate verification
69
69
  # #verify_depth :: Depth of certificate verification
70
70
  # #verify_mode :: How connections should be verified
71
+ # #verify_hostname :: Use hostname verification for server certificate
72
+ # during the handshake
71
73
  #
72
74
  # == Proxies
73
75
  #
@@ -174,7 +176,7 @@ class Gem::Net::HTTP::Persistent
174
176
  ##
175
177
  # The version of Gem::Net::HTTP::Persistent you are using
176
178
 
177
- VERSION = '4.0.2'
179
+ VERSION = '4.0.4'
178
180
 
179
181
  ##
180
182
  # Error class for errors raised by Gem::Net::HTTP::Persistent. Various
@@ -449,6 +451,21 @@ class Gem::Net::HTTP::Persistent
449
451
 
450
452
  attr_reader :verify_mode
451
453
 
454
+ ##
455
+ # HTTPS verify_hostname.
456
+ #
457
+ # If a client sets this to true and enables SNI with SSLSocket#hostname=,
458
+ # the hostname verification on the server certificate is performed
459
+ # automatically during the handshake using
460
+ # OpenSSL::SSL.verify_certificate_identity().
461
+ #
462
+ # You can set +verify_hostname+ as true to use hostname verification
463
+ # during the handshake.
464
+ #
465
+ # NOTE: This works with Ruby > 3.0.
466
+
467
+ attr_reader :verify_hostname
468
+
452
469
  ##
453
470
  # Creates a new Gem::Net::HTTP::Persistent.
454
471
  #
@@ -508,6 +525,7 @@ class Gem::Net::HTTP::Persistent
508
525
  @verify_callback = nil
509
526
  @verify_depth = nil
510
527
  @verify_mode = nil
528
+ @verify_hostname = nil
511
529
  @cert_store = nil
512
530
 
513
531
  @generation = 0 # incremented when proxy Gem::URI changes
@@ -607,13 +625,23 @@ class Gem::Net::HTTP::Persistent
607
625
 
608
626
  return yield connection
609
627
  rescue Errno::ECONNREFUSED
610
- address = http.proxy_address || http.address
611
- port = http.proxy_port || http.port
628
+ if http.proxy?
629
+ address = http.proxy_address
630
+ port = http.proxy_port
631
+ else
632
+ address = http.address
633
+ port = http.port
634
+ end
612
635
 
613
636
  raise Error, "connection refused: #{address}:#{port}"
614
637
  rescue Errno::EHOSTDOWN
615
- address = http.proxy_address || http.address
616
- port = http.proxy_port || http.port
638
+ if http.proxy?
639
+ address = http.proxy_address
640
+ port = http.proxy_port
641
+ else
642
+ address = http.address
643
+ port = http.port
644
+ end
617
645
 
618
646
  raise Error, "host down: #{address}:#{port}"
619
647
  ensure
@@ -948,8 +976,10 @@ class Gem::Net::HTTP::Persistent
948
976
  connection.min_version = @min_version if @min_version
949
977
  connection.max_version = @max_version if @max_version
950
978
 
951
- connection.verify_depth = @verify_depth
952
- connection.verify_mode = @verify_mode
979
+ connection.verify_depth = @verify_depth
980
+ connection.verify_mode = @verify_mode
981
+ connection.verify_hostname = @verify_hostname if
982
+ @verify_hostname != nil && connection.respond_to?(:verify_hostname=)
953
983
 
954
984
  if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and
955
985
  not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
@@ -1058,6 +1088,15 @@ application:
1058
1088
  reconnect_ssl
1059
1089
  end
1060
1090
 
1091
+ ##
1092
+ # Sets the HTTPS verify_hostname.
1093
+
1094
+ def verify_hostname= verify_hostname
1095
+ @verify_hostname = verify_hostname
1096
+
1097
+ reconnect_ssl
1098
+ end
1099
+
1061
1100
  ##
1062
1101
  # SSL verification callback.
1063
1102
 
@@ -1070,4 +1109,3 @@ end
1070
1109
 
1071
1110
  require_relative 'persistent/connection'
1072
1111
  require_relative 'persistent/pool'
1073
-
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -0,0 +1,102 @@
1
+ # -*- coding: us-ascii -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'random/formatter'
5
+
6
+ # == Secure random number generator interface.
7
+ #
8
+ # This library is an interface to secure random number generators which are
9
+ # suitable for generating session keys in HTTP cookies, etc.
10
+ #
11
+ # You can use this library in your application by requiring it:
12
+ #
13
+ # require 'bundler/vendor/securerandom/lib/securerandom'
14
+ #
15
+ # It supports the following secure random number generators:
16
+ #
17
+ # * openssl
18
+ # * /dev/urandom
19
+ # * Win32
20
+ #
21
+ # Bundler::SecureRandom is extended by the Random::Formatter module which
22
+ # defines the following methods:
23
+ #
24
+ # * alphanumeric
25
+ # * base64
26
+ # * choose
27
+ # * gen_random
28
+ # * hex
29
+ # * rand
30
+ # * random_bytes
31
+ # * random_number
32
+ # * urlsafe_base64
33
+ # * uuid
34
+ #
35
+ # These methods are usable as class methods of Bundler::SecureRandom such as
36
+ # +Bundler::SecureRandom.hex+.
37
+ #
38
+ # If a secure random number generator is not available,
39
+ # +NotImplementedError+ is raised.
40
+
41
+ module Bundler::SecureRandom
42
+
43
+ # The version
44
+ VERSION = "0.4.1"
45
+
46
+ class << self
47
+ # Returns a random binary string containing +size+ bytes.
48
+ #
49
+ # See Random.bytes
50
+ def bytes(n)
51
+ return gen_random(n)
52
+ end
53
+
54
+ # Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2
55
+ def alphanumeric(n = nil, chars: ALPHANUMERIC)
56
+ n = 16 if n.nil?
57
+ choose(chars, n)
58
+ end if RUBY_VERSION < '3.3'
59
+
60
+ private
61
+
62
+ # :stopdoc:
63
+
64
+ # Implementation using OpenSSL
65
+ def gen_random_openssl(n)
66
+ return OpenSSL::Random.random_bytes(n)
67
+ end
68
+
69
+ # Implementation using system random device
70
+ def gen_random_urandom(n)
71
+ ret = Random.urandom(n)
72
+ unless ret
73
+ raise NotImplementedError, "No random device"
74
+ end
75
+ unless ret.length == n
76
+ raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
77
+ end
78
+ ret
79
+ end
80
+
81
+ begin
82
+ # Check if Random.urandom is available
83
+ Random.urandom(1)
84
+ alias gen_random gen_random_urandom
85
+ rescue RuntimeError
86
+ begin
87
+ require 'openssl'
88
+ rescue NoMethodError
89
+ raise NotImplementedError, "No random device"
90
+ else
91
+ alias gen_random gen_random_openssl
92
+ end
93
+ end
94
+
95
+ # :startdoc:
96
+
97
+ # Generate random data bytes for Random::Formatter
98
+ public :gen_random
99
+ end
100
+ end
101
+
102
+ Bundler::SecureRandom.extend(Random::Formatter)
@@ -10,7 +10,6 @@ class Bundler::Thor
10
10
  # destination<String>:: the relative path to the destination root.
11
11
  # config<Hash>:: give :verbose => false to not log the status, and
12
12
  # :mode => :preserve, to preserve the file mode from the source.
13
-
14
13
  #
15
14
  # ==== Examples
16
15
  #
@@ -275,9 +274,8 @@ class Bundler::Thor
275
274
  end
276
275
  end
277
276
 
278
- # Uncomment all lines matching a given regex. It will leave the space
279
- # which existed before the comment hash in tact but will remove any spacing
280
- # between the comment hash and the beginning of the line.
277
+ # Uncomment all lines matching a given regex. Preserves indentation before
278
+ # the comment hash and removes the hash and any immediate following space.
281
279
  #
282
280
  # ==== Parameters
283
281
  # path<String>:: path of the file to be changed
@@ -291,7 +289,7 @@ class Bundler::Thor
291
289
  def uncomment_lines(path, flag, *args)
292
290
  flag = flag.respond_to?(:source) ? flag.source : flag
293
291
 
294
- gsub_file(path, /^(\s*)#[[:blank:]]*(.*#{flag})/, '\1\2', *args)
292
+ gsub_file(path, /^(\s*)#[[:blank:]]?(.*#{flag})/, '\1\2', *args)
295
293
  end
296
294
 
297
295
  # Comment all lines matching a given regex. It will leave the space
@@ -211,6 +211,17 @@ class Bundler::Thor::Group
211
211
  raise error, msg
212
212
  end
213
213
 
214
+ # Checks if a specified command exists.
215
+ #
216
+ # ==== Parameters
217
+ # command_name<String>:: The name of the command to check for existence.
218
+ #
219
+ # ==== Returns
220
+ # Boolean:: +true+ if the command exists, +false+ otherwise.
221
+ def command_exists?(command_name) #:nodoc:
222
+ commands.keys.include?(command_name)
223
+ end
224
+
214
225
  protected
215
226
 
216
227
  # The method responsible for dispatching given the args.
@@ -26,10 +26,7 @@ class Bundler::Thor
26
26
 
27
27
  def print_default
28
28
  if @type == :array and @default.is_a?(Array)
29
- @default.map { |x|
30
- p = x.gsub('"','\\"')
31
- "\"#{p}\""
32
- }.join(" ")
29
+ @default.map(&:dump).join(" ")
33
30
  else
34
31
  @default
35
32
  end
@@ -89,8 +89,8 @@ class Bundler::Thor
89
89
 
90
90
  sample = "[#{sample}]".dup unless required?
91
91
 
92
- if boolean?
93
- sample << ", [#{dasherize('no-' + human_name)}]" unless (name == "force") || name.match(/\Ano[\-_]/)
92
+ if boolean? && name != "force" && !name.match(/\A(no|skip)[\-_]/)
93
+ sample << ", [#{dasherize('no-' + human_name)}], [#{dasherize('skip-' + human_name)}]"
94
94
  end
95
95
 
96
96
  aliases_for_usage.ljust(padding) + sample