bundler 2.2.0.rc.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -1
  3. data/lib/bundler.rb +4 -0
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli.rb +5 -2
  6. data/lib/bundler/cli/binstubs.rb +6 -2
  7. data/lib/bundler/cli/exec.rb +3 -3
  8. data/lib/bundler/cli/outdated.rb +2 -4
  9. data/lib/bundler/compact_index_client/updater.rb +5 -5
  10. data/lib/bundler/definition.rb +4 -9
  11. data/lib/bundler/env.rb +1 -1
  12. data/lib/bundler/feature_flag.rb +0 -1
  13. data/lib/bundler/fetcher/index.rb +2 -3
  14. data/lib/bundler/friendly_errors.rb +15 -0
  15. data/lib/bundler/index.rb +5 -1
  16. data/lib/bundler/injector.rb +9 -2
  17. data/lib/bundler/installer.rb +7 -5
  18. data/lib/bundler/lazy_specification.rb +5 -7
  19. data/lib/bundler/man/.document +1 -0
  20. data/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
  21. data/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
  22. data/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
  23. data/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
  24. data/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
  25. data/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
  26. data/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
  27. data/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
  28. data/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
  29. data/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
  30. data/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
  31. data/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
  32. data/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
  33. data/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
  34. data/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
  35. data/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
  36. data/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
  37. data/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
  38. data/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
  39. data/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
  40. data/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
  41. data/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
  42. data/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
  43. data/{man → lib/bundler/man}/bundle.1.ronn +0 -0
  44. data/{man → lib/bundler/man}/gemfile.5.ronn +0 -0
  45. data/lib/bundler/plugin/api/source.rb +1 -1
  46. data/lib/bundler/plugin/dsl.rb +1 -1
  47. data/lib/bundler/resolver.rb +2 -3
  48. data/lib/bundler/rubygems_integration.rb +4 -0
  49. data/lib/bundler/settings.rb +0 -1
  50. data/lib/bundler/source/git/git_proxy.rb +1 -1
  51. data/lib/bundler/spec_set.rb +1 -0
  52. data/lib/bundler/templates/newgem/README.md.tt +0 -1
  53. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -2
  54. data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -0
  55. data/lib/bundler/uri_credentials_filter.rb +2 -0
  56. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
  57. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -1
  58. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  59. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  60. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  61. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +38 -40
  62. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +4 -7
  63. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  64. data/lib/bundler/vendored_tmpdir.rb +4 -0
  65. data/lib/bundler/version.rb +1 -1
  66. data/man/bundle-add.1 +1 -1
  67. data/man/bundle-binstubs.1 +1 -1
  68. data/man/bundle-cache.1 +1 -1
  69. data/man/bundle-check.1 +1 -1
  70. data/man/bundle-clean.1 +1 -1
  71. data/man/bundle-config.1 +2 -5
  72. data/man/bundle-doctor.1 +1 -1
  73. data/man/bundle-exec.1 +1 -1
  74. data/man/bundle-gem.1 +1 -1
  75. data/man/bundle-info.1 +1 -1
  76. data/man/bundle-init.1 +1 -1
  77. data/man/bundle-inject.1 +1 -1
  78. data/man/bundle-install.1 +2 -2
  79. data/man/bundle-list.1 +1 -1
  80. data/man/bundle-lock.1 +1 -1
  81. data/man/bundle-open.1 +1 -1
  82. data/man/bundle-outdated.1 +1 -1
  83. data/man/bundle-platform.1 +1 -1
  84. data/man/bundle-pristine.1 +1 -1
  85. data/man/bundle-remove.1 +1 -1
  86. data/man/bundle-show.1 +1 -1
  87. data/man/bundle-update.1 +1 -1
  88. data/man/bundle-viz.1 +1 -1
  89. data/man/bundle.1 +1 -1
  90. data/man/gemfile.5 +1 -1
  91. data/man/index.txt +25 -0
  92. metadata +35 -32
  93. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3deabdf68833029d197e7079422e52ee0d23d799f5e79f5562870ad5ca1f3844
