class Bundler::Repository

def install(dependencies, sources, options = {})

def install(dependencies, sources, options = {})
  # TODO: clean this up
  sources.each do |s|
    s.repository = self
    s.local = options[:cached]
  end
  source_requirements = {}
  options[:no_bundle].each do |name|
    source_requirements[name] = SystemGemSource.instance
  end
  # Check to see whether the existing cache meets all the requirements
  begin
    valid = Resolver.resolve(dependencies, [source_index], source_requirements)
  rescue Bundler::GemNotFound
  end
  sources = only_local(sources) if options[:cached]
  # Check the remote sources if the existing cache does not meet the requirements
  # or the user passed --update
  if options[:update] || !valid
    Bundler.logger.info "Calculating dependencies..."
    bundle = Resolver.resolve(dependencies, [@cache] + sources, source_requirements)
    download(bundle, options)
    do_install(bundle, options)
    valid = bundle
  end
  generate_bins(valid, options)
  cleanup(valid, options)
  configure(valid, options)
end