Class: Specinfra::Command::Alpine::Base::Package
Class Method Summary
collapse
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
Also known as:
check_is_installed_by_apk
3
4
5
6
7
8
9
10
11
|
# File 'lib/specinfra/command/alpine/base/package.rb', line 3
def check_is_installed(package, version = nil)
if version.nil? then
pkg = escape(package)
"apk info -qe #{pkg}"
else
pkg = "#{package}-#{version}"
"apk info -v | grep -w -- '^#{Regexp.escape(pkg)}'"
end
end
|
.get_version(package, _opts = nil) ⇒ Object
20
21
22
|
# File 'lib/specinfra/command/alpine/base/package.rb', line 20
def get_version(package, _opts = nil)
"apk version #{package} | tail -n1 | awk '{ print $3; }'"
end
|
.install(package, version = nil, _option = '') ⇒ Object
15
16
17
18
|
# File 'lib/specinfra/command/alpine/base/package.rb', line 15
def install(package, version = nil, _option = '')
pkg = [escape(package), version].compact.join('=')
"apk add -U #{pkg}"
end
|