Sha256: e9b68eef50659ffac3bf48346e40cf00c3a8b69b17a62d4a54834f1688ac48c5

Contents?: true

Size: 521 Bytes

Versions: 5

Compression:

Stored size: 521 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

5 entries across 5 versions & 1 rubygems

Version Path
xezat-0.3.1 lib/xezat/packages.rb
xezat-0.3.0 lib/xezat/packages.rb
xezat-0.2.3 lib/xezat/packages.rb
xezat-0.2.2 lib/xezat/packages.rb
xezat-0.2.1 lib/xezat/packages.rb