bundler 2.5.22 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +83 -0
  3. data/bundler.gemspec +2 -2
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/add.rb +2 -0
  6. data/lib/bundler/cli/check.rb +2 -2
  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 +1 -1
  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 +4 -0
  14. data/lib/bundler/cli/lock.rb +20 -1
  15. data/lib/bundler/cli/pristine.rb +1 -1
  16. data/lib/bundler/cli/show.rb +2 -2
  17. data/lib/bundler/cli.rb +23 -53
  18. data/lib/bundler/compact_index_client/cache_file.rb +0 -5
  19. data/lib/bundler/compact_index_client/updater.rb +0 -11
  20. data/lib/bundler/definition.rb +143 -76
  21. data/lib/bundler/dependency.rb +1 -1
  22. data/lib/bundler/dsl.rb +33 -28
  23. data/lib/bundler/endpoint_specification.rb +10 -1
  24. data/lib/bundler/errors.rb +10 -0
  25. data/lib/bundler/feature_flag.rb +1 -0
  26. data/lib/bundler/fetcher/compact_index.rb +1 -1
  27. data/lib/bundler/fetcher.rb +10 -3
  28. data/lib/bundler/gem_helpers.rb +21 -5
  29. data/lib/bundler/injector.rb +2 -2
  30. data/lib/bundler/inline.rb +12 -8
  31. data/lib/bundler/installer/standalone.rb +2 -2
  32. data/lib/bundler/installer.rb +4 -38
  33. data/lib/bundler/lazy_specification.rb +74 -26
  34. data/lib/bundler/lockfile_generator.rb +1 -1
  35. data/lib/bundler/lockfile_parser.rb +9 -1
  36. data/lib/bundler/man/bundle-add.1 +17 -11
  37. data/lib/bundler/man/bundle-add.1.ronn +16 -10
  38. data/lib/bundler/man/bundle-binstubs.1 +7 -4
  39. data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  40. data/lib/bundler/man/bundle-cache.1 +30 -2
  41. data/lib/bundler/man/bundle-cache.1.ronn +31 -2
  42. data/lib/bundler/man/bundle-check.1 +3 -3
  43. data/lib/bundler/man/bundle-check.1.ronn +4 -2
  44. data/lib/bundler/man/bundle-clean.1 +1 -1
  45. data/lib/bundler/man/bundle-config.1 +3 -5
  46. data/lib/bundler/man/bundle-config.1.ronn +2 -7
  47. data/lib/bundler/man/bundle-console.1 +2 -4
  48. data/lib/bundler/man/bundle-console.1.ronn +2 -7
  49. data/lib/bundler/man/bundle-doctor.1 +2 -2
  50. data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  51. data/lib/bundler/man/bundle-env.1 +9 -0
  52. data/lib/bundler/man/bundle-env.1.ronn +10 -0
  53. data/lib/bundler/man/bundle-exec.1 +5 -2
  54. data/lib/bundler/man/bundle-exec.1.ronn +4 -1
  55. data/lib/bundler/man/bundle-fund.1 +22 -0
  56. data/lib/bundler/man/bundle-fund.1.ronn +25 -0
  57. data/lib/bundler/man/bundle-gem.1 +17 -5
  58. data/lib/bundler/man/bundle-gem.1.ronn +27 -6
  59. data/lib/bundler/man/bundle-help.1 +1 -1
  60. data/lib/bundler/man/bundle-info.1 +5 -2
  61. data/lib/bundler/man/bundle-info.1.ronn +6 -2
  62. data/lib/bundler/man/bundle-init.1 +3 -3
  63. data/lib/bundler/man/bundle-init.1.ronn +3 -2
  64. data/lib/bundler/man/bundle-inject.1 +10 -2
  65. data/lib/bundler/man/bundle-inject.1.ronn +9 -1
  66. data/lib/bundler/man/bundle-install.1 +15 -12
  67. data/lib/bundler/man/bundle-install.1.ronn +22 -18
  68. data/lib/bundler/man/bundle-issue.1 +45 -0
  69. data/lib/bundler/man/bundle-issue.1.ronn +37 -0
  70. data/lib/bundler/man/bundle-licenses.1 +9 -0
  71. data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  72. data/lib/bundler/man/bundle-list.1 +1 -1
  73. data/lib/bundler/man/bundle-list.1.ronn +4 -1
  74. data/lib/bundler/man/bundle-lock.1 +21 -6
  75. data/lib/bundler/man/bundle-lock.1.ronn +25 -4
  76. data/lib/bundler/man/bundle-open.1 +2 -2
  77. data/lib/bundler/man/bundle-open.1.ronn +2 -1
  78. data/lib/bundler/man/bundle-outdated.1 +8 -5
  79. data/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  80. data/lib/bundler/man/bundle-platform.1 +1 -1
  81. data/lib/bundler/man/bundle-plugin.1 +1 -1
  82. data/lib/bundler/man/bundle-pristine.1 +1 -1
  83. data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  84. data/lib/bundler/man/bundle-remove.1 +1 -1
  85. data/lib/bundler/man/bundle-remove.1.ronn +1 -1
  86. data/lib/bundler/man/bundle-show.1 +5 -2
  87. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  88. data/lib/bundler/man/bundle-update.1 +13 -7
  89. data/lib/bundler/man/bundle-update.1.ronn +14 -6
  90. data/lib/bundler/man/bundle-version.1 +1 -1
  91. data/lib/bundler/man/bundle-viz.1 +4 -4
  92. data/lib/bundler/man/bundle-viz.1.ronn +7 -3
  93. data/lib/bundler/man/bundle.1 +1 -1
  94. data/lib/bundler/man/gemfile.5 +1 -1
  95. data/lib/bundler/man/index.txt +4 -0
  96. data/lib/bundler/materialization.rb +59 -0
  97. data/lib/bundler/plugin/events.rb +24 -0
  98. data/lib/bundler/plugin/installer.rb +1 -1
  99. data/lib/bundler/plugin.rb +20 -1
  100. data/lib/bundler/process_lock.rb +10 -14
  101. data/lib/bundler/remote_specification.rb +6 -1
  102. data/lib/bundler/resolver/base.rb +6 -6
  103. data/lib/bundler/resolver/candidate.rb +2 -2
  104. data/lib/bundler/resolver/spec_group.rb +4 -3
  105. data/lib/bundler/resolver.rb +5 -5
  106. data/lib/bundler/rubygems_ext.rb +30 -27
  107. data/lib/bundler/rubygems_gem_installer.rb +3 -2
  108. data/lib/bundler/rubygems_integration.rb +23 -40
  109. data/lib/bundler/runtime.rb +27 -7
  110. data/lib/bundler/self_manager.rb +2 -3
  111. data/lib/bundler/settings.rb +6 -1
  112. data/lib/bundler/shared_helpers.rb +29 -17
  113. data/lib/bundler/source/git/git_proxy.rb +0 -6
  114. data/lib/bundler/source/git.rb +56 -31
  115. data/lib/bundler/source/metadata.rb +2 -3
  116. data/lib/bundler/source/path.rb +2 -2
  117. data/lib/bundler/source_list.rb +1 -1
  118. data/lib/bundler/spec_set.rb +81 -56
  119. data/lib/bundler/stub_specification.rb +8 -0
  120. data/lib/bundler/templates/newgem/Gemfile.tt +0 -3
  121. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  122. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  123. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
  124. data/lib/bundler/uri_credentials_filter.rb +1 -1
  125. data/lib/bundler/vendor/fileutils/COPYING +56 -0
  126. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  127. data/lib/bundler/vendor/securerandom/COPYING +56 -0
  128. data/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
  129. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  130. data/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  131. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  132. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  133. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  134. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  135. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  136. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  137. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  138. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  139. data/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  140. data/lib/bundler/vendor/uri/COPYING +56 -0
  141. data/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
  142. data/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  143. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  144. data/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
  145. data/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  146. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  147. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  148. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  149. data/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  150. data/lib/bundler/vendored_securerandom.rb +0 -2
  151. data/lib/bundler/version.rb +1 -1
  152. data/lib/bundler.rb +38 -14
  153. metadata +18 -12
  154. data/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
  155. data/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
  156. data/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
  157. data/lib/bundler/vendor/uri/LICENSE.txt +0 -22
