Sha256: 51d305af3b6cae43541f902c926d8a957a1a630f01c8f965dcd827898d302248
Contents?: true
Size: 963 Bytes
Versions: 4
Compression:
Stored size: 963 Bytes
Contents
# LinuxAdmin Deb Representation # # Copyright (C) 2013 Red Hat Inc. # Licensed under the MIT License class LinuxAdmin class Deb < Package APT_CACHE_CMD = '/usr/bin/apt-cache' def self.from_line(apt_cache_line, in_description=false) tag,value = apt_cache_line.split(':') tag = tag.strip.downcase [tag, value] end def self.from_string(apt_cache_string) in_description = false apt_cache_string.split("\n").each.with_object({}) do |line,deb| tag,value = self.from_line(line) if tag == 'description-en' in_description = true elsif tag == 'homepage' in_description = false end if in_description && tag != 'description-en' deb['description-en'] << line else deb[tag] = value.strip end end end def self.info(pkg) self.from_string(run!(APT_CACHE_CMD, :params => ["show", pkg]).output) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
linux_admin-0.9.4 | lib/linux_admin/deb.rb |
linux_admin-0.9.3 | lib/linux_admin/deb.rb |
linux_admin-0.9.2 | lib/linux_admin/deb.rb |
linux_admin-0.9.1 | lib/linux_admin/deb.rb |