Sha256: 0364d934542f655eec79eb45c1be93a3f44a3ed6bd22a1bdb26b8c59c828a87b

Contents?: true

Size: 969 Bytes

Versions: 48

Compression:

Stored size: 969 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, option='')
      if version
        full_package = "#{package}=#{version}"
      else
        full_package = package
      end
      "DEBIAN_FRONTEND='noninteractive' apt-get -y #{option} 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

48 entries across 48 versions & 1 rubygems

Version Path
specinfra-2.4.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.3.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.3.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.3.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.2.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.2.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.2.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.2.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.2.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.1.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.1.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta52 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta51 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta50 lib/specinfra/command/debian/base/package.rb
specinfra-2.0.0.beta49 lib/specinfra/command/debian/base/package.rb