# File lib/bundler/bundle.rb, line 70
    def install(options = {})
      dependencies = @environment.dependencies
      sources      = @environment.sources

      # ========== from env
      if only_envs = options[:only]
        dependencies.reject! { |d| !only_envs.any? {|env| d.in?(env) } }
      end
      # ==========

      # Check to see whether the existing cache meets all the requirements
      begin
        valid = nil
        # 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)
        download(bundle, options)
        do_install(bundle, options)
        valid = bundle
      end

      generate_bins(valid, options)
      cleanup(valid, options)
      configure(valid, options)

      Bundler.logger.info "Done."
    end