class YARD::CLI::Config

def configure_gemrc

def configure_gemrc
  return unless gem_install_cmd
  require 'rubygems'
  ['install', :install, 'gem', :gem].find do |cmd|
    conf = Gem.configuration[cmd] || ""
    next if conf.empty? && cmd != :gem
    conf = conf.split(/\s+/)
    conf.delete_if {|c| c =~ /^--(no-)?document\b/ } # scrub doc args
    conf |= ["--document=#{gem_install_cmd}"]
    conf = conf.join(' ')
    Gem.configuration[cmd] = conf
    Gem.configuration.write
    log.puts "Updated #{Gem.configuration.path || '~/.gemrc'}: '#{cmd}: #{conf}'"
    true
  end
end