Class: Sprinkle::Installers::Apt

Inherits:
Installer show all
Defined in:
lib/sprinkle/installers/apt.rb

Overview

Apt Package Installer

The Apt package installer uses the apt-get command to install packages. The apt installer has only one option which can be modified which is the dependencies_only option. When this is set to true, the installer uses build-dep instead of install to only build the dependencies.

Example Usage

First, a simple installation of the magic_beans package:

package :magic_beans do
  description "Beans beans they're good for your heart..."
  apt 'magic_beans_package'
end

Second, only build the magic_beans dependencies:

package :magic_beans_depends do
  apt 'magic_beans_package' { dependencies_only true }
end

As you can see, setting options is as simple as creating a block and calling the option as a method with the value as its parameter.

Instance Attribute Summary collapse

Attributes inherited from Installer

#delivery, #options, #package, #post, #pre

Attributes included from Configurable

#delivery

Instance Method Summary collapse

Methods inherited from Installer

#process

Methods included from Configurable

#assert_delivery, #defaults, #method_missing

Constructor Details

#initialize(parent, *packages, &block) ⇒ Apt

:nodoc:



32
33
34
35
36
37
38
39
40
41
# File 'lib/sprinkle/installers/apt.rb', line 32

def initialize(parent, *packages, &block) #:nodoc:
  super parent, &block
  packages.flatten!
  
  options = { :dependencies_only => false }
  options.update(packages.pop) if packages.last.is_a?(Hash)
  
  @command = options[:dependencies_only] ? 'build-dep' : 'install'
  @packages = packages
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sprinkle::Configurable

Instance Attribute Details

#packagesObject

:nodoc:



30
31
32
# File 'lib/sprinkle/installers/apt.rb', line 30

def packages
  @packages
end