bundler 2.6.9 → 4.0.11

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2229 -1879
  3. data/README.md +11 -11
  4. data/bundler.gemspec +5 -5
  5. data/lib/bundler/build_metadata.rb +10 -11
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/checksum.rb +6 -0
  8. data/lib/bundler/cli/add.rb +10 -0
  9. data/lib/bundler/cli/cache.rb +1 -12
  10. data/lib/bundler/cli/common.rb +21 -4
  11. data/lib/bundler/cli/config.rb +1 -2
  12. data/lib/bundler/cli/console.rb +5 -0
  13. data/lib/bundler/cli/exec.rb +29 -4
  14. data/lib/bundler/cli/gem.rb +90 -64
  15. data/lib/bundler/cli/install.rb +15 -90
  16. data/lib/bundler/cli/issue.rb +2 -2
  17. data/lib/bundler/cli/list.rb +33 -2
  18. data/lib/bundler/cli/lock.rb +5 -5
  19. data/lib/bundler/cli/outdated.rb +1 -1
  20. data/lib/bundler/cli/plugin.rb +5 -1
  21. data/lib/bundler/cli/pristine.rb +5 -1
  22. data/lib/bundler/cli/show.rb +3 -7
  23. data/lib/bundler/cli/update.rb +5 -5
  24. data/lib/bundler/cli.rb +162 -127
  25. data/lib/bundler/compact_index_client.rb +1 -6
  26. data/lib/bundler/current_ruby.rb +17 -5
  27. data/lib/bundler/definition.rb +201 -117
  28. data/lib/bundler/dependency.rb +1 -1
  29. data/lib/bundler/deployment.rb +1 -64
  30. data/lib/bundler/digest.rb +1 -1
  31. data/lib/bundler/dsl.rb +48 -48
  32. data/lib/bundler/environment_preserver.rb +1 -0
  33. data/lib/bundler/errors.rb +1 -5
  34. data/lib/bundler/feature_flag.rb +5 -35
  35. data/lib/bundler/fetcher/compact_index.rb +1 -1
  36. data/lib/bundler/fetcher/dependency.rb +9 -2
  37. data/lib/bundler/fetcher/downloader.rb +33 -8
  38. data/lib/bundler/fetcher/gem_remote_fetcher.rb +6 -0
  39. data/lib/bundler/fetcher.rb +49 -19
  40. data/lib/bundler/friendly_errors.rb +4 -3
  41. data/lib/bundler/index.rb +7 -9
  42. data/lib/bundler/injector.rb +1 -2
  43. data/lib/bundler/inline.rb +9 -1
  44. data/lib/bundler/installer/gem_installer.rb +14 -11
  45. data/lib/bundler/installer/parallel_installer.rb +74 -36
  46. data/lib/bundler/installer.rb +6 -19
  47. data/lib/bundler/lazy_specification.rb +47 -20
  48. data/lib/bundler/lockfile_generator.rb +17 -2
  49. data/lib/bundler/lockfile_parser.rb +19 -6
  50. data/lib/bundler/man/bundle-add.1 +1 -1
  51. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  52. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  53. data/lib/bundler/man/bundle-cache.1 +2 -14
  54. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  55. data/lib/bundler/man/bundle-check.1 +2 -5
  56. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  57. data/lib/bundler/man/bundle-clean.1 +1 -1
  58. data/lib/bundler/man/bundle-config.1 +206 -148
  59. data/lib/bundler/man/bundle-config.1.ronn +136 -119
  60. data/lib/bundler/man/bundle-console.1 +1 -1
  61. data/lib/bundler/man/bundle-doctor.1 +43 -4
  62. data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  63. data/lib/bundler/man/bundle-env.1 +1 -1
  64. data/lib/bundler/man/bundle-exec.1 +2 -5
  65. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  66. data/lib/bundler/man/bundle-fund.1 +1 -1
  67. data/lib/bundler/man/bundle-gem.1 +64 -44
  68. data/lib/bundler/man/bundle-gem.1.ronn +10 -9
  69. data/lib/bundler/man/bundle-help.1 +1 -1
  70. data/lib/bundler/man/bundle-info.1 +1 -1
  71. data/lib/bundler/man/bundle-init.1 +1 -1
  72. data/lib/bundler/man/bundle-install.1 +16 -59
  73. data/lib/bundler/man/bundle-install.1.ronn +27 -108
  74. data/lib/bundler/man/bundle-issue.1 +1 -1
  75. data/lib/bundler/man/bundle-licenses.1 +1 -1
  76. data/lib/bundler/man/bundle-list.1 +6 -1
  77. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  78. data/lib/bundler/man/bundle-lock.1 +1 -1
  79. data/lib/bundler/man/bundle-open.1 +1 -1
  80. data/lib/bundler/man/bundle-outdated.1 +1 -1
  81. data/lib/bundler/man/bundle-platform.1 +1 -1
  82. data/lib/bundler/man/bundle-plugin.1 +33 -15
  83. data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
  84. data/lib/bundler/man/bundle-pristine.1 +1 -1
  85. data/lib/bundler/man/bundle-remove.1 +2 -8
  86. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  87. data/lib/bundler/man/bundle-show.1 +2 -5
  88. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  89. data/lib/bundler/man/bundle-update.1 +5 -5
  90. data/lib/bundler/man/bundle-update.1.ronn +4 -4
  91. data/lib/bundler/man/bundle-version.1 +1 -1
  92. data/lib/bundler/man/bundle.1 +1 -10
  93. data/lib/bundler/man/bundle.1.ronn +0 -9
  94. data/lib/bundler/man/gemfile.5 +32 -1
  95. data/lib/bundler/man/gemfile.5.ronn +28 -0
  96. data/lib/bundler/man/index.txt +0 -2
  97. data/lib/bundler/match_platform.rb +31 -12
  98. data/lib/bundler/materialization.rb +3 -3
  99. data/lib/bundler/plugin/api/source.rb +8 -0
  100. data/lib/bundler/plugin/index.rb +6 -0
  101. data/lib/bundler/plugin/installer.rb +2 -11
  102. data/lib/bundler/plugin/source_list.rb +1 -1
  103. data/lib/bundler/plugin.rb +7 -4
  104. data/lib/bundler/resolver/package.rb +2 -1
  105. data/lib/bundler/resolver/strategy.rb +6 -3
  106. data/lib/bundler/resolver.rb +20 -4
  107. data/lib/bundler/retry.rb +30 -4
  108. data/lib/bundler/ruby_dsl.rb +17 -12
  109. data/lib/bundler/ruby_version.rb +1 -3
  110. data/lib/bundler/rubygems_ext.rb +117 -121
  111. data/lib/bundler/rubygems_gem_installer.rb +5 -4
  112. data/lib/bundler/rubygems_integration.rb +13 -12
  113. data/lib/bundler/runtime.rb +14 -3
  114. data/lib/bundler/self_manager.rb +34 -43
  115. data/lib/bundler/settings/validator.rb +5 -21
  116. data/lib/bundler/settings.rb +17 -32
  117. data/lib/bundler/shared_helpers.rb +12 -18
  118. data/lib/bundler/source/gemspec.rb +4 -0
  119. data/lib/bundler/source/git/git_proxy.rb +55 -29
  120. data/lib/bundler/source/git.rb +2 -3
  121. data/lib/bundler/source/metadata.rb +4 -0
  122. data/lib/bundler/source/path.rb +12 -7
  123. data/lib/bundler/source/rubygems.rb +59 -43
  124. data/lib/bundler/source/rubygems_aggregate.rb +4 -1
  125. data/lib/bundler/source.rb +3 -1
  126. data/lib/bundler/source_list.rb +5 -50
  127. data/lib/bundler/source_map.rb +8 -7
  128. data/lib/bundler/spec_set.rb +9 -14
  129. data/lib/bundler/stub_specification.rb +1 -0
  130. data/lib/bundler/templates/Executable +0 -11
  131. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  132. data/lib/bundler/templates/newgem/Cargo.toml.tt +6 -0
  133. data/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  134. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  135. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +8 -1
  136. data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
  137. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  138. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  139. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  140. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  141. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +13 -2
  142. data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
  143. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +12 -1
  144. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  145. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
  146. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -11
  147. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +8 -0
  148. data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +6 -0
  149. data/lib/bundler/ui/shell.rb +12 -8
  150. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  151. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  152. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  153. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  154. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  155. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  156. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +84 -42
  157. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  158. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  159. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  160. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  161. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  162. data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
  163. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  164. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  165. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  166. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  167. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  168. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  169. data/lib/bundler/version.rb +10 -2
  170. data/lib/bundler/vlad.rb +1 -14
  171. data/lib/bundler/worker.rb +12 -4
  172. data/lib/bundler.rb +20 -40
  173. metadata +13 -25
  174. data/lib/bundler/cli/inject.rb +0 -60
  175. data/lib/bundler/cli/viz.rb +0 -31
  176. data/lib/bundler/gem_helpers.rb +0 -144
  177. data/lib/bundler/graph.rb +0 -152
  178. data/lib/bundler/man/bundle-inject.1 +0 -31
  179. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  180. data/lib/bundler/man/bundle-viz.1 +0 -30
  181. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  182. data/lib/bundler/similarity_detector.rb +0 -63
  183. data/lib/bundler/templates/Executable.bundler +0 -109
  184. data/lib/bundler/vendor/connection_pool/.document +0 -1
  185. data/lib/bundler/vendor/fileutils/.document +0 -1
  186. data/lib/bundler/vendor/net-http-persistent/.document +0 -1
  187. data/lib/bundler/vendor/pub_grub/.document +0 -1
  188. data/lib/bundler/vendor/securerandom/.document +0 -1
  189. data/lib/bundler/vendor/thor/.document +0 -1
  190. data/lib/bundler/vendor/tsort/.document +0 -1
  191. data/lib/bundler/vendor/uri/.document +0 -1
