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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -1
- data/lib/bundler.rb +4 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +5 -2
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/exec.rb +3 -3
- data/lib/bundler/cli/outdated.rb +2 -4
- data/lib/bundler/compact_index_client/updater.rb +5 -5
- data/lib/bundler/definition.rb +4 -9
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher/index.rb +2 -3
- data/lib/bundler/friendly_errors.rb +15 -0
- data/lib/bundler/index.rb +5 -1
- data/lib/bundler/injector.rb +9 -2
- data/lib/bundler/installer.rb +7 -5
- data/lib/bundler/lazy_specification.rb +5 -7
- data/lib/bundler/man/.document +1 -0
- data/{man → lib/bundler/man}/bundle-add.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-binstubs.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-cache.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-check.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-config.1.ronn +1 -9
- data/{man → lib/bundler/man}/bundle-doctor.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-gem.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-info.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-init.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-inject.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-install.1.ronn +1 -1
- data/{man → lib/bundler/man}/bundle-list.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-lock.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-open.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-show.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-update.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle-viz.1.ronn +0 -0
- data/{man → lib/bundler/man}/bundle.1.ronn +0 -0
- data/{man → lib/bundler/man}/gemfile.5.ronn +0 -0
- data/lib/bundler/plugin/api/source.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/resolver.rb +2 -3
- data/lib/bundler/rubygems_integration.rb +4 -0
- data/lib/bundler/settings.rb +0 -1
- data/lib/bundler/source/git/git_proxy.rb +1 -1
- data/lib/bundler/spec_set.rb +1 -0
- data/lib/bundler/templates/newgem/README.md.tt +0 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -0
- data/lib/bundler/uri_credentials_filter.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +34 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +38 -40
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +4 -7
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-add.1 +1 -1
- data/man/bundle-binstubs.1 +1 -1
- data/man/bundle-cache.1 +1 -1
- data/man/bundle-check.1 +1 -1
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-config.1 +2 -5
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-exec.1 +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-info.1 +1 -1
- data/man/bundle-init.1 +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-install.1 +2 -2
- data/man/bundle-list.1 +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-open.1 +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-update.1 +1 -1
- data/man/bundle-viz.1 +1 -1
- data/man/bundle.1 +1 -1
- data/man/gemfile.5 +1 -1
- data/man/index.txt +25 -0
- metadata +35 -32
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0af01fdf441e83df2f02f7e0028ca485d12bb37986101861fa498f0768763708
|
4
|
+
data.tar.gz: 319299292a4a3b6e295e8d28bd6c9c7f2f478d686ff6ea733f31271c4f574512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0d1557b038284fb34953722569b55cfd4541f172a099583d12b53eed299768664df54e032bc9ad7f1c7b379e069ccd2a9e1ad85a7c6bc9afa5087c03da986c
|
7
|
+
data.tar.gz: de013b518986f6a7fcb8a5e36541e33dfd574aabd662a71f506bf4099c9fc690aeeed6a07b36aee698cac464cf5070b603da1aca3fbe96d796ec59e907d4e5ae
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
|
data/lib/bundler.rb
CHANGED
@@ -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
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2020-12-10".freeze
|
8
|
+
@git_commit_sha = "d3628e5019".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli.rb
CHANGED
@@ -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.
|
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
|
-
|
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
|
data/lib/bundler/cli/binstubs.rb
CHANGED
@@ -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 = {
|
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)
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -63,10 +63,10 @@ module Bundler
|
|
63
63
|
Kernel.load(file)
|
64
64
|
rescue SystemExit, SignalException
|
65
65
|
raise
|
66
|
-
rescue Exception
|
66
|
+
rescue Exception # rubocop:disable Lint/RescueException
|
67
67
|
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
|
68
|
-
|
69
|
-
|
68
|
+
Bundler::FriendlyErrors.disable!
|
69
|
+
raise
|
70
70
|
end
|
71
71
|
|
72
72
|
def process_title(file, args)
|
data/lib/bundler/cli/outdated.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
70
|
-
if etag_for(local_temp_path) ==
|
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,
|
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)
|
data/lib/bundler/definition.rb
CHANGED
@@ -118,7 +118,7 @@ module Bundler
|
|
118
118
|
end
|
119
119
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
120
120
|
|
121
|
-
|
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
|
551
|
-
|
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
|
-
[].
|
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
|
data/lib/bundler/env.rb
CHANGED
@@ -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)
|
data/lib/bundler/feature_flag.rb
CHANGED
@@ -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
|
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
|
-
|
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
|
data/lib/bundler/index.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/bundler/injector.rb
CHANGED
@@ -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
|
-
|
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)
|
data/lib/bundler/installer.rb
CHANGED
@@ -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"] && !
|
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 =
|
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
|
File without changes
|