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.



189
190
191
# File 'lib/yumrepo.rb', line 189

def initialize(xml)
  @xml = xml
end

Instance Method Details

#descriptionObject



205
206
207
# File 'lib/yumrepo.rb', line 205

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

#docObject



193
194
195
# File 'lib/yumrepo.rb', line 193

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

#groupObject



229
230
231
# File 'lib/yumrepo.rb', line 229

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

#licenseObject



237
238
239
# File 'lib/yumrepo.rb', line 237

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

#locationObject



213
214
215
# File 'lib/yumrepo.rb', line 213

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

#nameObject



197
198
199
# File 'lib/yumrepo.rb', line 197

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

#providesObject



241
242
243
244
245
246
247
# File 'lib/yumrepo.rb', line 241

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



221
222
223
# File 'lib/yumrepo.rb', line 221

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

#requiresObject



249
250
251
252
253
254
255
# File 'lib/yumrepo.rb', line 249

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



225
226
227
# File 'lib/yumrepo.rb', line 225

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

#summaryObject



201
202
203
# File 'lib/yumrepo.rb', line 201

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

#urlObject



209
210
211
# File 'lib/yumrepo.rb', line 209

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

#vendorObject



233
234
235
# File 'lib/yumrepo.rb', line 233

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

#versionObject



217
218
219
# File 'lib/yumrepo.rb', line 217

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