Class: YumRepo::PackageChangelog

Inherits:
Object
  • Object
show all
Defined in:
lib/yumrepo.rb

Constant Summary collapse

@@version_regex_std =
/(^|\:|\s+|v|r|V|R)(([0-9]+\.){1,10}[a-zA-Z0-9\-]+)/
@@version_regex_odd =
/(([a-zA-Z0-9\-]+)\-[a-zA-Z0-9\-]{1,10})/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ PackageChangelog

Returns a new instance of PackageChangelog.



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/yumrepo.rb', line 297

def initialize(xml)
  doc = Nokogiri::XML(xml)
  doc.remove_namespaces!
  @name = doc.xpath('/package/@name').text.strip
  @arch = doc.xpath('/package/@arch').text.strip
  @current_version = doc.xpath('/package/version/@ver').text.strip
  @current_release = doc.xpath('/package/version/@rel').text.strip

  @releases = doc.xpath('/package/changelog').map do |pr|
    {
      :author => pr.at_xpath('./@author').text.strip,
      :version => _get_version_string(pr.at_xpath('./@author').text),
      :date => Time.at(pr.at_xpath('./@date').text.strip.to_i),
      :summary => pr.text.sub(/^- /, '')
    }
  end
end

Instance Attribute Details

#archObject (readonly)

Returns the value of attribute arch.



292
293
294
# File 'lib/yumrepo.rb', line 292

def arch
  @arch
end

#current_releaseObject (readonly)

Returns the value of attribute current_release.



292
293
294
# File 'lib/yumrepo.rb', line 292

def current_release
  @current_release
end

#current_versionObject (readonly)

Returns the value of attribute current_version.



292
293
294
# File 'lib/yumrepo.rb', line 292

def current_version
  @current_version
end

#nameObject (readonly)

Returns the value of attribute name.



292
293
294
# File 'lib/yumrepo.rb', line 292

def name
  @name
end

Instance Method Details

#allObject



321
322
323
# File 'lib/yumrepo.rb', line 321

def all
  @releases
end

#eachObject



315
316
317
318
319
# File 'lib/yumrepo.rb', line 315

def each
  all.each do |r|
    yield r
  end
end