README (solaris-file)

Last Update: Tue Jul 24 07:42:08 -0600 2007

Description

Adds ACL support for the File class on Solaris.

Prerequisites

Ruby 1.8.x

Installation

Manual Installation

rake test (optional)
rake install

Gem Install

rake test (optional)
rake install_gem

Synopsis

   
   require "solaris/file"

   f = "some_file.txt"
   acl_text = "user::rw-,user:nobody:r--,"
   acl_text << "group::r--,group:sys:r--,mask:r--,other:r--"

   File.trivial?(f) # probably true
   File.acl_write_text(acl_text)

   # No longer a trivial file
   File.trivial?(f) # false
   File.acl_read(f).each{ |acl| p acl }
   

Class Methods

File.acl_count(file_name)

Returns the number of ACL entries for the file. Returns 0 if it's a trivial file.

File.acl_read(file_name)

Returns an Array of ACLStruct's or nil if file_name is a trivial file.

Fiel.acl_read_text(file_name)

Returns a String form of the ACL entries for the file. Returns nil if it's a trivial ACL.

File.acl_write_text(file_name, acl_string)

Accepts a formatted ACL string that set the ACL for the file. If the string is badly formed, a File::SolarisError is raised.

File.realpath(path)

Resolves all symbolic links in +path+. Resolves to an absolute pathname where possible.

File.resolvepath(path)

Resolves all symbolic links in +path+. All "." components are removed, as well as all nonleading ".." components and their blockquoteceding directory component. If leading ".." components resolve to the root directory, they are replaced by "/".

File.trivial?(file_name)

Returns true if the file is a trivial ACL file, i.e. has no ACL entries for additional users or groups.

Instance Methods

File#acl_count

Returns the number of ACL entries for the file. Returns 0 if it's a trivial file.

File#acl_read

Returns an Array of ACLStruct's.

File#acl_read_text

Returns a String form of the ACL entries for the file. Returns nil if it's a trivial ACL.

File#acl_write_text(acl_string)

Accepts a formatted ACL string that set the ACL for the file. If the string is badly formed, a File::SolarisError is raised.

File#trivial?

Returns true if the file is a trivial ACL file, i.e. has no ACL entries for additional users or groups

Constants

File::SOLARIS_VERSION

Returns the current version number of this package as a String.

Error Classes

File::SolarisError < StandardError

Raised if anything goes wrong with any of the above methods.

Known Bugs

None that I am aware of. Please report any bugs using the tracker on the project page at http://www.rubyforge.org/projects/solarisutils

Future Plans

Add File.acl_write and File#acl_write methods that accept an array of ACLStruct's.
Add support for extended file attributes.

Developer‘s Notes

This is a BETA release. The code is stable, the API is not.

Copyright

(C) 2005-2007 Daniel J. Berger
All Rights Reserved

Warranty

This package is provided "as is" and without any exblockquotess or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

License

Ruby's

Author

Daniel J. Berger
djberg96 [at nospam at gmail dot com]
imperator on IRC (irc.freenode.net)

[Validate]