class Autoproj::PackageManifest::Loader
@api private
REXML stream parser object used to load the XML contents into a {PackageManifest} object
Constants
- AUTHOR_FIELDS
- MANIFEST_CLASS
Access to the information contained in a package’s manifest.xml file
Use
PackageManifest.load
to create- TEXT_FIELDS
Attributes
manifest[R]
path[R]
Public Class Methods
new(path, manifest)
click to toggle source
Calls superclass method
Autoproj::PackageManifest::BaseLoader::new
# File lib/autoproj/package_manifest.rb, line 184 def initialize(path, manifest) super() @path = path @manifest = manifest end
Public Instance Methods
parse_contact_field(text)
click to toggle source
# File lib/autoproj/package_manifest.rb, line 209 def parse_contact_field(text) text.strip.split(",").map do |str| name, email = str.split("/").map(&:strip) email = nil if email&.empty? ContactInfo.new(name, email) end end
parse_depend_tag(tag_name, attributes, modes: [], optional: false)
click to toggle source
# File lib/autoproj/package_manifest.rb, line 190 def parse_depend_tag(tag_name, attributes, modes: [], optional: false) package = attributes["package"] || attributes["name"] unless package raise InvalidPackageManifest, "found '#{tag_name}' tag in #{path} "\ "without a 'package' attribute" end if (tag_modes = attributes["modes"]) modes += tag_modes.split(",") end manifest.add_dependency( package, optional: optional || (attributes["optional"] == "1"), modes: modes ) end
toplevel_tag_end(name)
click to toggle source
# File lib/autoproj/package_manifest.rb, line 243 def toplevel_tag_end(name) if AUTHOR_FIELDS.include?(name) manifest.send("#{name}s").concat(parse_contact_field(@tag_text)) elsif TEXT_FIELDS.include?(name) field = @tag_text.strip manifest.send("#{name}=", field) unless field.empty? elsif name == "tags" manifest.tags.concat(@tag_text.strip.split(",").map(&:strip)) end @tag_text = nil end
toplevel_tag_start(name, attributes)
click to toggle source
# File lib/autoproj/package_manifest.rb, line 220 def toplevel_tag_start(name, attributes) if name == "depend" parse_depend_tag(name, attributes) elsif name == "depend_optional" parse_depend_tag(name, attributes, optional: true) elsif name == "rosdep" parse_depend_tag(name, attributes) elsif name =~ /^(\w+)_depend$/ parse_depend_tag(name, attributes, modes: [$1]) elsif name == "description" if (brief = attributes["brief"]) manifest.brief_description = brief end @tag_text = "" elsif TEXT_FIELDS.include?(name) || AUTHOR_FIELDS.include?(name) @tag_text = "" elsif name == "tags" @tag_text = "" else @tag_text = nil end end