class Bundler::Fetcher

def user_agent

def user_agent
  @user_agent ||= begin
    ruby = Bundler::RubyVersion.system
    agent = String.new("bundler/#{Bundler::VERSION}")
    agent << " rubygems/#{Gem::VERSION}"
    agent << " ruby/#{ruby.versions_string(ruby.versions)}"
    agent << " (#{ruby.host})"
    agent << " command/#{ARGV.first}"
    if ruby.engine != "ruby"
      # engine_version raises on unknown engines
      engine_version = begin
                         ruby.engine_versions
                       rescue
                         "???"
                       end
      agent << " #{ruby.engine}/#{ruby.versions_string(engine_version)}"
    end
    agent << " options/#{Bundler.settings.all.join(",")}"
    agent << " ci/#{cis.join(",")}" if cis.any?
    # add a random ID so we can consolidate runs server-side
    agent << " " << SecureRandom.hex(8)
    # add any user agent strings set in the config
    extra_ua = Bundler.settings[:user_agent]
    agent << " " << extra_ua if extra_ua
    agent
  end
end