Sha256: d0e13aaf8ce37a5397c8b80db88fbfb6a92cef9948c6b24697c3d5544595b5d0

Contents?: true

Size: 1.62 KB

Versions: 23

Compression:

Stored size: 1.62 KB

Contents

module Sprinkle
  module Installers
    # = 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.
    class Apt < Installer
      attr_accessor :packages #:nodoc:

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

      protected

        def install_commands #:nodoc:
          command = @options[:dependencies_only] ? 'build-dep' : 'install'
          "env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu #{command} #{@packages.join(' ')}"
        end

    end
  end
end

Version data entries

23 entries across 23 versions & 7 rubygems

Version Path
crafterm-sprinkle-0.2.4 lib/sprinkle/installers/apt.rb
crafterm-sprinkle-0.2.5 lib/sprinkle/installers/apt.rb
crafterm-sprinkle-0.2.6 lib/sprinkle/installers/apt.rb
lachlan-sprinkle-0.0.15 lib/sprinkle/installers/apt.rb
lachlan-sprinkle-0.0.16 lib/sprinkle/installers/apt.rb
trevorturk-sprinkle-0.2.6 lib/sprinkle/installers/apt.rb
sprinkle-0.4.2 lib/sprinkle/installers/apt.rb
sprinkle-0.4.1 lib/sprinkle/installers/apt.rb
sprinkle-0.4.0 lib/sprinkle/installers/apt.rb
sprinkle-0.3.6 lib/sprinkle/installers/apt.rb
sprinkle-0.3.5 lib/sprinkle/installers/apt.rb
dhill-sprinkle-0.3.3.1 lib/sprinkle/installers/apt.rb
sprinkle-0.3.4 lib/sprinkle/installers/apt.rb
sprinkle-0.3.3 lib/sprinkle/installers/apt.rb
sprinkle-0.3.2 lib/sprinkle/installers/apt.rb
powcloud-sprinkle-0.3.4 lib/sprinkle/installers/apt.rb
powcloud-sprinkle-0.3.0 lib/sprinkle/installers/apt.rb
sprinkle-0.3.1 lib/sprinkle/installers/apt.rb
sprinkle-0.3.0 lib/sprinkle/installers/apt.rb
maxmpz-sprinkle-0.2.6.1 lib/sprinkle/installers/apt.rb