Sha256: 46335d4dd9d9d2d5eb221adaf05c5185a4afeee78a7c5a1b5e012eaa0948c319
Contents?: true
Size: 1.84 KB
Versions: 9
Compression:
Stored size: 1.84 KB
Contents
class Specinfra::Command::Base::Package < Specinfra::Command::Base class << self def check_is_installed_by_gem(name, version=nil) gem_installed_command("gem", name, version) end def check_is_installed_by_td_agent_gem(name, version=nil) gem_installed_command("/usr/sbin/td-agent-gem", name, version) end 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 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 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 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 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 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 private def gem_installed_command(gem_binary, name, version=nil) regexp = "^#{name}" cmd = "#{gem_binary} list --local | grep -iw -- #{escape(regexp)}" cmd = %Q!#{cmd} | grep -w -- "[( ]#{escape(version)}[,)]"! if version cmd end end end
Version data entries
9 entries across 9 versions & 1 rubygems