class YARD::CLI::Diff

def load_gem_data(gemfile)

def load_gem_data(gemfile)
  require_rubygems
  Registry.clear
  # First check for argument as .yardoc file
  [File.join(gemfile, '.yardoc'), gemfile].each do |yardoc|
    log.info "Searching for .yardoc db at #{yardoc}"
    next unless File.directory?(yardoc)
    Registry.load_yardoc(yardoc)
    Registry.load_all
    return true
  end
  # Next check installed RubyGems
  gemfile_without_ext = gemfile.sub(/\.gem$/, '')
  log.info "Searching for installed gem #{gemfile_without_ext}"
  YARD::GemIndex.each.find do |spec|
    next unless spec.full_name == gemfile_without_ext
    yardoc = Registry.yardoc_file_for_gem(spec.name, "= #{spec.version}")
    if yardoc
      Registry.load_yardoc(yardoc)
      Registry.load_all
    else
      log.enter_level(Logger::ERROR) do
        olddir = Dir.pwd
        Gems.run(spec.name, spec.version.to_s)
        Dir.chdir(olddir)
      end
    end
    return true
  end
  # Look for local .gem file
  gemfile += '.gem' unless gemfile =~ /\.gem$/
  log.info "Searching for local gem file #{gemfile}"
  if File.exist?(gemfile)
    File.open(gemfile, 'rb') do |io|
      expand_and_parse(gemfile, io)
    end
    return true
  end
  # Remote gemfile from rubygems.org
  url = "http://rubygems.org/downloads/#{gemfile}"
  log.info "Searching for remote gem file #{url}"
  begin
    # Note: In Ruby 2.4.x, URI.open is a private method. After
    # 2.5, URI.open behaves much like Kernel#open once you've
    # required 'open-uri'
    OpenURI.open_uri(url) {|io| expand_and_parse(gemfile, io) }
    return true
  rescue OpenURI::HTTPError
    nil # noop
  end
  false
end