Sha256: a1b34ce64aa66271a7b2e9940bb46237ab103f0a7f7164e724484d2ac0cc5e83

Contents?: true

Size: 907 Bytes

Versions: 7

Compression:

Stored size: 907 Bytes

Contents

module Sprinkle
  module Installers
    # 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
    class Group < Installer
      api do
        def add_group(group, options={},  &block)
          install 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

7 entries across 7 versions & 1 rubygems

Version Path
sprinkle-0.7.6.2 lib/sprinkle/installers/group.rb
sprinkle-0.7.6.1 lib/sprinkle/installers/group.rb
sprinkle-0.7.6 lib/sprinkle/installers/group.rb
sprinkle-0.7.5 lib/sprinkle/installers/group.rb
sprinkle-0.7.4 lib/sprinkle/installers/group.rb
sprinkle-0.7.3 lib/sprinkle/installers/group.rb
sprinkle-0.7.2 lib/sprinkle/installers/group.rb