Sha256: bdfa7da0c64d0d926130ba438066de1cfa81e441c1d6b8144629ad574e7a969c

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

require 'xezat'

module Xezat
  def packages(db_path = '/etc/setup/installed.db')
    Xezat.logger.debug("Collect installed packages from #{db_path}")
    raise ArgumentError, "#{db_path} not found" unless File.exist?(db_path)

    packages = {}
    File.read(db_path).lines do |line|
      record = line.split(/\s+/)
      next unless record.size == 3 # /^hoge hoge-ver-rel.tar.bz2 0$/

      packages[record[0].intern] = record[1].gsub(/\.tar\.bz2$/, '')
    end
    packages
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xezat-0.2.0 lib/xezat/packages.rb
xezat-0.1.2 lib/xezat/packages.rb