class Autoproj::PackageManifest

Access to the information contained in a package’s manifest.xml file

Use PackageManifest.load to create

Constants

ContactInfo
Dependency

Attributes

authors[RW]
brief_description[RW]
dependencies[R]
description[RW]
license[RW]
maintainers[RW]
package[RW]

The Autobuild::Package instance this manifest applies on

path[R]
rock_maintainers[RW]
tags[RW]
url[RW]
version[RW]

Public Class Methods

load(package, file, ros_manifest: false) click to toggle source

Load a manifest.xml file and returns the corresponding PackageManifest object

@param [PackageDescription] the package we’re loading it for @param [String] file the path to the manifest.xml file @param [Boolean] ros_manifest whether the file follows the ROS format @return [PackageManifest] @see parse

# File lib/autoproj/package_manifest.rb, line 19
def self.load(package, file, ros_manifest: false)
    loader_class = ros_manifest ? RosPackageManifest::Loader : Loader
    parse(package, File.read(file), path: file, loader_class: loader_class)
end
new(package, path = nil, null: false) click to toggle source
# File lib/autoproj/package_manifest.rb, line 86
def initialize(package, path = nil, null: false)
    @package = package
    @path = path
    @dependencies = []
    @authors = []
    @maintainers = []
    @rock_maintainers = []
    @tags = []
    @null = null
end
null(package) click to toggle source

Create a null manifest for the given package

# File lib/autoproj/package_manifest.rb, line 7
def self.null(package)
    new(package, null: true)
end
parse(package, contents, path: "<loaded from string>", loader_class: Loader) click to toggle source

Create a PackageManifest object from the XML content provided as a string

@param [PackageDescription] the package we’re loading it for @param [String] contents the manifest.xml contents as a string @param [String] path the file path, used for error reporting @param [Boolean] ros_manifest whether the file follows the ROS format @return [PackageManifest] @see load

# File lib/autoproj/package_manifest.rb, line 33
def self.parse(package, contents,
    path: "<loaded from string>", loader_class: Loader)
    manifest = loader_class::MANIFEST_CLASS.new(package, path)
    loader = loader_class.new(path, manifest)
    begin
        REXML::Document.parse_stream(contents, loader)
    rescue REXML::ParseException => e
        raise Autobuild::PackageException.new(package.name, "prepare"),
              "invalid #{file}: #{e.message}"
    end
    manifest
end

Public Instance Methods

add_dependency(name, optional: false, modes: []) click to toggle source

Add a declared dependency to this package

# File lib/autoproj/package_manifest.rb, line 64
def add_dependency(name, optional: false, modes: [])
    dependencies << Dependency.new(name, optional, modes)
end
documentation() click to toggle source
# File lib/autoproj/package_manifest.rb, line 72
def documentation
    description || short_documentation
end
each_author() { |name, email| ... } click to toggle source

Enumerates the name and email of each author. If no email is present, yields (name, nil)

# File lib/autoproj/package_manifest.rb, line 143
def each_author
    return enum_for(__method__) unless block_given?

    authors.each do |m|
        yield(m.name, m.email)
    end
end
each_dependency(in_modes = []) { |name, optional| ... } click to toggle source
# File lib/autoproj/package_manifest.rb, line 103
def each_dependency(in_modes = [])
    return enum_for(__method__, in_modes) unless block_given?

    dependencies.each do |dep|
        if dep.modes.empty? || in_modes.any? { |m| dep.modes.include?(m) }
            yield(dep.name, dep.optional)
        end
    end
end
each_maintainer() { |name, email| ... } click to toggle source
# File lib/autoproj/package_manifest.rb, line 133
def each_maintainer
    return enum_for(__method__) unless block_given?

    maintainers.each do |m|
        yield(m.name, m.email)
    end
end
each_os_dependency(modes = Array.new, &block) click to toggle source
# File lib/autoproj/package_manifest.rb, line 113
def each_os_dependency(modes = Array.new, &block)
    Autoproj.warn_deprecated "#{self.class}##{__method__}",
                             "call #each_dependency instead"
    each_dependency(modes, &block)
end
each_package_dependency(modes = Array.new, &block) click to toggle source
# File lib/autoproj/package_manifest.rb, line 119
def each_package_dependency(modes = Array.new, &block)
    Autoproj.warn_deprecated "#{self.class}##{__method__}",
                             "call #each_dependency instead"
    each_dependency(modes, &block)
end
each_rock_maintainer() { |name, email| ... } click to toggle source
# File lib/autoproj/package_manifest.rb, line 125
def each_rock_maintainer
    return enum_for(__method__) unless block_given?

    rock_maintainers.each do |m|
        yield(m.name, m.email)
    end
end
has_documentation?() click to toggle source
# File lib/autoproj/package_manifest.rb, line 68
def has_documentation?
    description
end
has_short_documentation?() click to toggle source
# File lib/autoproj/package_manifest.rb, line 76
def has_short_documentation?
    brief_description
end
null?() click to toggle source

Whether this is a null manifest (used for packages that have actually no manifest) or not

# File lib/autoproj/package_manifest.rb, line 99
def null?
    @null
end
short_documentation() click to toggle source
# File lib/autoproj/package_manifest.rb, line 80
def short_documentation
    brief_description ||
        "no documentation available for package '#{package.name}' "\
        "in its manifest.xml file"
end