Class: YumRepo::Package

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Package

Returns a new instance of Package.



227
228
229
# File 'lib/yumrepo.rb', line 227

def initialize(xml)
  @xml = xml
end

Instance Method Details

#descriptionObject



243
244
245
# File 'lib/yumrepo.rb', line 243

def description
  doc.xpath('/xmlns:package/xmlns:description').text.strip
end

#docObject



231
232
233
# File 'lib/yumrepo.rb', line 231

def doc
  @doc ||= Nokogiri::XML(@xml)
end

#groupObject



267
268
269
# File 'lib/yumrepo.rb', line 267

def group
  doc.xpath('/xmlns:package/xmlns:format/rpm:group').text.strip
end

#licenseObject



275
276
277
# File 'lib/yumrepo.rb', line 275

def license
  doc.xpath('/xmlns:package/xmlns:format/rpm:license').text.strip
end

#locationObject



251
252
253
# File 'lib/yumrepo.rb', line 251

def location
  doc.xpath('/xmlns:package/xmlns:location/@href').text.strip
end

#nameObject



235
236
237
# File 'lib/yumrepo.rb', line 235

def name
  doc.xpath('/xmlns:package/xmlns:name').text.strip
end

#providesObject



279
280
281
282
283
284
285
# File 'lib/yumrepo.rb', line 279

def provides
  doc.xpath('/xmlns:package/xmlns:format/rpm:provides/rpm:entry').map do |pr|
    {
      :name => pr.at_xpath('./@name').text.strip
    }
  end
end

#releaseObject



259
260
261
# File 'lib/yumrepo.rb', line 259

def release
  doc.xpath('/xmlns:package/xmlns:version/@rel').text.strip
end

#requiresObject



287
288
289
290
291
292
293
# File 'lib/yumrepo.rb', line 287

def requires
  doc.xpath('/xmlns:package/xmlns:format/rpm:requires/rpm:entry').map do |pr|
    {
      :name => pr.at_xpath('./@name').text.strip
    }
  end
end

#src_rpmObject



263
264
265
# File 'lib/yumrepo.rb', line 263

def src_rpm
  doc.xpath('/xmlns:package/xmlns:format/rpm:sourcerpm').text.strip
end

#summaryObject



239
240
241
# File 'lib/yumrepo.rb', line 239

def summary
  doc.xpath('/xmlns:package/xmlns:summary').text.strip
end

#urlObject



247
248
249
# File 'lib/yumrepo.rb', line 247

def url
  doc.xpath('/xmlns:package/xmlns:url').text.strip
end

#vendorObject



271
272
273
# File 'lib/yumrepo.rb', line 271

def vendor
  doc.xpath('/xmlns:package/xmlns:format/rpm:vendor').text.strip
end

#versionObject



255
256
257
# File 'lib/yumrepo.rb', line 255

def version
  doc.xpath('/xmlns:package/xmlns:version/@ver').text.strip
end