Sha256: ebf6749a41bb8d4bbe293e9fd7cb4fc2049310874b722cc04c8d6dc063799db2

Contents?: true

Size: 934 Bytes

Versions: 17

Compression:

Stored size: 934 Bytes

Contents

###########################################################################
# groups.rb
#
# Sample script to demonstrate some of the various group methods.  Alter
# as you see fit.
###########################################################################
base = File.basename(Dir.pwd)

if base == "examples" || base =~ /sys-admin.*/
   require "ftools"
   Dir.chdir("..") if base == "examples"
   Dir.mkdir("sys") unless File.exists?("sys")
   if RUBY_PLATFORM.match("mswin")
      File.copy("lib/sys/admin.rb", "sys/admin.rb")
   else
      File.copy("admin.so","sys") if File.exists?("admin.so")
   end
   $LOAD_PATH.unshift(Dir.pwd)
end

require "pp"
require "sys/admin"
include Sys

if PLATFORM.match("mswin")
   pp Admin.get_group("guests")
   pp Admin.get_group(513)
else
   pp Admin.get_group("adm")
   pp Admin.get_group(7)
end

Admin.groups{ |g|
   pp g
   puts
}

# This should raise an error
Admin.get_group("fofofofof")

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sys-admin-1.5.6-x86-mingw32 examples/groups.rb
sys-admin-1.5.6 examples/groups.rb
sys-admin-1.5.5-x86-mingw32 examples/groups.rb
sys-admin-1.5.5 examples/groups.rb
sys-admin-1.5.4-x86-mingw32 examples/groups.rb
sys-admin-1.5.4 examples/groups.rb
sys-admin-1.5.3-x86-mingw32 examples/groups.rb
sys-admin-1.5.3 examples/groups.rb
sys-admin-1.5.1 examples/groups.rb
sys-admin-1.5.2 examples/groups.rb
sys-admin-1.4.2 examples/groups.rb
sys-admin-1.4.5 examples/groups.rb
sys-admin-1.4.1 examples/groups.rb
sys-admin-1.5.0 examples/groups.rb
sys-admin-1.4.4 examples/groups.rb
sys-admin-1.4.0 examples/groups.rb
sys-admin-1.4.3 examples/groups.rb