Class: Autoproj::RosPackageManifest::Loader Private
- Inherits:
-
PackageManifest::Loader
- Object
- PackageManifest::BaseLoader
- PackageManifest::Loader
- Autoproj::RosPackageManifest::Loader
- Defined in:
- lib/autoproj/ros_package_manifest.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
REXML stream parser object used to load the XML contents into a PackageManifest object
Constant Summary collapse
- MANIFEST_CLASS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
RosPackageManifest
- SUPPORTED_MODES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[test doc].freeze
- DEPEND_TAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[depend build_depend build_export_depend buildtool_depend buildtool_export_depend exec_depend test_depend run_depend doc_depend].to_set.freeze
Constants inherited from PackageManifest::Loader
PackageManifest::Loader::AUTHOR_FIELDS, PackageManifest::Loader::TEXT_FIELDS
Instance Attribute Summary
Attributes inherited from PackageManifest::Loader
Instance Method Summary collapse
- #author_tag_end(name) ⇒ Object private
- #depend_tag_end(name) ⇒ Object private
- #exportlevel_tag_end(name) ⇒ Object private
- #exportlevel_tag_start(name, attributes) ⇒ Object private
- #handle_condition(expr) ⇒ Object private
-
#initialize(path, manifest, condition_context: {}) ⇒ Loader
constructor
private
A new instance of Loader.
- #tag_end(name) ⇒ Object private
- #tag_start(name, attributes) ⇒ Object private
- #toplevel_tag_end(name) ⇒ Object private
- #toplevel_tag_start(name, attributes) ⇒ Object private
Methods inherited from PackageManifest::Loader
expand_configuration_variable, #parse_contact_field, #parse_depend_tag
Methods inherited from PackageManifest::BaseLoader
Constructor Details
#initialize(path, manifest, condition_context: {}) ⇒ Loader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Loader.
26 27 28 29 30 31 32 33 |
# File 'lib/autoproj/ros_package_manifest.rb', line 26 def initialize(path, manifest, condition_context: {}) super @condition_parser = RosConditionParser.new do |var| Autoproj.(var, condition_context) rescue StandardError "" end end |
Instance Method Details
#author_tag_end(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 106 107 108 109 |
# File 'lib/autoproj/ros_package_manifest.rb', line 103 def (name) = @tag_text.strip email = @author_email ? @author_email.strip : nil email = nil if email&.empty? contact = PackageManifest::ContactInfo.new(, email) manifest.send("#{name}s").concat([contact]) end |
#depend_tag_end(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/autoproj/ros_package_manifest.rb', line 87 def depend_tag_end(name) return unless handle_condition(@depend_condition) if @tag_text.strip.empty? raise InvalidPackageManifest, "found '#{name}' tag in #{path} "\ "without content" end mode = [] if (m = /^(\w+)_depend$/.match(name)) mode = SUPPORTED_MODES & [m[1]] end manifest.add_dependency(@tag_text, modes: mode) end |
#exportlevel_tag_end(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 59 60 61 |
# File 'lib/autoproj/ros_package_manifest.rb', line 56 def exportlevel_tag_end(name) return unless name == "build_type" return unless handle_condition(@build_type_condition) manifest.build_type = @tag_text.strip end |
#exportlevel_tag_start(name, attributes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 52 53 54 |
# File 'lib/autoproj/ros_package_manifest.rb', line 49 def exportlevel_tag_start(name, attributes) return unless name == "build_type" @build_type_condition = attributes["condition"] @tag_text = "" end |
#handle_condition(expr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 84 85 |
# File 'lib/autoproj/ros_package_manifest.rb', line 81 def handle_condition(expr) return true unless expr && !expr.empty? @condition_parser.evaluate(expr) end |
#tag_end(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 43 44 45 46 47 |
# File 'lib/autoproj/ros_package_manifest.rb', line 40 def tag_end(name) super exportlevel_tag_end(name) if @export_level if @tag_level == 0 && name == "package" && (!manifest.name || manifest.name.empty?) raise InvalidPackageManifest, "Package name missiing in #{path}" end end |
#tag_start(name, attributes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 |
# File 'lib/autoproj/ros_package_manifest.rb', line 35 def tag_start(name, attributes) super exportlevel_tag_start(name, attributes) if @export_level end |
#toplevel_tag_end(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/autoproj/ros_package_manifest.rb', line 111 def toplevel_tag_end(name) if DEPEND_TAGS.include?(name) depend_tag_end(name) elsif AUTHOR_FIELDS.include?(name) (name) elsif TEXT_FIELDS.include?(name) field = @tag_text.strip manifest.send("#{name}=", field) unless field.empty? elsif name == "name" manifest.name = @tag_text.strip elsif name == "export" @export_level = false end @tag_text = nil end |
#toplevel_tag_start(name, attributes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/autoproj/ros_package_manifest.rb', line 63 def toplevel_tag_start(name, attributes) if DEPEND_TAGS.include?(name) @depend_condition = attributes["condition"] @tag_text = "" elsif TEXT_FIELDS.include?(name) @tag_text = "" elsif AUTHOR_FIELDS.include?(name) @author_email = attributes["email"] @tag_text = "" elsif name == "name" @tag_text = "" elsif name == "export" @export_level = true else @tag_text = nil end end |