Class: EnhanceRepo::RpmMd::Update
- Inherits:
-
Object
- Object
- EnhanceRepo::RpmMd::Update
- Includes:
- UpdateSmartFields
- Defined in:
- lib/enhance_repo/rpm_md/update.rb
Overview
represents one update, which can consist of various packages and references
Instance Method Summary collapse
- #append_to_builder(builder) ⇒ Object
-
#empty? ⇒ Boolean
an update is not empty if it updates something.
-
#initialize ⇒ Update
constructor
A new instance of Update.
- #suggested_filename ⇒ Object
-
#write(file) ⇒ Object
write a update out.
Methods included from UpdateSmartFields
#each_detected_reference, #each_reference_for, #smart_fill_blank_fields
Constructor Details
#initialize ⇒ Update
Returns a new instance of Update.
91 92 |
# File 'lib/enhance_repo/rpm_md/update.rb', line 91 def initialize end |
Instance Method Details
#append_to_builder(builder) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/enhance_repo/rpm_md/update.rb', line 111 def append_to_builder(builder) builder.update('status' => 'stable', 'from' => from, 'version' => version, 'type' => type) do |b| b.title(title) b.id(updateid) b.issued(issued) b.release(release) b.description(description) # serialize attr_reader :eferences b.references do |b| references.each do |r| b.reference('href' => r.href, 'id' => r.referenceid, 'title' => r.title, 'type' => r.type ) end end # done with references b.pkglist do |b| b.collection do |b| packages.each do |pkg| b.package('name' => pkg.name, 'arch'=> pkg.arch, 'version'=>pkg.version.v, 'release'=>pkg.version.r) do |b| b.filename(File.basename(pkg.path)) end end end # </collection> end #</pkglist> # done with the packagelist end end |
#empty? ⇒ Boolean
an update is not empty if it updates something
96 97 98 |
# File 'lib/enhance_repo/rpm_md/update.rb', line 96 def empty? packages.empty? end |
#suggested_filename ⇒ Object
100 101 102 |
# File 'lib/enhance_repo/rpm_md/update.rb', line 100 def suggested_filename "update-#{updateid}-#{version}" end |
#write(file) ⇒ Object
write a update out
106 107 108 109 |
# File 'lib/enhance_repo/rpm_md/update.rb', line 106 def write(file) builder = Builder::XmlMarkup.new(:target=>file, :indent=>2) append_to_builder(builder) end |