@@ -24,7 +24,7 @@ module Bundler
24
24
  @path = Pathname.new(options["path"])
25
25
  expanded_path = expand(@path)
26
26
  @path = if @path.relative?
27
- expanded_path.relative_path_from(root_path.expand_path)
27
+ expanded_path.relative_path_from(File.expand_path(root_path))
28
28
  else
29
29
  expanded_path
30
30
  end
@@ -53,6 +53,8 @@ module Bundler
53
53
  "source at `#{@path}`"
54
54
  end
55
55
 
56
+ alias_method :identifier, :to_s
57
+
56
58
  alias_method :to_gemfile, :path
57
59
 
58
60
  def hash
@@ -81,7 +83,7 @@ module Bundler
81
83
 
82
84
  def cache(spec, custom_path = nil)
83
85
  app_cache_path = app_cache_path(custom_path)
84
- return unless Bundler.feature_flag.cache_all?
86
+ return unless Bundler.settings[:cache_all]
85
87
  return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
86
88
 
87
89
  unless @original_path.exist?
@@ -124,11 +126,7 @@ module Bundler
124
126
  end
125
127
 
126
128
  def expand(somepath)
127
- if Bundler.current_ruby.jruby? # TODO: Unify when https://github.com/rubygems/bundler/issues/7598 fixed upstream and all supported jrubies include the fix
128
- somepath.expand_path(root_path).expand_path
129
- else
130
- somepath.expand_path(root_path)
131
- end
129
+ somepath.expand_path(root_path)
132
130
  rescue ArgumentError => e