@@ -7,49 +7,44 @@ module Bundler
7
7
  include Enumerable
8
8
  include TSort
9
9
 
10
- attr_reader :incomplete_specs
11
-
12
- def initialize(specs, incomplete_specs = [])
10
+ def initialize(specs)
13
11
  @specs = specs
14
- @incomplete_specs = incomplete_specs
15
12
  end
16
13
 
17
- def for(dependencies, check = false, platforms = [nil])
18
- handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
19
- deps = dependencies.product(platforms)
20
- specs = []
14
+ def for(dependencies, platforms_or_legacy_check = [nil], legacy_platforms = [nil], skips: [])
15
+ platforms = if [true, false].include?(platforms_or_legacy_check)
16
+ Bundler::SharedHelpers.major_deprecation 2,
17
+ "SpecSet#for received a `check` parameter, but that's no longer used and deprecated. " \
18
+ "SpecSet#for always implicitly performs validation. Please remove this parameter",
19
+ print_caller_location: true
21
20
 
22
- loop do
23
- break unless dep = deps.shift
21
+ legacy_platforms
22
+ else
23
+ platforms_or_legacy_check
24
+ end
24
25
 
25
- name = dep[0].name
26
- platform = dep[1]
27
- incomplete = false
26
+ materialize_dependencies(dependencies, platforms, skips: skips)
28
27
 
