B
Berger, Daniel
Hi all,
I am happy to annouce the first release of the sys-admin package.
What is it?
===========
The sys-admin package is meant to be a unified (as in API),
cross-platform replacement for the Etc module.
Synopsis
========
require "sys/admin"
include Sys
# Get the current login
p Admin.get_login
# Yields a User object for each user
Admin.users{ |user|
p user
}
# Returns an Array of User objects
a = Admin.users
# Yields a Group object for each group
Admin.groups{ |group|
p group
}
# Returns an Array of Group objects
g = Admin.groups
# Get information about a particular user
p Admin.get_user("nobody")
# Get information about a particular group
p Admin.get_group("adm")
What's missing?
===============
You cannot add, configure or delete users in this release. This will be
added in the next release.
Where can I get it?
===================
You can find "sys-admin" listed on the RAA.
Preemptive FAQ
==============
Q) Did we really need a replacement for the Etc module?
A) Yes. The Etc module has two problems. First, and foremost, it
doesn't work on Windows. Second, the name doesn't make any sense when
you take Windows into account and, IMHO, the API was far too literal a
translation of the header functions from pwd.h and grp.h. The fact that
it doesn't work on Windows has lead to other issues, like the fact that
File.stat returns bogus info for some Stat members.
Q) What about win32-etc?
A) The win32-etc package is officially deprecated as of today
(25-Mar-2005), but will still be available for download until I add the
ability to add, configure and delete users. At that point, it will be
removed from the Win32 Utils project.
Q) But didn't win32-etc already solve all these problems?
A) To a point, yes. However, my ultimate goal is to (hopefully) have
the sys-admin package added to the core Ruby distro and used in place of
the Etc module so that we can eliminate some of the other core issues
(e.g. File.stat). Also, I changed my mind slightly regarding the
USER_INFO struct that I decided to use in the Win32 code. Finally, you
still had the issue of the name "Etc" and the function names which,
while they may have been familiar to *nix users, made no sense on the
Win32 platform.
Q) But is the API truly identical?
A) The method names are identical. The only difference is that all of
the methods (except Admin.get_login) allow you to pass a machine name as
an optional argument, so you can retrieve user and group information
from other machines, assuming you're on a network. In addition, because
Windows has the concept of local versus global groups, you can pass an
optional second argument to the Admin.get_group and Admin.groups methods
to indicate which group type you're after.
See the documentation for more details.
Q) What's up with the block vs non-block syntax?
A) I provided non-block forms for speed and ease of marshalling.
Q) Hey! Where's the gem?
A) I couldn't get it to work because of the way I prefer to separate my
source files. There's a (broken) gemspec in CVS. I need some help
there. But, the source code, README and CHANGES files are all rdoc
friendly. You'll just have to install the old fashioned way in the
meantime (i.e. ruby extconf.rb; make; make site-install).
Enjoy!
Dan
I am happy to annouce the first release of the sys-admin package.
What is it?
===========
The sys-admin package is meant to be a unified (as in API),
cross-platform replacement for the Etc module.
Synopsis
========
require "sys/admin"
include Sys
# Get the current login
p Admin.get_login
# Yields a User object for each user
Admin.users{ |user|
p user
}
# Returns an Array of User objects
a = Admin.users
# Yields a Group object for each group
Admin.groups{ |group|
p group
}
# Returns an Array of Group objects
g = Admin.groups
# Get information about a particular user
p Admin.get_user("nobody")
# Get information about a particular group
p Admin.get_group("adm")
What's missing?
===============
You cannot add, configure or delete users in this release. This will be
added in the next release.
Where can I get it?
===================
You can find "sys-admin" listed on the RAA.
Preemptive FAQ
==============
Q) Did we really need a replacement for the Etc module?
A) Yes. The Etc module has two problems. First, and foremost, it
doesn't work on Windows. Second, the name doesn't make any sense when
you take Windows into account and, IMHO, the API was far too literal a
translation of the header functions from pwd.h and grp.h. The fact that
it doesn't work on Windows has lead to other issues, like the fact that
File.stat returns bogus info for some Stat members.
Q) What about win32-etc?
A) The win32-etc package is officially deprecated as of today
(25-Mar-2005), but will still be available for download until I add the
ability to add, configure and delete users. At that point, it will be
removed from the Win32 Utils project.
Q) But didn't win32-etc already solve all these problems?
A) To a point, yes. However, my ultimate goal is to (hopefully) have
the sys-admin package added to the core Ruby distro and used in place of
the Etc module so that we can eliminate some of the other core issues
(e.g. File.stat). Also, I changed my mind slightly regarding the
USER_INFO struct that I decided to use in the Win32 code. Finally, you
still had the issue of the name "Etc" and the function names which,
while they may have been familiar to *nix users, made no sense on the
Win32 platform.
Q) But is the API truly identical?
A) The method names are identical. The only difference is that all of
the methods (except Admin.get_login) allow you to pass a machine name as
an optional argument, so you can retrieve user and group information
from other machines, assuming you're on a network. In addition, because
Windows has the concept of local versus global groups, you can pass an
optional second argument to the Admin.get_group and Admin.groups methods
to indicate which group type you're after.
See the documentation for more details.
Q) What's up with the block vs non-block syntax?
A) I provided non-block forms for speed and ease of marshalling.
Q) Hey! Where's the gem?
A) I couldn't get it to work because of the way I prefer to separate my
source files. There's a (broken) gemspec in CVS. I need some help
there. But, the source code, README and CHANGES files are all rdoc
friendly. You'll just have to install the old fashioned way in the
meantime (i.e. ruby extconf.rb; make; make site-install).
Enjoy!
Dan