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
Source
# File lib/autoproj/package_manifest.rb, line 19 def self.load(package, file, ros_manifest: false, condition_context: nil) loader_class = ros_manifest ? RosPackageManifest::Loader : Loader parse(package, File.read(file), path: file, loader_class: loader_class, condition_context: condition_context) end
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
Source
# File lib/autoproj/package_manifest.rb, line 94 def initialize(package, path = nil, null: false) @package = package @path = path @dependencies = [] @authors = [] @maintainers = [] @rock_maintainers = [] @tags = [] @null = null end
Source
# File lib/autoproj/package_manifest.rb, line 7 def self.null(package) new(package, null: true) end
Create a null manifest for the given package
Source
# File lib/autoproj/package_manifest.rb, line 34 def self.parse( package, contents, path: "<loaded from string>", loader_class: Loader, condition_context: nil ) manifest = loader_class::MANIFEST_CLASS.new(package, path) loader = loader_class.new(path, manifest, condition_context: condition_context) begin REXML::Document.parse_stream(contents, loader) rescue REXML::ParseException => e raise Autobuild::PackageException.new(package.name, "prepare"), "invalid #{path}: #{e.message}" rescue Autoproj::ConfigError => e raise Autobuild::PackageException.new(package.name, "prepare"), "invalid #{path}: #{e.message}" end manifest 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
Public Instance Methods
Source
# File lib/autoproj/package_manifest.rb, line 72 def add_dependency(name, optional: false, modes: []) dependencies << Dependency.new(name, optional, modes) end
Add a declared dependency to this package
Source
# File lib/autoproj/package_manifest.rb, line 80 def documentation description || short_documentation end
Source
# File lib/autoproj/package_manifest.rb, line 111 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
Source
# File lib/autoproj/package_manifest.rb, line 141 def each_maintainer return enum_for(__method__) unless block_given? maintainers.each do |m| yield(m.name, m.email) end end
Source
# File lib/autoproj/package_manifest.rb, line 121 def each_os_dependency(modes = Array.new, &block) Autoproj.warn_deprecated "#{self.class}##{__method__}", "call #each_dependency instead" each_dependency(modes, &block) end
Source
# File lib/autoproj/package_manifest.rb, line 127 def each_package_dependency(modes = Array.new, &block) Autoproj.warn_deprecated "#{self.class}##{__method__}", "call #each_dependency instead" each_dependency(modes, &block) end
Source
# File lib/autoproj/package_manifest.rb, line 133 def each_rock_maintainer return enum_for(__method__) unless block_given? rock_maintainers.each do |m| yield(m.name, m.email) end end
Source
# File lib/autoproj/package_manifest.rb, line 76 def has_documentation? description end
Source
# File lib/autoproj/package_manifest.rb, line 84 def has_short_documentation? brief_description end
Source
# File lib/autoproj/package_manifest.rb, line 107 def null? @null end
Whether this is a null manifest (used for packages that have actually no manifest) or not
Source
# File lib/autoproj/package_manifest.rb, line 88 def short_documentation brief_description || "no documentation available for package '#{package.name}' "\ "in its manifest.xml file" end