29
- key = [name, platform]
30
- next if handled.key?(key)
28
+ @materializations.flat_map(&:specs).uniq
29
+ end
31
30
 
32
- handled[key] = true
31
+ def normalize_platforms!(deps, platforms)
32
+ complete_platforms = add_extra_platforms!(platforms)
33
33
 
34
- specs_for_dep = specs_for_dependency(*dep)
35
- if specs_for_dep.any?
36
- specs.concat(specs_for_dep)
34
+ complete_platforms.map do |platform|
35
+ next platform if platform == Gem::Platform::RUBY
37
36
 
38
- specs_for_dep.first.dependencies.each do |d|
39
- next if d.type == :development
40
- incomplete = true if d.name != "bundler" && lookup[d.name].nil?
41
- deps << [d, dep[1]]
42
- end
43
- else
44
- incomplete = true
37
+ begin
38
+ Integer(platform.version)
39
+ rescue ArgumentError, TypeError
40
+ next platform
45
41
  end
46
42
 
47
- if incomplete && check
48
- @incomplete_specs += lookup[name] || [LazySpecification.new(name, nil, nil)]
49
- end
50
- end
43
+ less_specific_platform = Gem::Platform.new([platform.cpu, platform.os, nil])
44
+ next platform if incomplete_for_platform?(deps, less_specific_platform)
51
45
 
52
- specs.uniq
46
+ less_specific_platform
47
+ end.uniq
53
48
  end
54
49
 
55
50
  def add_extra_platforms!(platforms)
@@ -112,19 +107,18 @@ module Bundler
112
107
  end
113
108
 
114
109
  def materialize(deps)
115
- materialized = self.for(deps, true)
110
+ materialize_dependencies(deps)
116
111
 
117
- SpecSet.new(materialized, incomplete_specs)
112
+ SpecSet.new(materialized_specs)
118
113
  end
119
114
 
120
115
  # Materialize for all the specs in the spec set, regardless of what platform they're for
121
- # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
122
116
  # @return [Array<Gem::Specification>]
123
117
  def materialized_for_all_platforms
124
118
  @specs.map do |s|
125
119
  next s unless s.is_a?(LazySpecification)
126
120
  s.source.remote!
127
- spec = s.materialize_for_installation
121
+ spec = s.materialize_strictly
128
122
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
129
123
  spec
130
124
  end
@@ -133,15 +127,32 @@ module Bundler
133
127
  def incomplete_for_platform?(deps, platform)
134
128
  return false if @specs.empty?
135
129
 
136
- @incomplete_specs = []
130
+ validation_set = self.class.new(@specs)
131
+ validation_set.for(deps, [platform])
132
+
133
+ validation_set.incomplete_specs.any?
134
+ end
137
135
 
138
- self.for(deps, true, [platform])
136
+ def missing_specs_for(dependencies)
137
+ materialize_dependencies(dependencies)
139
138
 
140
- @incomplete_specs.any?
139
+ missing_specs
141
140
  end
142
141
 
143
142
  def missing_specs
144
- @specs.select {|s| s.is_a?(LazySpecification) }
143
+ @materializations.flat_map(&:completely_missing_specs)
144
+ end
145
+
146
+ def partially_missing_specs
147
+ @materializations.flat_map(&:partially_missing_specs)
148
+ end
149
+
150
+ def incomplete_specs
151
+ @materializations.flat_map(&:incomplete_specs)
152
+ end
153
+
154
+ def insecurely_materialized_specs
155
+ materialized_specs.select(&:insecurely_materialized?)
145
156
  end
146
157
 
147
158
  def -(other)
@@ -152,12 +163,6 @@ module Bundler
152
163
  @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
153
164
  end
154
165
 
155
- def specs_compatible_with(other)
156
- select do |spec|
157
- other.valid?(spec)
158
- end
159
- end
160
-
161
166
  def delete_by_name(name)
162
167
  @specs.reject! {|spec| spec.name == name }
163
168
 
@@ -201,6 +206,37 @@ module Bundler
201
206
 
202
207
  private
203
208
 
