class Autoproj::PackageManifest
Access to the information contained in a package’s manifest.xml file
Use PackageManifest.load
to create
Constants
- ContactInfo
- Dependency
Attributes
The Autobuild::Package instance this manifest applies on
Public Class Methods
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
# 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
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
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 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
# File lib/autoproj/package_manifest.rb, line 72 def documentation description || short_documentation end
# 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
# 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
# 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
# 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
# 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
# File lib/autoproj/package_manifest.rb, line 68 def has_documentation? description end
# File lib/autoproj/package_manifest.rb, line 76 def has_short_documentation? brief_description end
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
# 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