4
- data.tar.gz: 69b37fb8d751ba6abc5a647e284d6fef19e81e5a4ce33015fe1a9b6b2be69b07
3
+ metadata.gz: 0af01fdf441e83df2f02f7e0028ca485d12bb37986101861fa498f0768763708
4
+ data.tar.gz: 319299292a4a3b6e295e8d28bd6c9c7f2f478d686ff6ea733f31271c4f574512
5
5
  SHA512:
6
- metadata.gz: 264419f2fd673e20e883cda54eda3f1e5727dcc73d60b0a6d48012b775476e730a9f2235bb0a5cc7d0884f7dc7f3906c69875f314c3062ce9b618744eeede290
7
- data.tar.gz: 8ff8eab55eb0bf9a11be7c5ad709cf9b8f437b98649080c708b1924b09de752c38d255ec4e159545f4a36cdad999e73a615e67301293956441ab99edf8b67acd
6
+ metadata.gz: cc0d1557b038284fb34953722569b55cfd4541f172a099583d12b53eed299768664df54e032bc9ad7f1c7b379e069ccd2a9e1ad85a7c6bc9afa5087c03da986c
7
+ data.tar.gz: de013b518986f6a7fcb8a5e36541e33dfd574aabd662a71f506bf4099c9fc690aeeed6a07b36aee698cac464cf5070b603da1aca3fbe96d796ec59e907d4e5ae
@@ -1,3 +1,37 @@
1
+ # 2.2.0 (December 7, 2020)
2
+
3
+ ## Enhancements:
4
+
5
+ - New gem template: prefer `require_relative` to `require` [#4066](https://github.com/rubygems/rubygems/pull/4066)
6
+ - Always show underlying error when fetching specs fails [#4061](https://github.com/rubygems/rubygems/pull/4061)
7
+ - Add `--all-platforms` flag to `bundle binstubs` to generate binstubs for all platforms [#3886](https://github.com/rubygems/rubygems/pull/3886)
8
+ - Improve gem not found in source error messages [#4019](https://github.com/rubygems/rubygems/pull/4019)
9
+ - Revert resolving all Gemfile platforms automatically [#4052](https://github.com/rubygems/rubygems/pull/4052)
10
+ - Remove extra empty line from README template [#4041](https://github.com/rubygems/rubygems/pull/4041)
11
+ - Lazily load `erb` [#4011](https://github.com/rubygems/rubygems/pull/4011)
12
+
13
+ ## Bug fixes:
14
+
15
+ - Fix `Bundler::Plugin::API::Source#to_s` having empty source type [#4084](https://github.com/rubygems/rubygems/pull/4084)
16
+ - Raise consistent errors with or without `bundle exec` [#4063](https://github.com/rubygems/rubygems/pull/4063)
17
+ - Fix edge case resulting in a crash when using `zeitwerk` inside a nested `bundle exec` invocation [#4062](https://github.com/rubygems/rubygems/pull/4062)
18
+ - Enable `specific_platform` by default [#4015](https://github.com/rubygems/rubygems/pull/4015)
19
+ - Prevent remove command from deleting gemfile lines that are comments [#4045](https://github.com/rubygems/rubygems/pull/4045)
20
+ - Fix issue with `cache_all_platforms` and `specific_platform` configured [#4042](https://github.com/rubygems/rubygems/pull/4042)
21
+ - Fix incorrect error message on Windows [#4039](https://github.com/rubygems/rubygems/pull/4039)
22
+ - Make printed drive letters consistent on Windows [#4038](https://github.com/rubygems/rubygems/pull/4038)
23
+ - Load rubygems plugins from RUBYLIB during `bundle install` and `bundle update` [#3534](https://github.com/rubygems/rubygems/pull/3534)
24
+ - Fix `specific_platform` and `cache_all` with `bundle cache --all-platforms` [#4022](https://github.com/rubygems/rubygems/pull/4022)
25
+ - Bring back the possibility to install a plugin from path [#4020](https://github.com/rubygems/rubygems/pull/4020)
26
+ - Move ronn pages to lib [#3997](https://github.com/rubygems/rubygems/pull/3997)
27
+ - Fix fileutils double load when using `bundler/inline` [#3991](https://github.com/rubygems/rubygems/pull/3991)
28
+ - Accept responses with no etag header [#3865](https://github.com/rubygems/rubygems/pull/3865)
29
+
30
+ ## Documentation:
31
+
32
+ - Fix typo of `bundle-install.1` (v2.1) [#4079](https://github.com/rubygems/rubygems/pull/4079)
33
+ - Add commented out example and more information link to generated gemspec [#4034](https://github.com/rubygems/rubygems/pull/4034)
34
+
1
35
  # 2.2.0.rc.2 (October 6, 2020)
2
36
 
3
37
  ## Minor enhancements:
@@ -108,7 +142,7 @@
108
142
  - Fix `bundle install` unintentionally copying `with` and `without` global config to local configuration [#3666](https://github.com/rubygems/rubygems/pull/3666). This PR also address the `BUNDLE_WITH` environment variable unintentionally being persisted to configuration in a similar way ([#3708](https://github.com/rubygems/rubygems/issues/3708))
109
143
  - Fix race condition in `bundle install` that could "empty" exceptions to be raised [#3669](https://github.com/rubygems/rubygems/pull/3669)
110
144
  - Fix `--no-cache` to `bundle install` being unintentionally deprecated [#3688](https://github.com/rubygems/rubygems/pull/3688)
111
- - Avoid calling `LoadError#message` to fix performance regression in future ruby 2.8 [#3762](https://github.com/rubygems/rubygems/pull/3762)
145
+ - Avoid calling `LoadError#message` to fix performance regression in future ruby 3.0 [#3762](https://github.com/rubygems/rubygems/pull/3762)
112
146
 
113
147
  # 2.1.4 (January 5, 2020)
114
148
 
@@ -602,6 +602,10 @@ EOF
602
602
  reset_rubygems!
603
603
  end
604
604
 
605
+ def reset_settings!
606
+ @settings = nil
607
+ end
608
+
605
609
  def reset_paths!
606
610
  @bin_path = nil
607
611
  @bundler_major_version = nil
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2020-10-07".freeze
8
- @git_commit_sha = "d7c0467653".freeze
7
+ @built_at = "2020-12-10".freeze
8
+ @git_commit_sha = "d3628e5019".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -57,7 +57,7 @@ module Bundler
57
57
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
58
58
  if custom_gemfile && !custom_gemfile.empty?
59
59
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
60
- Bundler.reset_paths!
60
+ Bundler.reset_settings!
61
61
  end
62
62
 
63
63
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
@@ -134,7 +134,8 @@ module Bundler
134
134
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
135
135
  Kernel.exec "man #{man_page}"
136
136
  else
137
- puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.ronn")
137
+ fallback_man_path = File.expand_path("../man", __FILE__)
138
+ puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
138
139
  end
139
140
  elsif command_path = Bundler.which("bundler-#{cli}")
140
141
  Kernel.exec(command_path, "--help")
@@ -380,6 +381,8 @@ module Bundler
380
381
  "Make binstubs that can work without the Bundler runtime"
381
382
  method_option "all", :type => :boolean, :banner =>
382
383
  "Install binstubs for all gems"
384
+ method_option "all-platforms", :type => :boolean, :default => false, :banner =>
385
+ "Install binstubs for all platforms"
383
386
  def binstubs(*gems)
384
387
  require_relative "cli/binstubs"
385
388
  Binstubs.new(options, gems).run
@@ -16,7 +16,11 @@ module Bundler
16
16
  Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
17
17
  installer = Installer.new(Bundler.root, Bundler.definition)
18
18
 
19
- installer_opts = { :force => options[:force], :binstubs_cmd => true }
19
+ installer_opts = {
20
+ :force => options[:force],
21
+ :binstubs_cmd => true,
22
+ :all_platforms => options["all-platforms"],
23
+ }
20
24
 
21
25
  if options[:all]
22
26
  raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty?
@@ -38,7 +42,7 @@ module Bundler
38
42
  if options[:standalone]
39
43
  next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
40
44
  Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
41
- installer.generate_standalone_bundler_executable_stubs(spec)
45
+ installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
42
46
  end
43
47
  else
44
48
  installer.generate_bundler_executable_stubs(spec, installer_opts)
@@ -63,10 +63,10 @@ module Bundler
63
63
  Kernel.load(file)
64
64
  rescue SystemExit, SignalException
65
65
  raise
66
- rescue Exception => e # rubocop:disable Lint/RescueException
66
+ rescue Exception # rubocop:disable Lint/RescueException
67
67
  Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
68
- backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
69
- abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
68
+ Bundler::FriendlyErrors.disable!
69
+ raise
70
70
  end
71
71
 
72
72
  def process_title(file, args)
@@ -76,8 +76,6 @@ module Bundler
76
76
  next unless gems.empty? || gems.include?(current_spec.name)
77
77
 
78
78
  active_spec = retrieve_active_spec(definition, current_spec)
79
- next unless active_spec
80
-
81
79
  next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
82
80
 
83
81
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
@@ -146,8 +144,6 @@ module Bundler
146
144
  end
147
145
 
148
146
  def retrieve_active_spec(definition, current_spec)
149
- return unless current_spec.match_platform(Bundler.local_platform)
150
-
151
147
  if strict
152
148
  active_spec = definition.find_resolved_spec(current_spec)
153
149
  else
@@ -233,6 +229,8 @@ module Bundler
233
229
  end
234
230
 
235
231
  def update_present_via_semver_portions(current_spec, active_spec, options)
232
+ return false if active_spec.nil?
233
+
236
234
  current_major = current_spec.version.segments.first
237
235
  active_major = active_spec.version.segments.first
238
236
 
@@ -22,13 +22,13 @@ module Bundler
22
22
 
23
23
  def initialize(fetcher)
24
24
  @fetcher = fetcher
25
- require "tmpdir"
25
+ require_relative "../vendored_tmpdir"
26
26
  end
27
27
 
28
28
  def update(local_path, remote_path, retrying = nil)
29
29
  headers = {}
30
30
 
31
- Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
31
+ Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
32
32
  local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename)
33
33
 
34
34
  # first try to fetch any new bytes on the existing file
@@ -66,8 +66,8 @@ module Bundler
66
66
  end
67
67
  end
68
68
 
69
- response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
- if etag_for(local_temp_path) == response_etag
69
+ etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
70
+ if etag.length.zero? || etag_for(local_temp_path) == etag
71
71
  SharedHelpers.filesystem_access(local_path) do
72
72
  FileUtils.mv(local_temp_path, local_path)
73
73
  end
@@ -75,7 +75,7 @@ module Bundler
75
75
  end
76
76
 
77
77
  if retrying
78
- raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path))
78
+ raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path))
79
79
  end
80
80
 
81
81
  update(local_path, remote_path, :retrying)
@@ -118,7 +118,7 @@ module Bundler
118
118
  end
119
119
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
120
120
 
121
- add_platforms unless Bundler.frozen_bundle?
121
+ add_current_platform unless Bundler.frozen_bundle?
122
122
 
123
123
  converge_path_sources_to_gemspec_sources
124
124
  @path_changes = converge_paths
@@ -547,17 +547,12 @@ module Bundler
547
547
 
548
548
  private
549
549
 
550
- def add_platforms
551
- (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
552
- add_platform(platform)
553
- end
550
+ def add_current_platform
551
+ current_platforms.each {|platform| add_platform(platform) }
554
552
  end
555
553
 
556
554
  def current_platforms
557
- [].tap do |platforms|
558
- platforms << local_platform if Bundler.feature_flag.specific_platform?
559
- platforms << generic_local_platform
560
- end
555
+ [local_platform, generic_local_platform].uniq
561
556
  end
562
557
 
563
558
  def change_reason
@@ -105,7 +105,7 @@ module Bundler
105
105
  out << [" User Home", Gem.user_home]
106
106
  out << [" User Path", Gem.user_dir]
107
107
  out << [" Bin Dir", Gem.bindir]
108
- if defined?(OpenSSL)
108
+ if defined?(OpenSSL::SSL)
109
109
  out << ["OpenSSL"]
110
110
  out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
111
111
  out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
@@ -41,7 +41,6 @@ module Bundler
41
41
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
42
42
  settings_flag(:print_only_version_number) { bundler_3_mode? }
43
43
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
44
- settings_flag(:specific_platform) { bundler_3_mode? }
45
44
  settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
46
45
  settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
47
46
  settings_flag(:update_requires_all_flag) { bundler_4_mode? }
@@ -8,7 +8,7 @@ module Bundler
8
8
  class Index < Base
9
9
  def specs(_gem_names)
10
10
  Bundler.rubygems.fetch_all_remote_specs(remote)
11
- rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e
11
+ rescue Gem::RemoteFetcher::FetchError => e
12
12
  case e.message
13
13
  when /certificate verify failed/
14
14
  raise CertificateFailureError.new(display_uri)
@@ -19,8 +19,7 @@ module Bundler
19
19
  raise BadAuthenticationError, remote_uri if remote_uri.userinfo
20
20
  raise AuthenticationRequiredError, remote_uri
21
21
  else
22
- Bundler.ui.trace e
23
- raise HTTPError, "Could not fetch specs from #{display_uri}"
22
+ raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
24
23
  end
25
24
  end
26
25
 
@@ -6,6 +6,18 @@ module Bundler
6
6
  module FriendlyErrors
7
7
  module_function
8
8
 
9
+ def enable!
10
+ @disabled = false
11
+ end
12
+
13
+ def disabled?
14
+ @disabled
15
+ end
16
+
17
+ def disable!
18
+ @disabled = true
19
+ end
20
+
9
21
  def log_error(error)
10
22
  case error
11
23
  when YamlSyntaxError
@@ -114,10 +126,13 @@ module Bundler
114
126
  end
115
127
 
116
128
  def self.with_friendly_errors
129
+ FriendlyErrors.enable!
117
130
  yield
118
131
  rescue SignalException
119
132
  raise
120
133
  rescue Exception => e # rubocop:disable Lint/RescueException
134
+ raise if FriendlyErrors.disabled?
135
+
121
136
  FriendlyErrors.log_error(e)
122
137
  exit FriendlyErrors.exit_status(e)
123
138
  end
@@ -195,7 +195,11 @@ module Bundler
195
195
  if base # allow all platforms when searching from a lockfile
196
196
  dependency.matches_spec?(spec)
197
197
  else
198
- dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
198
+ if Gem::Platform.respond_to? :match_spec?
199
+ dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec)
200
+ else
201
+ dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
202
+ end
199
203
  end
200
204
  end
201
205
 
@@ -179,11 +179,11 @@ module Bundler
179
179
  # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
180
180
  def remove_gems_from_gemfile(gems, gemfile_path)
181
181
  patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
182
-
183
182
  new_gemfile = []
184
183
  multiline_removal = false
185
184
  IO.readlines(gemfile_path).each do |line|
186
- if line.match(patterns)
185
+ match_data = line.match(patterns)
186
+ if match_data && is_not_within_comment?(line, match_data)
187
187
  multiline_removal = line.rstrip.end_with?(",")
188
188
  # skip lines which match the regex
189
189
  next
@@ -207,6 +207,13 @@ module Bundler
207
207
  new_gemfile.join.chomp
208
208
  end
209
209
 
210
+ # @param [String] line Individual line of gemfile content.
211
+ # @param [MatchData] match_data Data about Regex match.
212
+ def is_not_within_comment?(line, match_data)
213
+ match_start_index = match_data.offset(0).first
214
+ !line[0..match_start_index].include?("#")
215
+ end
216
+
210
217
  # @param [Array] gemfile Array of gemfile contents.
211
218
  # @param [String] block_name Name of block name to look for.
212
219
  def remove_nested_blocks(gemfile, block_name)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "erb"
4
3
  require "rubygems/dependency_installer"
5
4
  require_relative "worker"
6
5
  require_relative "installer/parallel_installer"
@@ -136,6 +135,7 @@ module Bundler
136
135
  end
137
136
 
138
137
  mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
138
+ require "erb"
139
139
  content = if RUBY_VERSION >= "2.6"
140
140
  ERB.new(template, :trim_mode => "-").result(binding)
141
141
  else
@@ -143,7 +143,7 @@ module Bundler
143
143
  end
144
144
 
145
145
  File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
146
- if Bundler::WINDOWS
146
+ if Bundler::WINDOWS || options[:all_platforms]
147
147
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
148
148
  File.write("#{binstub_path}.cmd", prefix + content, :mode => mode)
149
149
  end
@@ -164,7 +164,7 @@ module Bundler
164
164
  end
165
165
  end
166
166
 
167
- def generate_standalone_bundler_executable_stubs(spec)
167
+ def generate_standalone_bundler_executable_stubs(spec, options = {})
168
168
  # double-assignment to avoid warnings about variables that will be used by ERB
169
169
  bin_path = Bundler.bin_path
170
170
  unless path = Bundler.settings[:path]
@@ -182,6 +182,7 @@ module Bundler
182
182
  executable_path = executable_path
183
183
 
184
184
  mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
185
+ require "erb"
185
186
  content = if RUBY_VERSION >= "2.6"
186
187
  ERB.new(template, :trim_mode => "-").result(binding)
187
188
  else
@@ -189,7 +190,7 @@ module Bundler
189
190
  end
190
191
 
191
192
  File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
192
- if Bundler::WINDOWS
193
+ if Bundler::WINDOWS || options[:all_platforms]
193
194
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
194
195
  File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode)
195
196
  end
@@ -243,6 +244,7 @@ module Bundler
243
244
  end
244
245
  end.flatten
245
246
  Bundler.rubygems.load_plugin_files(path_plugin_files)
247
+ Bundler.rubygems.load_env_plugins
246
248
  end
247
249
 
248
250
  def ensure_specs_are_compatible!
@@ -297,7 +299,7 @@ module Bundler
297
299
 
298
300
  # returns whether or not a re-resolve was needed
299
301
  def resolve_if_needed(options)
300
- if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
302
+ if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
301
303
  return false if @definition.nothing_changed? && !@definition.missing_specs?
302
304
  end
303
305
 
@@ -79,19 +79,17 @@ module Bundler
79
79
  @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
80
80
  source.gemspec.tap {|s| s.source = source }
81
81
  else
82
- search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
82
+ search_object = if source.is_a?(Source::Path)
83
+ Dependency.new(name, version)
84
+ else
85
+ self
86
+ end
83
87
  platform_object = Gem::Platform.new(platform)
84
88
  candidates = source.specs.search(search_object)
85
89
  same_platform_candidates = candidates.select do |spec|
86
90
  MatchPlatform.platforms_match?(spec.platform, platform_object)
87
91
  end
88
92
  search = same_platform_candidates.last || candidates.last
89
- if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
90
- Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
91
- "because it has different dependencies from the #{platform} version. " \
92
- "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again."
93
- search = source.specs.search(self).last
94
- end
95
93
  search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
96
94
  search
97
95
  end
@@ -0,0 +1 @@
1
+ # Ignore all files in this directory