Class: Specinfra::Command::Openbsd::Base::Package

Inherits:
Base::Package show all
Defined in:
lib/specinfra/command/openbsd/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_pip2, check_is_installed_by_pip3, check_is_installed_by_rvm, check_is_installed_by_td_agent_gem

Methods inherited from Base

create, escape

Class Method Details

.check_is_installed(package, version = nil) ⇒ Object



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

def check_is_installed(package, version=nil)
  if version
    "pkg_info -a | cut -d ' ' -f 1 | grep  #{escape(package)}-#{escape(version)}"
  else
    "pkg_info -a | cut -d ' ' -f 1 | grep  #{escape(package)}"
  end
end

.get_version(package, _opts = nil) ⇒ Object



15
16
17
# File 'lib/specinfra/command/openbsd/base/package.rb', line 15

def get_version(package, _opts=nil)
  "pkg_info -I #{package} | sed -e 's/#{package}-//' | cut -d' ' -f1"
end

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



11
12
13
# File 'lib/specinfra/command/openbsd/base/package.rb', line 11

def install(package, version=nil, option='')
  "pkg_add #{option} #{package}"
end