Class: EnhanceRepo::RpmMd::SuseInfo
- Defined in:
- lib/enhance_repo/rpm_md/suse_info.rb
Overview
represents SUSE extensions to repository metadata (not associated with packages)
See: en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29
Instance Attribute Summary collapse
-
#expire ⇒ Object
expiration time the generated value is still calculated from repomd.xml resources.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#products ⇒ Object
Returns the value of attribute products.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(dir) ⇒ SuseInfo
constructor
A new instance of SuseInfo.
- #write(file) ⇒ Object
Methods inherited from Data
#metadata_filename, #name, #should_compress?
Methods included from Logger
Constructor Details
#initialize(dir) ⇒ SuseInfo
Returns a new instance of SuseInfo.
48 49 50 51 52 53 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 48 def initialize(dir) @dir = dir @expire = nil @keywords = Set.new @products = Set.new end |
Instance Attribute Details
#expire ⇒ Object
expiration time the generated value is still calculated from repomd.xml resources
44 45 46 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 44 def expire @expire end |
#keywords ⇒ Object
Returns the value of attribute keywords.
46 47 48 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 46 def keywords @keywords end |
#products ⇒ Object
Returns the value of attribute products.
45 46 47 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 45 def products @products end |
Instance Method Details
#empty? ⇒ Boolean
55 56 57 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 55 def empty? @expire.nil? && @products.empty? && @keywords.empty? end |
#write(file) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/enhance_repo/rpm_md/suse_info.rb', line 59 def write(file) builder = Builder::XmlMarkup.new(target: file, indent: 2) builder.instruct! builder.suseinfo do # add expire tag b.expire(@expire.to_i.to_s) unless @expire.nil? unless @keywords.empty? b.keywords do @keywords.each do |k| b.k(k) end end end unless @products.empty? b.products do @products.each do |p| b.id(p) end end end end end |