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

Inherits:
Specinfra::Command::Base show all
Defined in:
lib/specinfra/command/base/package.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Base

create, escape

Class Method Details

.check_is_installed_by_cpan(name, version = nil) ⇒ Object



59
60
61
62
63
64
# File 'lib/specinfra/command/base/package.rb', line 59

def check_is_installed_by_cpan(name, version=nil)
  regexp = "^#{name}"
  cmd = "cpan -l | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_gem(name, version = nil, gem_binary = "gem") ⇒ Object



3
4
5
# File 'lib/specinfra/command/base/package.rb', line 3

def check_is_installed_by_gem(name, version=nil, gem_binary="gem")
  gem_installed_command(gem_binary, name, version)
end

.check_is_installed_by_npm(name, version = nil) ⇒ Object



18
19
20
21
22
# File 'lib/specinfra/command/base/package.rb', line 18

def check_is_installed_by_npm(name, version=nil)
  cmd = "npm ls #{escape(name)} -g"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_pear(name, version = nil) ⇒ Object



31
32
33
34
35
36
# File 'lib/specinfra/command/base/package.rb', line 31

def check_is_installed_by_pear(name, version=nil)
  regexp = "^#{name}"
  cmd = "pear list -a | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_pecl(name, version = nil) ⇒ Object



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

def check_is_installed_by_pecl(name, version=nil)
  regexp = "^#{name}"
  cmd = "pecl list | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_pip(name, version = nil) ⇒ Object



38
39
40
41
42
43
# File 'lib/specinfra/command/base/package.rb', line 38

def check_is_installed_by_pip(name, version=nil)
  regexp = "^#{name}"
  cmd = "pip list | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_pip2(name, version = nil) ⇒ Object



45
46
47
48
49
50
# File 'lib/specinfra/command/base/package.rb', line 45

def check_is_installed_by_pip2(name, version=nil)
  regexp = "^#{name}"
  cmd = "pip2 list | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_pip3(name, version = nil) ⇒ Object



52
53
54
55
56
57
# File 'lib/specinfra/command/base/package.rb', line 52

def check_is_installed_by_pip3(name, version=nil)
  regexp = "^#{name} "
  cmd = "pip3 list | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_rvm(name, version = nil) ⇒ Object



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

def check_is_installed_by_rvm(name, version=nil)
  regexp = "^#{name}"
  cmd = "rvm list strings | grep -iw -- #{escape(regexp)}"
  cmd = "#{cmd} | grep -w -- #{escape(version)}" if version
  cmd
end

.check_is_installed_by_td_agent_gem(name, version = nil) ⇒ Object



7
8
9
# File 'lib/specinfra/command/base/package.rb', line 7

def check_is_installed_by_td_agent_gem(name, version=nil)
  gem_installed_command("/usr/sbin/td-agent-gem", name, version)
end