def for(dependencies, skip = [], check = false, match_current_platform = false)
handled, deps, specs = {}, dependencies.dup, []
skip << 'bundler'
until deps.empty?
dep = deps.shift
next if handled[dep] || skip.include?(dep.name)
spec = lookup[dep.name].find do |s|
match_current_platform ?
Gem::Platform.match(s.platform) :
s.match_platform(dep.__platform)
end
handled[dep] = true
if spec
specs << spec
spec.dependencies.each do |d|
next if d.type == :development
d = DepProxy.new(d, dep.__platform) unless match_current_platform
deps << d
end
elsif check
return false
end
end
if spec = lookup['bundler'].first
specs << spec
end
check ? true : SpecSet.new(specs)
end