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
self.name = spec.name
if attributes[:gem_fix_name?]
self.name = fix_name(spec.name)
end
self.license = (spec.license or "no license listed in #{File.basename(gem_path)}")
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 !spec.extensions.empty?
self.architecture = "native"
else
self.architecture = "all"
end
description_options = [ spec.description, spec.summary, "#{spec.name} - no description given" ]
self.description = description_options.find { |d| !(d.nil? or d.strip.empty?) }
self.provides << "#{self.name} = #{self.version}"
if !attributes[:no_auto_depends?]
spec.runtime_dependencies.map do |dep|
if dep.respond_to?(:requirement)
reqs = dep.requirement.to_s
else
reqs = dep.version_requirements
end
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
end
end