Sha256: 4bd8a05591493be847ba2a59bf49606a50862281f1f153ea4b530691285856c1

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

# == PackageManager::APT
#
# The APT driver for the PackageManager provides a way to manage software
# packages on Debian-style systems using <tt>apt-get</tt> and <tt>dpkg</tt>.
class AutomateIt::PackageManager::APT < AutomateIt::PackageManager::DPKG
  depends_on :programs => %w(apt-get dpkg)

  def suitability(method, *args) # :nodoc:
    return available? ? 1 : 0
  end

  # See AutomateIt::PackageManager#install
  def install(*packages)
    return _install_helper(*packages) do |list, opts|
      # apt-get options:
      # -y : yes to all queries
      # -q : no interactive progress bars
      cmd = "export DEBIAN_FRONTEND=noninteractive; apt-get"
      cmd << " -t #{opts[:backports]}" if opts[:backports]
      cmd << " install -y -q "+list.join(" ")+" < /dev/null"
      cmd << " > /dev/null" if opts[:quiet]
      cmd << " 2>&1"

      interpreter.sh(cmd)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
automate-it-0.9.2 lib/automateit/package_manager/apt.rb
automate-it-0.9.1 lib/automateit/package_manager/apt.rb
automate-it-0.9.0 lib/automateit/package_manager/apt.rb