Sha256: 9bb6f8fabdb0cc0557d9e5eaebb5b7903dd7e5493cc055c06472a2c6700250e5

Contents?: true

Size: 1.56 KB

Versions: 46

Compression:

Stored size: 1.56 KB

Contents

class Specinfra::Command::Base::Package < Specinfra::Command::Base
  class << self
    def check_is_installed_by_gem(name, version=nil)
      regexp = "^#{name}"
      cmd = "gem list --local | grep -iw -- #{escape(regexp)}"
      cmd = %Q!#{cmd} | grep -w -- "[( ]#{escape(version)}[,)]"! if version
      cmd
    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 | 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
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
specinfra-2.30.1 lib/specinfra/command/base/package.rb
specinfra-2.30.0 lib/specinfra/command/base/package.rb
specinfra-2.29.0 lib/specinfra/command/base/package.rb
specinfra-2.28.4 lib/specinfra/command/base/package.rb
specinfra-2.28.3 lib/specinfra/command/base/package.rb
specinfra-2.28.2 lib/specinfra/command/base/package.rb
specinfra-2.28.1 lib/specinfra/command/base/package.rb
specinfra-2.28.0 lib/specinfra/command/base/package.rb
specinfra-2.27.1 lib/specinfra/command/base/package.rb
specinfra-2.27.0 lib/specinfra/command/base/package.rb
specinfra-2.26.1 lib/specinfra/command/base/package.rb
specinfra-2.26.0 lib/specinfra/command/base/package.rb
specinfra-2.25.1 lib/specinfra/command/base/package.rb
specinfra-2.25.0 lib/specinfra/command/base/package.rb
specinfra-2.24.2 lib/specinfra/command/base/package.rb
specinfra-2.24.1 lib/specinfra/command/base/package.rb
specinfra-2.24.0 lib/specinfra/command/base/package.rb
specinfra-2.23.0 lib/specinfra/command/base/package.rb
specinfra-2.22.0 lib/specinfra/command/base/package.rb
specinfra-2.21.1 lib/specinfra/command/base/package.rb