133
131
  Bundler.ui.debug(e)
134
132
  raise PathError, "There was an error while trying to use the path " \
@@ -167,6 +165,13 @@ module Bundler
167
165
  next unless spec = load_gemspec(file)
168
166
  spec.source = self
169
167
 
168
+ # The ignore attribute is for ignoring installed gems that don't
169
+ # have extensions correctly compiled for activation. In the case of
170
+ # path sources, there's a single version of each gem in the path
171
+ # source available to Bundler, so we always certainly want to
172
+ # consider that for activation and never makes sense to ignore it.
173
+ spec.ignored = false
174
+
170
175
  # Validation causes extension_dir to be calculated, which depends
171
176
  # on #source, so we validate here instead of load_gemspec
172
177
  validate_spec(spec)
@@ -8,7 +8,8 @@ module Bundler
8
8
  autoload :Remote, File.expand_path("rubygems/remote", __dir__)
9
9
 
10
10
  # Ask for X gems per API request
11
- API_REQUEST_SIZE = 50
11
+ API_REQUEST_SIZE = 100
12
+ REQUIRE_MUTEX = Mutex.new
12
13
 
13
14
  attr_accessor :remotes
14
15
 
@@ -21,6 +22,8 @@ module Bundler
21
22
  @allow_local = options["allow_local"] || false
22
23
  @prefer_local = false
