Sha256: baa2a47ade8d070d9e8ec6c26cf2a460fcaf4bd12e0aa669d85104c02b1936cb

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

module Sprinkle
  module Installers
    class Group < Installer
      # The user installer helps add groups.  You may pass flags as an option.
      # 
      # == Example Usage
      #
      #   package :users do
      #     add_group 'webguys', :flags => "--shell /usr/bin/zsh"
      #
      #     verify do
      #       has_group 'webguys'
      #     end
      #   end
      
      api do
        def add_group(group, options={},  &block)
          install Sprinkle::Installers::Group.new(self, group, options, &block)
        end
      end
      
      verify_api do
        def has_group(group)
          @commands << "id -g #{group}"
        end
      end
      
      def initialize(package, groupname, options, &block) #:nodoc:
        super package, options, &block
        @groupname = groupname
      end
      
      protected 
      def install_commands #:nodoc:
        "addgroup #{@options[:flags]} #{@groupname}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprinkle-0.5.0.rc1 lib/sprinkle/installers/group.rb