Class: Specinfra::Command::Arch::Base::Package

Inherits:
Linux::Base::Package show all
Defined in:
lib/specinfra/command/arch/base/package.rb

Class Method Summary collapse

Methods inherited from Base::Package

check_is_installed_by_cpan, check_is_installed_by_gem, check_is_installed_by_npm, check_is_installed_by_pear, check_is_installed_by_pecl, check_is_installed_by_pip, check_is_installed_by_rvm

Methods inherited from Base

create, escape

Class Method Details

.check_is_installed(package, version = nil) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/specinfra/command/arch/base/package.rb', line 3

def check_is_installed(package,version=nil)
  if version
    grep = version.include?('-') ? "^#{escape(version)}$" : "^#{escape(version)}-"
    "pacman -Q #{escape(package)} | awk '{print $2}' | grep '#{grep}'"
  else
    "pacman -Q #{escape(package)}"
  end
end

.get_version(package, opts = nil) ⇒ Object



12
13
14
# File 'lib/specinfra/command/arch/base/package.rb', line 12

def get_version(package, opts=nil)
  "pacman -Qi #{package} | grep Version | awk '{print $3}'"
end

.install(package, version = nil, option = '') ⇒ Object



16
17
18
19
# File 'lib/specinfra/command/arch/base/package.rb', line 16

def install(package, version=nil, option='')
  # Pacman doesn't support to install specific version.
  "pacman -S --noconfirm #{option} #{package}"
end

.remove(package, option = '') ⇒ Object



26
27
28
# File 'lib/specinfra/command/arch/base/package.rb', line 26

def remove(package, option='')
  "pacman -R --noconfirm #{option} #{package}"
end

.sync_reposObject

Should this method be here or not ?



22
23
24
# File 'lib/specinfra/command/arch/base/package.rb', line 22

def sync_repos
  "pacman -Syy"
end