23
24
  @checksum_store = Checksum::Store.new
25
+ @gem_installers = {}
26
+ @gem_installers_mutex = Mutex.new
24
27
 
25
28
  Array(options["remotes"]).reverse_each {|r| add_remote(r) }
26
29
 
@@ -162,62 +165,51 @@ module Bundler
162
165
  end
163
166
  end
164
167
 
165
- def install(spec, options = {})
168
+ def download(spec, options = {})
166
169
  if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])
167
- print_using_message "Using #{version_message(spec, options[:previous_spec])}"
168
- return nil # no post-install message
169
- end
170
-
171
- if spec.remote
172
- # Check for this spec from other sources
173
- uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
174
- Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
170
+ return true
175
171
  end
176
172
 
177
- path = fetch_gem_if_possible(spec, options[:previous_spec])
178
- raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
179
-
180
- return if Bundler.settings[:no_install]
181
-
182
- install_path = rubygems_dir
183
- bin_path = Bundler.system_bindir
184
-
185
- require_relative "../rubygems_gem_installer"
186
-
187
- installer = Bundler::RubyGemsGemInstaller.at(
188
- path,
189
- security_policy: Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
190
- install_dir: install_path.to_s,
191
- bin_dir: bin_path.to_s,
192
- ignore_dependencies: true,
193
- wrappers: true,
194
- env_shebang: true,
195
- build_args: options[:build_args],
196
- bundler_extension_cache_path: extension_cache_path(spec)
197
- )
173
+ installer = rubygems_gem_installer(spec, options)
198
174
 
199
175
  if spec.remote
200
176
  s = begin
201
177
  installer.spec
202
178
  rescue Gem::Package::FormatError
203
- Bundler.rm_rf(path)
179
+ Bundler.rm_rf(installer.gem)
204
180
  raise
205
181
  rescue Gem::Security::Exception => e
206
182
  raise SecurityError,
207
- "The gem #{File.basename(path, ".gem")} can't be installed because " \
183
+ "The gem #{installer.gem} can't be installed because " \
208
184
  "the security policy didn't allow it, with the message: #{e.message}"
209
185
  end
210
186
 
211
187
  spec.__swap__(s)
212
188
  end
213
189
 
190
+ spec
191
+ end
192
+
193
+ def install(spec, options = {})
194
+ if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])
195
+ print_using_message "Using #{version_message(spec, options[:previous_spec])}"
196
+ return nil # no post-install message
197
+ end
198
+
199
+ return if Bundler.settings[:no_install]
200
+
201
+ installer = rubygems_gem_installer(spec, options)
214
202
  spec.source.checksum_store.register(spec, installer.gem_checksum)
215
203
 
216
204
  message = "Installing #{version_message(spec, options[:previous_spec])}"
217
205
  message += " with native extensions" if spec.extensions.any?
218
206
  Bundler.ui.confirm message
219
207
 
220
- installed_spec = installer.install
208
+ installed_spec = nil
209
+
210
+ Gem.time("Installed #{spec.name} in", 0, true) do
211
+ installed_spec = installer.install
212
+ end
221
213
 
222
214
  spec.full_gem_path = installed_spec.full_gem_path
223
215
  spec.loaded_from = installed_spec.loaded_from
@@ -332,13 +324,6 @@ module Bundler
332
324
  remotes.map(&method(:remove_auth))
333
325
  end
334
326
 
335
- def remotes_for_spec(spec)
336
- specs.search_all(spec.name).inject([]) do |uris, s|
337
- uris << s.remote if s.remote
338
- uris
339
- end
340
- end
341
-
342
327
  def cached_gem(spec)
343
328
  global_cache_path = download_cache_path(spec)
344
329
  caches << global_cache_path if global_cache_path
@@ -491,7 +476,10 @@ module Bundler
491
476
  uri = spec.remote.uri
492
477
  Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
493
478
  gem_remote_fetcher = remote_fetchers.fetch(spec.remote).gem_remote_fetcher
494
- Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)
479
+
480
+ Gem.time("Downloaded #{spec.name} in", 0, true) do
481
+ Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)
482
+ end
495
483
  end
496
484
 
497
485
  # Returns the global cache path of the calling Rubygems::Source object.
@@ -506,7 +494,7 @@ module Bundler
506
494
  # @return [Pathname] The global cache path.
507
495
  #
508
496
  def download_cache_path(spec)
