# File lib/fpm/package/gem.rb, line 116
  def load_package_info(gem_path)

    spec = YAML.load(%x{#{attributes[:gem_gem]} specification #{gem_path} --yaml})

    if !attributes[:gem_package_prefix].nil?
      attributes[:gem_package_name_prefix] = attributes[:gem_package_prefix]
    end

    # name prefixing is optional, if enabled, a name 'foo' will become
    # 'rubygem-foo' (depending on what the gem_package_name_prefix is)
    self.name = spec.name
    if attributes[:gem_fix_name?]
      self.name = fix_name(spec.name)
    end

    #self.name = [attributes[:gem_package_name_prefix], spec.name].join("-")
    self.license = (spec.license or "no license listed in #{File.basename(gem_path)}")

    # expand spec's version to match RationalVersioningPolicy to prevent cases
    # where missing 'build' number prevents correct dependency resolution by target
    # package manager. Ie. for dpkg 1.1 != 1.1.0
    m = spec.version.to_s.scan(/(\d+)\.?/)
    self.version = m.flatten.fill('0', m.length..2).join('.')

    self.vendor = spec.author
    self.url = spec.homepage
    self.category = "Languages/Development/Ruby"

    # if the gemspec has C extensions defined, then this should be a 'native' arch.
    if !spec.extensions.empty?
      self.architecture = "native"
    else
      self.architecture = "all"
    end

    # make sure we have a description
    description_options = [ spec.description, spec.summary, "#{spec.name} - no description given" ]
    self.description = description_options.find { |d| !(d.nil? or d.strip.empty?) }

    # Upstream rpms seem to do this, might as well share.
    # TODO(sissel): Figure out how to hint this only to rpm?
    # maybe something like attributes[:rpm_provides] for rpm specific stuff?
    # Or just ignore it all together.
    #self.provides << "rubygem(#{self.name})"

    # By default, we'll usually automatically provide this, but in the case that we are
    # composing multiple packages, it's best to explicitly include it in the provides list.
    self.provides << "#{self.name} = #{self.version}"

    if !attributes[:no_auto_depends?] && !attributes[:gem_embed_dependencies?]
      spec.runtime_dependencies.map do |dep|
        # rubygems 1.3.5 doesn't have 'Gem::Dependency#requirement'
        if dep.respond_to?(:requirement)
          reqs = dep.requirement.to_s
        else
          reqs = dep.version_requirements
        end

        # Some reqs can be ">= a, < b" versions, let's handle that.
        reqs.to_s.split(/, */).each do |req|
          if attributes[:gem_disable_dependencies]
            next if attributes[:gem_disable_dependencies].include?(dep.name)
          end

          if attributes[:gem_fix_dependencies?]
            name = fix_name(dep.name)
          else
            name = dep.name
          end
          self.dependencies << "#{name} #{req}"
        end
      end # runtime_dependencies
    end #no_auto_depends
  end