Sha256: dfeb9db1dd8f189e8d1872e82ffad83d52d1b72b690f857d087eec6f6e014c94

Contents?: true

Size: 1.14 KB

Versions: 178

Compression:

Stored size: 1.14 KB

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 -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' #{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

    def remove(package, option='')
      "DEBIAN_FRONTEND='noninteractive' apt-get -y #{option} remove #{package}"
    end
  end
end

Version data entries

178 entries across 178 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.7 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.6 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.5 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.66.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.65.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.64.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.63.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.63.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.63.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.63.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.62.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.61.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.61.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.61.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.61.0 lib/specinfra/command/debian/base/package.rb