class Bundler::SpecSet

def for(dependencies, check = false, match_current_platform = false)

def for(dependencies, check = false, match_current_platform = false)
  handled = []
  deps = dependencies.dup
  specs = []
  loop do
    break unless dep = deps.shift
    next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
    handled << dep
    specs_for_dep = spec_for_dependency(dep, match_current_platform)
    if specs_for_dep.any?
      match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
      specs_for_dep.first.dependencies.each do |d|
        next if d.type == :development
        d = DepProxy.get_proxy(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 : specs
end