bundler 2.2.1 → 2.2.6
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 +55 -2
- data/bundler.gemspec +1 -1
- data/lib/bundler.rb +3 -7
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +2 -5
- data/lib/bundler/cli/gem.rb +2 -0
- data/lib/bundler/cli/install.rb +14 -5
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/compact_index_client/cache.rb +5 -13
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +0 -8
- data/lib/bundler/definition.rb +28 -21
- data/lib/bundler/dep_proxy.rb +15 -8
- data/lib/bundler/gem_helper.rb +3 -3
- data/lib/bundler/gem_helpers.rb +30 -24
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/lazy_specification.rb +10 -11
- data/{man → lib/bundler/man}/bundle-add.1 +0 -0
- data/{man → lib/bundler/man}/bundle-binstubs.1 +0 -0
- data/{man → lib/bundler/man}/bundle-cache.1 +0 -0
- data/{man → lib/bundler/man}/bundle-check.1 +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1 +0 -0
- data/{man → lib/bundler/man}/bundle-config.1 +0 -0
- data/{man → lib/bundler/man}/bundle-doctor.1 +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +0 -0
- data/{man → lib/bundler/man}/bundle-gem.1 +0 -0
- data/{man → lib/bundler/man}/bundle-info.1 +0 -0
- data/{man → lib/bundler/man}/bundle-init.1 +0 -0
- data/{man → lib/bundler/man}/bundle-inject.1 +0 -0
- data/{man → lib/bundler/man}/bundle-install.1 +0 -0
- data/{man → lib/bundler/man}/bundle-list.1 +0 -0
- data/{man → lib/bundler/man}/bundle-lock.1 +0 -0
- data/{man → lib/bundler/man}/bundle-open.1 +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1 +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1 +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1 +0 -0
- data/{man → lib/bundler/man}/bundle-show.1 +0 -0
- data/{man → lib/bundler/man}/bundle-update.1 +0 -0
- data/{man → lib/bundler/man}/bundle-viz.1 +0 -0
- data/{man → lib/bundler/man}/bundle.1 +0 -0
- data/{man → lib/bundler/man}/gemfile.5 +0 -0
- data/{man → lib/bundler/man}/index.txt +0 -0
- data/lib/bundler/resolver.rb +10 -3
- data/lib/bundler/resolver/spec_group.rb +17 -19
- data/lib/bundler/rubygems_ext.rb +16 -0
- data/lib/bundler/rubygems_integration.rb +0 -5
- data/lib/bundler/source/git.rb +18 -16
- data/lib/bundler/source/git/git_proxy.rb +54 -49
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/rubygems.rb +10 -1
- data/lib/bundler/spec_set.rb +6 -9
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +10 -6
- data/lib/bundler/version.rb +1 -1
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d650c1a28dea3c6991577a9083a22c1ca1efda7a2eec47d0df598f85830bdadd
|
4
|
+
data.tar.gz: 39210bbab39a367d483951a86ae63074b13551c477545bb77c61f6a567a99953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68a691b5c9a1d46782fef62ebccd13a591db6cf8581ccf1dd652cda62a13f5a537ba4bea07623f475067281d1a7f8f0121888c7693b361dfc7c7b03f9c4c124e
|
7
|
+
data.tar.gz: 7cf159707678831e78eaa3ccda37e2433762d39e154b3b42dd3e23531d8caf234eb48b633595aa2b43fe213899fd30691735b1cbd3942afe88bb4ab2d9d39991
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1
|
+
# 2.2.6 (January 18, 2021)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Improve resolver debugging [#4288](https://github.com/rubygems/rubygems/pull/4288)
|
6
|
+
|
7
|
+
## Bug fixes:
|
8
|
+
|
9
|
+
- Fix dependency locking for path source [#4293](https://github.com/rubygems/rubygems/pull/4293)
|
10
|
+
|
11
|
+
## Performance:
|
12
|
+
|
13
|
+
- Speed up complex dependency resolves by creating DepProxy factory and cache [#4216](https://github.com/rubygems/rubygems/pull/4216)
|
14
|
+
|
15
|
+
# 2.2.5 (January 11, 2021)
|
16
|
+
|
17
|
+
## Enhancements:
|
18
|
+
|
19
|
+
- Improve rubocop setup in the new gem template [#4220](https://github.com/rubygems/rubygems/pull/4220)
|
20
|
+
- Support repositories with default branch not named master [#4224](https://github.com/rubygems/rubygems/pull/4224)
|
21
|
+
|
22
|
+
## Bug fixes:
|
23
|
+
|
24
|
+
- Let Net::HTTP decompress the index instead of doing it manually [#4081](https://github.com/rubygems/rubygems/pull/4081)
|
25
|
+
- Workaround for another jruby crash when autoloading a constant [#4252](https://github.com/rubygems/rubygems/pull/4252)
|
26
|
+
- Fix another performance regression in the resolver [#4243](https://github.com/rubygems/rubygems/pull/4243)
|
27
|
+
- Restore support for old git versions [#4233](https://github.com/rubygems/rubygems/pull/4233)
|
28
|
+
- Give a proper error if cache path does not have write access [#4215](https://github.com/rubygems/rubygems/pull/4215)
|
29
|
+
- Fix running `rake release` from an ambiguous ref [#4219](https://github.com/rubygems/rubygems/pull/4219)
|
30
|
+
|
31
|
+
# 2.2.4 (December 31, 2020)
|
32
|
+
|
33
|
+
## Bug fixes:
|
34
|
+
|
35
|
+
- Fix bundle man pages display on truffleruby [#4209](https://github.com/rubygems/rubygems/pull/4209)
|
36
|
+
- Fix Windows + JRuby no longer being able to install git sources [#4196](https://github.com/rubygems/rubygems/pull/4196)
|
37
|
+
|
38
|
+
# 2.2.3 (December 22, 2020)
|
39
|
+
|
40
|
+
## Bug fixes:
|
41
|
+
|
42
|
+
- Restore full compatibility with previous lockfiles [#4179](https://github.com/rubygems/rubygems/pull/4179)
|
43
|
+
- Add all matching variants with the same platform specificity to the lockfile [#4180](https://github.com/rubygems/rubygems/pull/4180)
|
44
|
+
- Fix bundler installing gems for a different platform when running in frozen mode and current platform not in the lockfile [#4172](https://github.com/rubygems/rubygems/pull/4172)
|
45
|
+
- Fix crash when `bundle exec`'ing to bundler [#4175](https://github.com/rubygems/rubygems/pull/4175)
|
46
|
+
|
47
|
+
# 2.2.2 (December 17, 2020)
|
48
|
+
|
49
|
+
## Bug fixes:
|
50
|
+
|
51
|
+
- Fix resolver crash when a candidate has 0 matching platforms [#4163](https://github.com/rubygems/rubygems/pull/4163)
|
52
|
+
- Restore change to copy global with/without config locally upon `bundle install` [#4154](https://github.com/rubygems/rubygems/pull/4154)
|
53
|
+
|
1
54
|
# 2.2.1 (December 14, 2020)
|
2
55
|
|
3
56
|
## Bug fixes:
|
@@ -304,7 +357,7 @@
|
|
304
357
|
- Fix `bundle update` message about exclude groups saying "installed" instead of "updated" ([#7150](https://github.com/rubygems/bundler/pull/7150))
|
305
358
|
- Fix `bundle licenses` not showing correct information about bundler itself ([#7147](https://github.com/rubygems/bundler/pull/7147))
|
306
359
|
- Fix installation path not including ruby scope when `BUNDLE_PATH` was set ([#7163](https://github.com/rubygems/bundler/pull/7163))
|
307
|
-
- Fix `bundle clean` incorrectly removing git
|
360
|
+
- Fix `bundle clean` incorrectly removing git dependencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/rubygems/bundler/pull/7211))
|
308
361
|
- Fix platform specific gems always being re-resolved when bundler was not running under that platform ([#7212](https://github.com/rubygems/bundler/pull/7212))
|
309
362
|
- Fix `bundle package --all-platforms` causing `bundle install` to ignore `--with` and `--without` ([#6113](https://github.com/rubygems/bundler/pull/6113))
|
310
363
|
- Fix `MissingRevision` git errors to include the specific `git` command that failed under the hood ([#7225](https://github.com/rubygems/bundler/pull/7225))
|
@@ -476,7 +529,7 @@ Changes
|
|
476
529
|
## Bug fixes:
|
477
530
|
|
478
531
|
- Fix issue where updating a gem resulted in the gem's version being downgraded when `BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS` was set ([#6529](https://github.com/rubygems/bundler/issues/6529), @theflow)
|
479
|
-
- Fix some rescue calls that don't
|
532
|
+
- Fix some rescue calls that don't specify error type (@utilum)
|
480
533
|
- Fix an issue when the Lockfile would contain platform-specific gems that it didn't need ([#6491](https://github.com/rubygems/bundler/issues/6491), @segiddins)
|
481
534
|
- Improve handling of adding new gems with only a single group to the Gemfile in `bundle add` (@agrim123)
|
482
535
|
- Refactor check for OpenSSL in `bundle env` (@voxik)
|
data/bundler.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.required_ruby_version = ">= 2.3.0"
|
35
35
|
s.required_rubygems_version = ">= 2.5.2"
|
36
36
|
|
37
|
-
s.files = Dir.glob("{lib,
|
37
|
+
s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
|
38
38
|
|
39
39
|
# Include the CHANGELOG.md, LICENSE.md, README.md manually
|
40
40
|
s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
data/lib/bundler.rb
CHANGED
@@ -63,7 +63,6 @@ module Bundler
|
|
63
63
|
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
|
64
64
|
autoload :Retry, File.expand_path("bundler/retry", __dir__)
|
65
65
|
autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
|
66
|
-
autoload :RubyGemsGemInstaller, File.expand_path("bundler/rubygems_gem_installer", __dir__)
|
67
66
|
autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
|
68
67
|
autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
|
69
68
|
autoload :Settings, File.expand_path("bundler/settings", __dir__)
|
@@ -212,13 +211,10 @@ module Bundler
|
|
212
211
|
end
|
213
212
|
end
|
214
213
|
|
215
|
-
def
|
216
|
-
return
|
214
|
+
def most_specific_locked_platform?(platform)
|
215
|
+
return false unless defined?(@definition) && @definition
|
217
216
|
|
218
|
-
|
219
|
-
return nil unless locked_gems
|
220
|
-
|
221
|
-
locked_gems.bundler_version
|
217
|
+
definition.most_specific_locked_platform == platform
|
222
218
|
end
|
223
219
|
|
224
220
|
def ruby_scope
|
@@ -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 = "
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-01-19".freeze
|
8
|
+
@git_commit_sha = "e95bea3837".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli.rb
CHANGED
@@ -122,9 +122,7 @@ module Bundler
|
|
122
122
|
else command = "bundle-#{cli}"
|
123
123
|
end
|
124
124
|
|
125
|
-
man_path = File.expand_path("
|
126
|
-
# man files are located under ruby's mandir with the default gems of bundler
|
127
|
-
man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
|
125
|
+
man_path = File.expand_path("man", __dir__)
|
128
126
|
man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
|
129
127
|
[File.basename(f, ".*"), f]
|
130
128
|
end]
|
@@ -134,8 +132,7 @@ module Bundler
|
|
134
132
|
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
|
135
133
|
Kernel.exec "man #{man_page}"
|
136
134
|
else
|
137
|
-
|
138
|
-
puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
|
135
|
+
puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
|
139
136
|
end
|
140
137
|
elsif command_path = Bundler.which("bundler-#{cli}")
|
141
138
|
Kernel.exec(command_path, "--help")
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -59,6 +59,7 @@ module Bundler
|
|
59
59
|
:exe => options[:exe],
|
60
60
|
:bundler_version => bundler_dependency_version,
|
61
61
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
62
|
+
:required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
|
62
63
|
}
|
63
64
|
ensure_safe_gem_name(name, constant_array)
|
64
65
|
|
@@ -147,6 +148,7 @@ module Bundler
|
|
147
148
|
"For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
|
148
149
|
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
149
150
|
config[:rubocop] = true
|
151
|
+
config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
|
150
152
|
Bundler.ui.info "RuboCop enabled in config"
|
151
153
|
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
152
154
|
end
|
data/lib/bundler/cli/install.rb
CHANGED
@@ -152,18 +152,27 @@ module Bundler
|
|
152
152
|
|
153
153
|
check_for_group_conflicts_in_cli_options
|
154
154
|
|
155
|
+
Bundler.settings.set_command_option :with, nil if options[:with] == []
|
156
|
+
Bundler.settings.set_command_option :without, nil if options[:without] == []
|
157
|
+
|
155
158
|
with = options.fetch(:with, [])
|
156
159
|
with |= Bundler.settings[:with].map(&:to_s)
|
157
160
|
with -= options[:without] if options[:without]
|
158
|
-
with = nil if options[:with] == []
|
159
161
|
|
160
162
|
without = options.fetch(:without, [])
|
161
163
|
without |= Bundler.settings[:without].map(&:to_s)
|
162
164
|
without -= options[:with] if options[:with]
|
163
|
-
without = nil if options[:without] == []
|
164
165
|
|
165
|
-
|
166
|
-
|
166
|
+
options[:with] = with
|
167
|
+
options[:without] = without
|
168
|
+
|
169
|
+
unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
|
170
|
+
# need to nil them out first to get around validation for backwards compatibility
|
171
|
+
Bundler.settings.set_command_option :without, nil
|
172
|
+
Bundler.settings.set_command_option :with, nil
|
173
|
+
Bundler.settings.set_command_option :without, options[:without] - options[:with]
|
174
|
+
Bundler.settings.set_command_option :with, options[:with]
|
175
|
+
end
|
167
176
|
end
|
168
177
|
|
169
178
|
def normalize_settings
|
@@ -190,7 +199,7 @@ module Bundler
|
|
190
199
|
|
191
200
|
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
192
201
|
|
193
|
-
normalize_groups
|
202
|
+
normalize_groups
|
194
203
|
|
195
204
|
options[:force] = options[:redownload]
|
196
205
|
end
|
data/lib/bundler/cli/update.rb
CHANGED
@@ -82,7 +82,7 @@ module Bundler
|
|
82
82
|
locked_spec = locked_info[:spec]
|
83
83
|
new_spec = Bundler.definition.specs[name].first
|
84
84
|
unless new_spec
|
85
|
-
|
85
|
+
unless locked_spec.match_platform(Bundler.local_platform)
|
86
86
|
Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
|
87
87
|
end
|
88
88
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "gem_parser"
|
4
|
+
|
3
5
|
module Bundler
|
4
6
|
class CompactIndexClient
|
5
7
|
class Cache
|
@@ -92,19 +94,9 @@ module Bundler
|
|
92
94
|
header ? lines[header + 1..-1] : lines
|
93
95
|
end
|
94
96
|
|
95
|
-
def parse_gem(
|
96
|
-
|
97
|
-
|
98
|
-
dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
|
99
|
-
dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
|
100
|
-
requirements = requirements ? requirements.map {|r| parse_dependency(r) } : []
|
101
|
-
[version, platform, dependencies, requirements]
|
102
|
-
end
|
103
|
-
|
104
|
-
def parse_dependency(string)
|
105
|
-
dependency = string.split(":")
|
106
|
-
dependency[-1] = dependency[-1].split("&") if dependency.size > 1
|
107
|
-
dependency
|
97
|
+
def parse_gem(line)
|
98
|
+
@dependency_parser ||= GemParser.new
|
99
|
+
@dependency_parser.parse(line)
|
108
100
|
end
|
109
101
|
|
110
102
|
def info_roots
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class CompactIndexClient
|
5
|
+
if defined?(Gem::Resolver::APISet::GemParser)
|
6
|
+
GemParser = Gem::Resolver::APISet::GemParser
|
7
|
+
else
|
8
|
+
class GemParser
|
9
|
+
def parse(line)
|
10
|
+
version_and_platform, rest = line.split(" ", 2)
|
11
|
+
version, platform = version_and_platform.split("-", 2)
|
12
|
+
dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
|
13
|
+
dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
|
14
|
+
requirements = requirements ? requirements.map {|d| parse_dependency(d) } : []
|
15
|
+
[version, platform, dependencies, requirements]
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def parse_dependency(string)
|
21
|
+
dependency = string.split(":")
|
22
|
+
dependency[-1] = dependency[-1].split("&") if dependency.size > 1
|
23
|
+
dependency
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../vendored_fileutils"
|
4
|
-
require "stringio"
|
5
|
-
require "zlib"
|
6
4
|
|
7
5
|
module Bundler
|
8
6
|
class CompactIndexClient
|
@@ -45,18 +43,12 @@ module Bundler
|
|
45
43
|
else
|
46
44
|
"bytes=#{local_temp_path.size}-"
|
47
45
|
end
|
48
|
-
else
|
49
|
-
# Fastly ignores Range when Accept-Encoding: gzip is set
|
50
|
-
headers["Accept-Encoding"] = "gzip"
|
51
46
|
end
|
52
47
|
|
53
48
|
response = @fetcher.call(remote_path, headers)
|
54
49
|
return nil if response.is_a?(Net::HTTPNotModified)
|
55
50
|
|
56
51
|
content = response.body
|
57
|
-
if response["Content-Encoding"] == "gzip"
|
58
|
-
content = Zlib::GzipReader.new(StringIO.new(content)).read
|
59
|
-
end
|
60
52
|
|
61
53
|
SharedHelpers.filesystem_access(local_temp_path) do
|
62
54
|
if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
|
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
|
-
add_current_platform unless Bundler.frozen_bundle?
|
121
|
+
add_current_platform unless current_ruby_platform_locked? || Bundler.frozen_bundle?
|
122
122
|
|
123
123
|
converge_path_sources_to_gemspec_sources
|
124
124
|
@path_changes = converge_paths
|
@@ -157,7 +157,7 @@ module Bundler
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def resolve_remotely!
|
160
|
-
|
160
|
+
return if @specs
|
161
161
|
@remote = true
|
162
162
|
sources.remote!
|
163
163
|
specs
|
@@ -269,9 +269,8 @@ module Bundler
|
|
269
269
|
else
|
270
270
|
# Run a resolve against the locally available gems
|
271
271
|
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
272
|
-
|
273
|
-
|
274
|
-
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms_for_resolve)
|
272
|
+
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
|
273
|
+
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
275
274
|
end
|
276
275
|
|
277
276
|
# filter out gems that _can_ be installed on multiple platforms, but don't need
|
@@ -507,15 +506,11 @@ module Bundler
|
|
507
506
|
end
|
508
507
|
|
509
508
|
def validate_platforms!
|
510
|
-
return if
|
511
|
-
Bundler.rubygems.platforms.any? do |local_platform|
|
512
|
-
MatchPlatform.platforms_match?(bundle_platform, local_platform)
|
513
|
-
end
|
514
|
-
end
|
509
|
+
return if current_platform_locked?
|
515
510
|
|
516
511
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
517
|
-
"but your local
|
518
|
-
"
|
512
|
+
"but your local platform is #{Bundler.local_platform}. " \
|
513
|
+
"Add the current platform to the lockfile with `bundle lock --add-platform #{Bundler.local_platform}` and try again."
|
519
514
|
end
|
520
515
|
|
521
516
|
def add_platform(platform)
|
@@ -528,6 +523,12 @@ module Bundler
|
|
528
523
|
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
529
524
|
end
|
530
525
|
|
526
|
+
def most_specific_locked_platform
|
527
|
+
@platforms.min_by do |bundle_platform|
|
528
|
+
platform_specificity_match(bundle_platform, local_platform)
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
531
532
|
def find_resolved_spec(current_spec)
|
532
533
|
specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
533
534
|
end
|
@@ -549,6 +550,18 @@ module Bundler
|
|
549
550
|
|
550
551
|
private
|
551
552
|
|
553
|
+
def current_ruby_platform_locked?
|
554
|
+
return false unless generic_local_platform == Gem::Platform::RUBY
|
555
|
+
|
556
|
+
current_platform_locked?
|
557
|
+
end
|
558
|
+
|
559
|
+
def current_platform_locked?
|
560
|
+
@platforms.any? do |bundle_platform|
|
561
|
+
MatchPlatform.platforms_match?(bundle_platform, Bundler.local_platform)
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
552
565
|
def add_current_platform
|
553
566
|
add_platform(local_platform)
|
554
567
|
end
|
@@ -805,11 +818,6 @@ module Bundler
|
|
805
818
|
# commonly happens if the version changed in the gemspec
|
806
819
|
next unless new_spec
|
807
820
|
|
808
|
-
new_runtime_deps = new_spec.dependencies.select {|d| d.type != :development }
|
809
|
-
old_runtime_deps = s.dependencies.select {|d| d.type != :development }
|
810
|
-
# If the dependencies of the path source have changed and locked spec can't satisfy new dependencies, unlock it
|
811
|
-
next unless new_runtime_deps.sort == old_runtime_deps.sort || new_runtime_deps.all? {|d| satisfies_locked_spec?(d) }
|
812
|
-
|
813
821
|
s.dependencies.replace(new_spec.dependencies)
|
814
822
|
end
|
815
823
|
|
@@ -871,8 +879,7 @@ module Bundler
|
|
871
879
|
end
|
872
880
|
end
|
873
881
|
|
874
|
-
def expand_dependencies(dependencies, remote = false
|
875
|
-
platforms ||= @platforms
|
882
|
+
def expand_dependencies(dependencies, remote = false)
|
876
883
|
deps = []
|
877
884
|
dependencies.each do |dep|
|
878
885
|
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
|
@@ -885,7 +892,7 @@ module Bundler
|
|
885
892
|
|
886
893
|
def expand_dependency_with_platforms(dep, platforms)
|
887
894
|
platforms.map do |p|
|
888
|
-
DepProxy.
|
895
|
+
DepProxy.get_proxy(dep, p)
|
889
896
|
end
|
890
897
|
end
|
891
898
|
|
@@ -965,7 +972,7 @@ module Bundler
|
|
965
972
|
next requirements if @locked_gems.dependencies[name] != dependency
|
966
973
|
next requirements if dependency.source.is_a?(Source::Path)
|
967
974
|
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
|
968
|
-
requirements[name] = DepProxy.
|
975
|
+
requirements[name] = DepProxy.get_proxy(dep, locked_spec.platform)
|
969
976
|
requirements
|
970
977
|
end.values
|
971
978
|
end
|
data/lib/bundler/dep_proxy.rb
CHANGED
@@ -4,19 +4,18 @@ module Bundler
|
|
4
4
|
class DepProxy
|
5
5
|
attr_reader :__platform, :dep
|
6
6
|
|
7
|
+
@proxies = {}
|
8
|
+
|
9
|
+
def self.get_proxy(dep, platform)
|
10
|
+
@proxies[[dep, platform]] ||= new(dep, platform).freeze
|
11
|
+
end
|
12
|
+
|
7
13
|
def initialize(dep, platform)
|
8
14
|
@dep = dep
|
9
15
|
@__platform = platform
|
10
16
|
end
|
11
17
|
|
12
|
-
|
13
|
-
@hash ||= [dep, __platform].hash
|
14
|
-
end
|
15
|
-
|
16
|
-
def ==(other)
|
17
|
-
return false if other.class != self.class
|
18
|
-
dep == other.dep && __platform == other.__platform
|
19
|
-
end
|
18
|
+
private_class_method :new
|
20
19
|
|
21
20
|
alias_method :eql?, :==
|
22
21
|
|
@@ -39,6 +38,14 @@ module Bundler
|
|
39
38
|
s
|
40
39
|
end
|
41
40
|
|
41
|
+
def dup
|
42
|
+
raise NoMethodError.new("DepProxy cannot be duplicated")
|
43
|
+
end
|
44
|
+
|
45
|
+
def clone
|
46
|
+
raise NoMethodError.new("DepProxy cannot be cloned")
|
47
|
+
end
|
48
|
+
|
42
49
|
private
|
43
50
|
|
44
51
|
def method_missing(*args, &blk)
|