Sha256: 2c8e0cc598e74e8c51df949b95d96b449296731b61dda2a3d98b0512b7ba082b

Contents?: true

Size: 1.34 KB

Versions: 43

Compression:

Stored size: 1.34 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_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

43 entries across 43 versions & 1 rubygems

Version Path
specinfra-2.13.1 lib/specinfra/command/base/package.rb
specinfra-2.13.0 lib/specinfra/command/base/package.rb
specinfra-2.12.7 lib/specinfra/command/base/package.rb
specinfra-2.12.6 lib/specinfra/command/base/package.rb
specinfra-2.12.5 lib/specinfra/command/base/package.rb
specinfra-2.12.4 lib/specinfra/command/base/package.rb
specinfra-2.12.3 lib/specinfra/command/base/package.rb
specinfra-2.12.1 lib/specinfra/command/base/package.rb
specinfra-2.12.0 lib/specinfra/command/base/package.rb
specinfra-2.11.10 lib/specinfra/command/base/package.rb
specinfra-2.11.9 lib/specinfra/command/base/package.rb
specinfra-2.11.8 lib/specinfra/command/base/package.rb
specinfra-2.11.7 lib/specinfra/command/base/package.rb
specinfra-2.11.6 lib/specinfra/command/base/package.rb
specinfra-2.11.5 lib/specinfra/command/base/package.rb
specinfra-2.11.4 lib/specinfra/command/base/package.rb
specinfra-2.11.3 lib/specinfra/command/base/package.rb
specinfra-2.11.2 lib/specinfra/command/base/package.rb
specinfra-2.11.1 lib/specinfra/command/base/package.rb
specinfra-2.11.0 lib/specinfra/command/base/package.rb