Skip to content

Commit

Permalink
Refactor expand_dependencies logic
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Sep 1, 2020
1 parent e6629e6 commit 743b2d7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bundler/lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,19 @@ def expand_dependencies(dependencies, remote = false)
dependencies.each do |dep|
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
next unless remote || dep.current_platform?
dep.gem_platforms(Resolver.sort_platforms(@platforms)).each do |p|
deps << DepProxy.new(dep, p) if remote || p == generic_local_platform
end
target_platforms = dep.gem_platforms(Resolver.sort_platforms(@platforms))
target_platforms &= [generic_local_platform] unless remote
deps += expand_dependency_with_platforms(dep, target_platforms)
end
deps
end

def expand_dependency_with_platforms(dep, platforms)
platforms.map do |p|
DepProxy.new(dep, p)
end
end

def dependencies_for(groups)
current_dependencies.reject do |d|
(d.groups & groups).empty?
Expand Down

0 comments on commit 743b2d7

Please sign in to comment.