209
+ def materialize_dependencies(dependencies, platforms = [nil], skips: [])
210
+ handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
211
+ deps = dependencies.product(platforms)
212
+ @materializations = []
213
+
214
+ loop do
215
+ break unless dep = deps.shift
216
+
217
+ dependency = dep[0]
218
+ platform = dep[1]
219
+ name = dependency.name
220
+
221
+ key = [name, platform]
222
+ next if handled.key?(key)
223
+
224
+ handled[key] = true
225
+
226
+ materialization = Materialization.new(dependency, platform, candidates: lookup[name])
227
+
228
+ deps.concat(materialization.dependencies) if materialization.complete?
229
+
230
+ @materializations << materialization unless skips.include?(name)
231
+ end
232
+
233
+ @materializations
234
+ end
235
+
236
+ def materialized_specs
237
+ @materializations.filter_map(&:materialized_spec)
238
+ end
239
+
204
240
  def reset!
205
241
  @sorted = nil
206
242
  @lookup = nil
@@ -273,17 +309,6 @@ module Bundler
273
309
  @specs.sort_by(&:name).each {|s| yield s }
274
310
  end
275
311
 
276
- def specs_for_dependency(dep, platform)
277
- specs_for_name = lookup[dep.name]
278
- return [] unless specs_for_name
279
-
280
- if platform
281
- GemHelpers.select_best_platform_match(specs_for_name, platform, force_ruby: dep.force_ruby_platform)
282
- else
283
- GemHelpers.select_best_local_platform_match(specs_for_name, force_ruby: dep.force_ruby_platform || dep.default_force_ruby_platform)
284
- end
285
- end
286
-
287
312
  def tsort_each_child(s)
288
313
  s.dependencies.sort_by(&:name).each do |d|
289
314
  next if d.type == :development
@@ -9,6 +9,10 @@ module Bundler
9
9
  spec
10
10
  end
11
11
 
12
+ def insecurely_materialized?
13
+ false
14
+ end
15
+
12
16
  attr_reader :checksum
13
17
  attr_accessor :stub, :ignored
14
18
 
@@ -112,6 +116,10 @@ module Bundler
112
116
  stub.raw_require_paths
113
117
  end
114
118
 
119
+ def inspect
120
+ "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
121
+ end
122
+
115
123
  private
116
124
 
117
125
  def _remote_specification
@@ -9,9 +9,6 @@ gem "rake", "~> 13.0"
9
9
  <%- if config[:ext] -%>
10
10
 
11
11
  gem "rake-compiler"
12
- <%- if config[:ext] == 'rust' -%>
13
- gem "rb_sys", "~> 0.9.63"
14
- <%- end -%>
15
12
  <%- end -%>
16
13
  <%- if config[:test] -%>
17
14
 
@@ -26,7 +26,7 @@ TODO: Write usage instructions here
26
26
 
27
27
  ## Development
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
29
+ After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test_task] %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
30
30
 
31
31
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
32
  <% if config[:git] -%>
@@ -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
@@ -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
@@ -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.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: us-ascii -*-
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'random/formatter'
4
+ require 'random/formatter'
5
5
 
6
6
  # == Secure random number generator interface.
7
7
  #
@@ -18,7 +18,7 @@ require_relative 'random/formatter'
18
18
  # * /dev/urandom
19
19
  # * Win32
20
20
  #
21
- # Bundler::SecureRandom is extended by the Bundler::Random::Formatter module which
21
+ # Bundler::SecureRandom is extended by the Random::Formatter module which
22
22
  # defines the following methods:
23
23
  #
24
24
  # * alphanumeric
@@ -41,7 +41,7 @@ require_relative 'random/formatter'
41
41
  module Bundler::SecureRandom
42
42
 
43
43
  # The version
44
- VERSION = "0.3.1"
44
+ VERSION = "0.4.0"
45
45
 
46
46
  class << self
47
47
  # Returns a random binary string containing +size+ bytes.
@@ -88,9 +88,9 @@ module Bundler::SecureRandom
88
88
 
89
89
  # :startdoc:
90
90
 
91
- # Generate random data bytes for Bundler::Random::Formatter
91
+ # Generate random data bytes for Random::Formatter
92
92
  public :gen_random
93
93
  end
94
94
  end
95
95
 
96
- Bundler::SecureRandom.extend(Bundler::Random::Formatter)
96
+ 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
@@ -250,7 +250,8 @@ class Bundler::Thor
250
250
  @parsing_options
251
251
  end
252
252
 
253
- # Parse boolean values which can be given as --foo=true, --foo or --no-foo.
253
+ # Parse boolean values which can be given as --foo=true or --foo for true values, or
254
+ # --foo=false, --no-foo or --skip-foo for false values.
254
255
  #
255
256
  def parse_boolean(switch)
256
257
  if current_is_value?