Class: Plat4m::PkgManager
- Inherits:
-
Object
- Object
- Plat4m::PkgManager
show all
- Defined in:
- lib/plat4m/pkgman.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PkgManager.
12
13
14
|
# File 'lib/plat4m/pkgman.rb', line 12
def initialize
@has_sudo = false
end
|
Instance Method Details
#available?(pkg) ⇒ Boolean
24
25
26
|
# File 'lib/plat4m/pkgman.rb', line 24
def available?(pkg)
raise NoMethodError
end
|
#has_sudo? ⇒ Boolean
54
55
56
|
# File 'lib/plat4m/pkgman.rb', line 54
def has_sudo?
@has_sudo
end
|
#install(*pkgs, silent: false) ⇒ Object
36
37
38
39
|
# File 'lib/plat4m/pkgman.rb', line 36
def install(*pkgs, silent: false)
cmd = make_install_command
silent ? system("#{cmd} >/dev/null 2>&1") : system(cmd)
end
|
#installed?(pkg) ⇒ Boolean
16
17
18
|
# File 'lib/plat4m/pkgman.rb', line 16
def installed?(pkg)
raise NoMethodError
end
|
#is_root? ⇒ Boolean
50
51
52
|
# File 'lib/plat4m/pkgman.rb', line 50
def is_root?
false
end
|
#make_install_command(*pkgs) ⇒ Object
32
33
34
|
# File 'lib/plat4m/pkgman.rb', line 32
def make_install_command(*pkgs)
raise NoMethodError
end
|
#make_uninstall_command(*pkgs) ⇒ Object
41
42
43
|
# File 'lib/plat4m/pkgman.rb', line 41
def make_uninstall_command(*pkgs)
raise NoMethodError
end
|
#select_available(*pkgs) ⇒ Object
28
29
30
|
# File 'lib/plat4m/pkgman.rb', line 28
def select_available(*pkgs)
pkgs.flatten.select { |pkg| available?(pkg) }
end
|
#select_uninstalled(*pkgs) ⇒ Object
20
21
22
|
# File 'lib/plat4m/pkgman.rb', line 20
def select_uninstalled(*pkgs)
pkgs.flatten.select { |pkg| !installed?(pkg) }
end
|
#uninstall(*pkgs, silent: false) ⇒ Object
45
46
47
48
|
# File 'lib/plat4m/pkgman.rb', line 45
def uninstall(*pkgs, silent: false)
cmd = make_uninstall_command
silent ? system("#{cmd} >/dev/null 2>&1") : system(cmd)
end
|