509
- return unless Bundler.feature_flag.global_gem_cache?
497
+ return unless Bundler.settings[:global_gem_cache]
510
498
  return unless remote = spec.remote
511
499
  return unless cache_slug = remote.cache_slug
512
500
 
@@ -517,6 +505,34 @@ module Bundler
517
505
  return unless remote = spec.remote
518
506
  remote.cache_slug
519
507
  end
508
+
509
+ # We are using a mutex to reaed and write from/to the hash.
510
+ # The reason this double synchronization was added is for performance
511
+ # and to lock the mutex for the shortest possible amount of time. Otherwise,
512
+ # all threads are fighting over this mutex and when it gets acquired it gets locked
513
+ # until a threads finishes downloading a gem, leaving the other threads waiting
514
+ # doing nothing.
515
+ def rubygems_gem_installer(spec, options)
516
+ @gem_installers_mutex.synchronize { @gem_installers[spec.name] } || begin
517
+ path = fetch_gem_if_possible(spec, options[:previous_spec])
518
+ raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
519
+
520
+ REQUIRE_MUTEX.synchronize { require_relative "../rubygems_gem_installer" }
521
+
522
+ installer = Bundler::RubyGemsGemInstaller.at(
523
+ path,
524
+ security_policy: Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
525
+ install_dir: rubygems_dir.to_s,
526
+ bin_dir: Bundler.system_bindir.to_s,
527
+ ignore_dependencies: true,
528
+ wrappers: true,
529
+ env_shebang: true,
530
+ build_args: options[:build_args],
531
+ bundler_extension_cache_path: extension_cache_path(spec)
532
+ )
533
+ @gem_installers_mutex.synchronize { @gem_installers[spec.name] ||= installer }
534
+ end
535
+ end
520
536
  end
521
537
  end
522
538
  end
@@ -5,9 +5,10 @@ module Bundler
5
5
  class RubygemsAggregate
6
6
  attr_reader :source_map, :sources
7
7
 
8
- def initialize(sources, source_map)
8
+ def initialize(sources, source_map, excluded_sources = [])
9
9
  @sources = sources
10
10
  @source_map = source_map
11
+ @excluded_sources = excluded_sources
11
12
 
12
13
  @index = build_index
13
14
  end
@@ -31,6 +32,8 @@ module Bundler
31
32
  dependency_names = source_map.pinned_spec_names
32
33
 
33
34
  sources.all_sources.each do |source|
35
+ next if @excluded_sources.include?(source)
36
+
34
37
  source.dependency_names = dependency_names - source_map.pinned_spec_names(source)
35
38
  idx.add_source source.specs
36
39
  dependency_names.concat(source.unmet_deps).uniq!
@@ -31,6 +31,8 @@ module Bundler
31
31
  message
32
32
  end
33
33
 
34
+ def download(*); end
35
+
34
36
  def can_lock?(spec)
35
37
  spec.source == self
36
38
  end
@@ -79,7 +81,7 @@ module Bundler
79
81
  end
80
82
 
81
83
  def extension_cache_path(spec)
82
- return unless Bundler.feature_flag.global_gem_cache?
84
+ return unless Bundler.settings[:global_gem_cache]
83
85
  return unless source_slug = extension_cache_slug(spec)
