Sha256: 76d909bbef8430e9671fc867fe811923769ad1053f0f453225c4ba443933a1a5

Contents?: true

Size: 928 Bytes

Versions: 9

Compression:

Stored size: 928 Bytes

Contents

module Sprinkle
  module Installers
    # = Deb Package Installer
    #
    # The Deb installer installs deb packages sourced from a remote URL
    # 
    # == Example Usage
    #
    # Installing the magic_beans deb.
    #
    #   package :magic_beans do
    #     deb 'http://debs.example.com/magic_beans.deb'
    #   end
    #
    class Deb < Installer
      attr_accessor :packages #:nodoc:

      def initialize(parent, packages, &block) #:nodoc:
        super parent, &block
        packages = [packages] unless packages.is_a? Array
        @packages = packages
      end

      protected

        def install_commands #:nodoc:
          [
					"wget -cq --directory-prefix=/tmp #{@packages.join(' ')}", 
					"dpkg -i #{@packages.collect{|p| "/tmp/#{package_name(p)}"}.join(" ")}"
					]
        end
        
      private
      
        def package_name(url)
          url.split('/').last
        end

    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sprinkle-0.4.2 lib/sprinkle/installers/deb.rb
sprinkle-0.4.1 lib/sprinkle/installers/deb.rb
sprinkle-0.4.0 lib/sprinkle/installers/deb.rb
sprinkle-0.3.6 lib/sprinkle/installers/deb.rb
sprinkle-0.3.5 lib/sprinkle/installers/deb.rb
dhill-sprinkle-0.3.3.1 lib/sprinkle/installers/deb.rb
sprinkle-0.3.4 lib/sprinkle/installers/deb.rb
sprinkle-0.3.3 lib/sprinkle/installers/deb.rb
sprinkle-0.3.2 lib/sprinkle/installers/deb.rb