Sha256: db4f38ae5b846321897939d96ab3c3e54833470ad73b569cb40ae53f8306199b

Contents?: true

Size: 591 Bytes

Versions: 6

Compression:

Stored size: 591 Bytes

Contents

Ohai.plugin(:Pacman) do
  provides 'pacman'

  def from_cmd(cmd)
    so = shell_out(cmd)
    so.stdout.lines
  end

  def extract_dependencies(pkg)
    pkg_infos = from_cmd("pacman -Qi #{pkg}")
    infos = pkg_infos.stdout.lines
    infos.each do |info|
      info.slice! /Depends On\s+:/ if info.include? "Depends On"
    end
    info
  end

  collect_data(:default) do
    pacman Mash.new
    pkgs = from_cmd('pacman -Q')

    pkgs.each do |pkg|
      name, version = pkg.split
      pacman[name] = {
        "version" => version,
        "dependecies" => info,
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cupper-0.2.1 lib/cupper/plugins/ohai/pacman.rb
cupper-0.2.0 lib/cupper/plugins/ohai/pacman.rb
cupper-0.1.3 lib/cupper/plugins/ohai/pacman.rb
cupper-0.1.2 lib/cupper/plugins/ohai/pacman.rb
cupper-0.1.1 lib/cupper/plugins/ohai/pacman.rb
cupper-0.1.0 lib/cupper/plugins/ohai/pacman.rb