Sha256: bd9fae6f7833dd28908b1fbaedd28de2a56097ff7fa9ecce2798840d37b50e35

Contents?: true

Size: 948 Bytes

Versions: 3

Compression:

Stored size: 948 Bytes

Contents

class Specinfra::Command::Debian::Base::Package < Specinfra::Command::Linux::Base::Package
  class << self
    def check_is_installed(package, version=nil)
      escaped_package = escape(package)
      if version
        cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{escape(version)}$'"
      else
        cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep -E '^(install|hold) ok installed$'"
      end
      cmd
    end

    alias :check_is_installed_by_apt :check_is_installed

    def install(package, version=nil)
      if version
        full_package = "#{package}=#{version}"
      else
        full_package = package
      end
      "DEBIAN_FRONTEND='noninteractive' apt-get -y install #{full_package}"
    end

    def get_version(package, opts=nil)
      "dpkg-query -f '${Status} ${Version}' -W #{package} | sed -n 's/^install ok installed //p'"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta40 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta39 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta38 lib/specinfra/command/debian/base/package.rb