summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-01-05 10:49:50 +0900
committerSutou Kouhei <kou@clear-code.com>2020-01-15 06:27:03 +0900
commitfe2e99711f10103f674c7a074ae093aba51a4128 (patch)
tree294c7192c32dba38c1c7431beb50356983aca62a /lib
parent2a374012d4d977905b01fb0d789375e274d1be13 (diff)
downloadbundler-fe2e99711f10103f674c7a074ae093aba51a4128.tar.gz
Add support for force_ruby_platform with specific_platform again
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/definition.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index a5780d3b2a..3e5186039a 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -82,7 +82,11 @@ module Bundler
@lockfile_contents = Bundler.read_file(lockfile)
@locked_gems = LockfileParser.new(@lockfile_contents)
@locked_platforms = @locked_gems.platforms
- @platforms = @locked_platforms.dup
+ if Bundler.settings[:force_ruby_platform]
+ @platforms = [Gem::Platform::RUBY]
+ else
+ @platforms = @locked_platforms.dup
+ end
@locked_bundler_version = @locked_gems.bundler_version
@locked_ruby_version = @locked_gems.ruby_version
@@ -228,12 +232,13 @@ module Bundler
end
def current_dependencies
- dependencies.select(&:should_include?)
+ dependencies.select do |d|
+ d.should_include? && !d.gem_platforms(@platforms).empty?
+ end
end
def specs_for(groups)
- deps = dependencies.select {|d| (d.groups & groups).any? }
- deps.delete_if {|d| !d.should_include? }
+ deps = dependencies_for(groups)
specs.for(expand_dependencies(deps))
end
@@ -904,10 +909,16 @@ module Bundler
deps
end
+ def dependencies_for(groups)
+ current_dependencies.reject do |d|
+ (d.groups & groups).empty?
+ end
+ end
+
def requested_dependencies
groups = requested_groups
groups.map!(&:to_sym)
- dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? }
+ dependencies_for(groups)
end
def source_requirements