84
86
  Bundler.user_cache.join(
85
87
  "extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
12
+ @global_rubygems_source ||= source_class.new("allow_local" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -21,19 +21,9 @@ module Bundler
21
21
  @rubygems_sources = []
22
22
  @metadata_source = Source::Metadata.new
23
23
 
24
- @merged_gem_lockfile_sections = false
25
24
  @local_mode = true
26
25
  end
27
26
 
28
- def merged_gem_lockfile_sections?
29
- @merged_gem_lockfile_sections
30
- end
31
-
32
- def merged_gem_lockfile_sections!(replacement_source)
33
- @merged_gem_lockfile_sections = true
34
- @global_rubygems_source = replacement_source
35
- end
36
-
37
27
  def aggregate_global_source?
38
28
  global_rubygems_source.multiple_remotes?
39
29
  end
@@ -90,10 +80,6 @@ module Bundler
90
80
  @rubygems_sources
91
81
  end
92
82
 
93
- def rubygems_remotes
94
- rubygems_sources.flat_map(&:remotes).uniq
95
- end
96
-
97
83
  def all_sources
98
84
  path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
99
85
  end
@@ -103,7 +89,7 @@ module Bundler
103
89
  end
104
90
 
105
91
  def get(source)
106
- source_list_for(source).find {|s| equivalent_source?(source, s) }
92
+ source_list_for(source).find {|s| s.include?(source) }
107
93
  end
108
94
 
109
95
  def lock_sources
@@ -115,11 +101,7 @@ module Bundler
115
101
  end
116
102
 
117
103
  def lock_rubygems_sources
118
- if merged_gem_lockfile_sections?
119
- [combine_rubygems_sources]
120
- else
121
- rubygems_sources.sort_by(&:identifier)
122
- end
104
+ rubygems_sources.sort_by(&:identifier)
123
105
  end
124
106
 
125
107
  # Returns true if there are changes
@@ -129,16 +111,7 @@ module Bundler
129
111
  @rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
130
112
  @global_rubygems_source = global_replacement_source(replacement_sources)
131
113
 
132
- different_sources?(lock_sources, replacement_sources)
133
- end
134
-
135
- # Returns true if there are changes
136
- def expired_sources?(replacement_sources)
137
- return false if replacement_sources.empty?
138
-
139
- lock_sources = dup_with_replaced_sources(replacement_sources).lock_sources
140
-
141
- different_sources?(lock_sources, replacement_sources)
114
+ !equivalent_sources?(lock_sources, replacement_sources)
142
115
  end
143
116
 
144
117
  def prefer_local!
@@ -165,12 +138,6 @@ module Bundler
165
138
 
166
139
  private
167
140
 
168
- def dup_with_replaced_sources(replacement_sources)
169
- new_source_list = dup
170
- new_source_list.replace_sources!(replacement_sources)
171
- new_source_list
172
- end
173
-
174
141
  def map_sources(replacement_sources)
175
142
  rubygems = @rubygems_sources.map do |source|
176
143
  replace_rubygems_source(replacement_sources, source)
@@ -224,11 +191,7 @@ module Bundler
224
191
  end
225
192
  end
226
193
 
227
- def different_sources?(lock_sources, replacement_sources)
228
- !equivalent_sources?(lock_sources, replacement_sources)
229
- end
230
-
231
- def rubygems_aggregate_class
194
+ def source_class
232
195
  Source::Rubygems
233
196
  end
234
197
 
@@ -247,10 +210,6 @@ module Bundler
247
210
  end
248
211
  end
249
212
 
250
- def combine_rubygems_sources
251
- Source::Rubygems.new("remotes" => rubygems_remotes)
252
- end
253
-
254
213
  def warn_on_git_protocol(source)
255
214
  return if Bundler.settings["git.allow_insecure"]
256
215
 
@@ -265,9 +224,5 @@ module Bundler
265
224
  def equivalent_sources?(lock_sources, replacement_sources)
266
225
  lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
267
226
  end
268
-
269
- def equivalent_source?(source, other_source)
270
- source == other_source
271
- end
272
227
  end
273
228
  end
@@ -14,24 +14,25 @@ module Bundler
14
14
  direct_requirements.reject {|_, source| source == skip }.keys
15
15
  end
16
16
 
17
- def all_requirements
17
+ def all_requirements(excluded_sources = [])
18
18
  requirements = direct_requirements.dup
19
19
 
20
- unmet_deps = sources.non_default_explicit_sources.map do |source|
20
+ explicit_sources = sources.non_default_explicit_sources.reject do |source|
21
+ excluded_sources.include?(source)
22
+ end
23
+
24
+ unmet_deps = explicit_sources.map do |source|
21
25
  (source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
22
26
  previous_source = requirements[indirect_dependency_name]
23
27
  if previous_source.nil?
24
28
  requirements[indirect_dependency_name] = source
25
29
  else
26
- no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
27
-
28
30
  msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
29
31
  msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
30
- msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
32
+ msg << "You must add this gem to the source block for the source you wish it to be installed from."
31
33
  msg = msg.join("\n")
32
34
 
33
- raise SecurityError, msg if no_ambiguous_sources
34
- Bundler.ui.warn "Warning: #{msg}"
35
+ raise SecurityError, msg
35
36
  end
36
37
  end
37
38
 
@@ -11,16 +11,11 @@ module Bundler
11
11
  @specs = specs
12
12
  end
13
13
 
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,
14
+ def for(dependencies, platforms = [nil], legacy_platforms = [nil], skips: [])
15
+ if [true, false].include?(platforms)
16
+ Bundler::SharedHelpers.feature_removed! \
17
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
20
-
21
- legacy_platforms
22
- else
23
- platforms_or_legacy_check
18
+ "SpecSet#for always implicitly performs validation. Please remove this parameter"
24
19
  end
25
20
 
26
21
  materialize_dependencies(dependencies, platforms, skips: skips)
@@ -76,7 +71,7 @@ module Bundler
76
71
 
77
72
  new_platforms = all_platforms.select do |platform|
78
73
  next if platforms.include?(platform)
79
- next unless GemHelpers.generic(platform) == Gem::Platform::RUBY
74
+ next unless Gem::Platform.generic(platform) == Gem::Platform::RUBY
80
75
 
81
76
  complete_platform(platform)
82
77
  end
@@ -179,11 +174,11 @@ module Bundler
179
174
  end
180
175
 
181
176
  def -(other)
182
- SpecSet.new(to_a - other.to_a)
177
+ SharedHelpers.feature_removed! "SpecSet#- has been removed with no replacement"
183
178
  end
184
179
 
185
180
  def find_by_name_and_platform(name, platform)
186
- @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
181
+ @specs.detect {|spec| spec.name == name && spec.installable_on_platform?(platform) }
187
182
  end
188
183
 
189
184
  def specs_with_additional_variants_from(other)
@@ -210,7 +205,7 @@ module Bundler
210
205
  end
211
206
 
212
207
  def <<(spec)
213
- @specs << spec
208
+ SharedHelpers.feature_removed! "SpecSet#<< has been removed with no replacement"
214
209
  end
215
210
 
216
211
  def length
@@ -280,7 +275,7 @@ module Bundler
280
275
  valid_platform = lookup.all? do |_, specs|
281
276
  spec = specs.first
282
277
  matching_specs = spec.source.specs.search([spec.name, spec.version])
283
- platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
278
+ platform_spec = MatchPlatform.select_best_platform_match(matching_specs, platform).find do |s|
284
279
  valid?(s)
285
280
  end
286
281
 
@@ -52,6 +52,7 @@ module Bundler
52
52
 
53
53
  # This is defined directly to avoid having to loading the full spec
54
54
  def missing_extensions?
55
+ return false if RUBY_ENGINE == "jruby"
55
56
  return false if default_gem?
56
57
  return false if extensions.empty?
57
58
  return false if File.exist? gem_build_complete_path
@@ -10,17 +10,6 @@
10
10
 
11
11
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir__)
12
12
 
13
- bundle_binstub = File.expand_path("bundle", __dir__)
14
-
15
- if File.file?(bundle_binstub)
16
- if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
- load(bundle_binstub)
18
- else
19
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
- end
22
- end
23
-
24
13
  require "rubygems"
25
14
  require "bundler/setup"
26
15
 
@@ -1,132 +1,10 @@
1
- # Contributor Covenant Code of Conduct
1
+ # Code of Conduct
2
2
 
3
- ## Our Pledge
3
+ <%= config[:name].inspect %> follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
4
 
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
11
9
 
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations
10
+ If you have any concerns about behaviour within this project, please contact us at [<%= config[:email].inspect %>](mailto:<%= config[:email].inspect %>).
@@ -5,3 +5,9 @@
5
5
  [workspace]
6
6
  members = ["./ext/<%= config[:name] %>"]
7
7
  resolver = "2"
8
+
9
+ [profile.release]
10
+ # By default, debug symbols are stripped from the final binary which makes it
11
+ # harder to debug if something goes wrong. It's recommended to keep debug
12
+ # symbols in the release build so that you can debug the final binary if needed.
13
+ debug = true
@@ -59,6 +59,11 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
59
59
  end
60
60
  <% end -%>
61
61
 
62
+ <% if config[:ext] == "go" -%>
63
+ require "go_gem/rake_task"
64
+
65
+ GoGem::RakeTask.new("<%= config[:underscored_name] %>")
66
+ <% end -%>
62
67
  <% end -%>
63
68
  <% if default_task_names.size == 1 -%>
64
69
  task default: <%= default_task_names.first.inspect %>