Class: Plat4m::Sniffer::Windows::Pacman

Inherits:
PkgManager
  • Object
show all
Defined in:
lib/plat4m/sniff/windows.rb

Instance Method Summary collapse

Methods inherited from PkgManager

#has_sudo?, #is_root?, #select_available, #select_uninstalled, #uninstall

Constructor Details

#initialize(_distro) ⇒ Pacman

Returns a new instance of Pacman.



59
60
61
# File 'lib/plat4m/sniff/windows.rb', line 59

def initialize(_distro)
  super()
end

Instance Method Details

#available?(pkg) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/plat4m/sniff/windows.rb', line 79

def available?(pkg)
  run(%Q[pacman -Ss '^#{pkg}$'], silent: true)
end

#install(*pkgs, silent: false) ⇒ Object



67
68
69
# File 'lib/plat4m/sniff/windows.rb', line 67

def install(*pkgs, silent: false)
  run(make_install_command, silent: silent)
end

#installed?(pkg) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/plat4m/sniff/windows.rb', line 75

def installed?(pkg)
  run("pacman -Qq #{pkg}", silent: true)
end

#make_install_command(*pkgs) ⇒ Object



63
64
65
# File 'lib/plat4m/sniff/windows.rb', line 63

def make_install_command(*pkgs)
  pacman_cmd("-S --needed #{ pkgs.join(' ') }")
end

#make_uninstall_command(*pkgs) ⇒ Object



71
72
73
# File 'lib/plat4m/sniff/windows.rb', line 71

def make_uninstall_command(*pkgs)
  pacman_cmd("-Rsu #{pkgs.flatten.join(' ')}")
end