solaris-file 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -1
- data/MANIFEST +11 -14
- data/README +22 -19
- data/ext/extconf.rb +10 -0
- data/{lib → ext}/solaris/sfile.c +11 -11
- data/{lib → ext}/solaris/sfile.h +1 -1
- data/test/tc_solaris_file.rb +10 -18
- metadata +19 -15
- data/extconf.rb +0 -8
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.3.2 - 24-Jul-2007
|
2
|
+
* Added a Rakefile with tasks for testing and installation.
|
3
|
+
* Fixed an internal function name that conflicted with one in the acl.h file.
|
4
|
+
(I'm guessing this was a recent development for me not to notice until now).
|
5
|
+
* Internal layout changes that don't affect you.
|
6
|
+
|
1
7
|
== 0.3.1 - 11-Jul-2006
|
2
8
|
* Fixed a potential 64 bit bug in a struct declaration.
|
3
9
|
* Minor RDoc updates, changes and internal cosmetic changes.
|
@@ -16,4 +22,4 @@
|
|
16
22
|
* Added a gemspec.
|
17
23
|
|
18
24
|
== 0.1.0 - 27-Jan-2005
|
19
|
-
* Initial release.
|
25
|
+
* Initial release.
|
data/MANIFEST
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
MANIFEST
|
3
|
-
README
|
4
|
-
|
5
|
-
solaris-file.gemspec
|
6
|
-
|
7
|
-
examples/
|
8
|
-
examples/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
lib/solaris/sfile.h
|
13
|
-
|
14
|
-
test/tc_solaris_file.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* solaris-file.gemspec
|
6
|
+
* examples/bar.txt
|
7
|
+
* examples/foo.txt
|
8
|
+
* examples/test.rb
|
9
|
+
* ext/solaris/sfile.c
|
10
|
+
* ext/solaris/sfile.h
|
11
|
+
* test/tc_solaris_file.rb
|
data/README
CHANGED
@@ -5,10 +5,13 @@
|
|
5
5
|
Ruby 1.8.x
|
6
6
|
|
7
7
|
== Installation
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
=== Manual Installation
|
9
|
+
rake test (optional)
|
10
|
+
rake install
|
11
|
+
|
12
|
+
=== Gem Install
|
13
|
+
rake test (optional)
|
14
|
+
rake install_gem
|
12
15
|
|
13
16
|
== Synopsis
|
14
17
|
require "solaris/file"
|
@@ -26,26 +29,26 @@
|
|
26
29
|
|
27
30
|
== Class Methods
|
28
31
|
File.acl_count(file_name)
|
29
|
-
Returns the number of ACL entries for the file.
|
32
|
+
Returns the number of ACL entries for the file. Returns 0 if it's a
|
30
33
|
trivial file.
|
31
34
|
|
32
35
|
File.acl_read(file_name)
|
33
36
|
Returns an Array of ACLStruct's or nil if file_name is a trivial file.
|
34
37
|
|
35
38
|
Fiel.acl_read_text(file_name)
|
36
|
-
Returns a String form of the ACL entries for the file.
|
39
|
+
Returns a String form of the ACL entries for the file. Returns nil if
|
37
40
|
it's a trivial ACL.
|
38
41
|
|
39
42
|
File.acl_write_text(file_name, acl_string)
|
40
|
-
Accepts a formatted ACL string that set the ACL for the file.
|
43
|
+
Accepts a formatted ACL string that set the ACL for the file. If the
|
41
44
|
string is badly formed, a File::SolarisError is raised.
|
42
45
|
|
43
46
|
File.realpath(path)
|
44
|
-
Resolves all symbolic links in +path+.
|
47
|
+
Resolves all symbolic links in +path+. Resolves to an absolute pathname
|
45
48
|
where possible.
|
46
49
|
|
47
50
|
File.resolvepath(path)
|
48
|
-
Resolves all symbolic links in +path+.
|
51
|
+
Resolves all symbolic links in +path+. All "." components are removed, as
|
49
52
|
well as all nonleading ".." components and their preceding directory
|
50
53
|
component. If leading ".." components resolve to the root directory, they
|
51
54
|
are replaced by "/".
|
@@ -56,14 +59,14 @@ File.trivial?(file_name)
|
|
56
59
|
|
57
60
|
= Instance Methods
|
58
61
|
File#acl_count
|
59
|
-
Returns the number of ACL entries for the file.
|
62
|
+
Returns the number of ACL entries for the file. Returns 0 if it's a
|
60
63
|
trivial file.
|
61
64
|
|
62
65
|
File#acl_read
|
63
66
|
Returns an Array of ACLStruct's.
|
64
67
|
|
65
68
|
File#acl_read_text
|
66
|
-
Returns a String form of the ACL entries for the file.
|
69
|
+
Returns a String form of the ACL entries for the file. Returns nil if
|
67
70
|
it's a trivial ACL.
|
68
71
|
|
69
72
|
File#acl_write_text(acl_string)
|
@@ -83,7 +86,7 @@ File::SolarisError < StandardError
|
|
83
86
|
Raised if anything goes wrong with any of the above methods.
|
84
87
|
|
85
88
|
== Known Bugs
|
86
|
-
None that I am aware of.
|
89
|
+
None that I am aware of. Please report any bugs using the tracker on the
|
87
90
|
project page at http://www.rubyforge.org/projects/solarisutils
|
88
91
|
|
89
92
|
== Future Plans
|
@@ -92,21 +95,21 @@ File::SolarisError < StandardError
|
|
92
95
|
Add support for extended file attributes.
|
93
96
|
|
94
97
|
== Developer's Notes
|
95
|
-
This is a BETA release.
|
98
|
+
This is a BETA release. The code is stable, the API is not.
|
96
99
|
|
97
100
|
== Copyright
|
98
|
-
|
99
|
-
|
101
|
+
(C) 2005-2007 Daniel J. Berger
|
102
|
+
All Rights Reserved
|
100
103
|
|
101
104
|
== Warranty
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
This package is provided "as is" and without any express or
|
106
|
+
implied warranties, including, without limitation, the implied
|
107
|
+
warranties of merchantability and fitness for a particular purpose.
|
105
108
|
|
106
109
|
== License
|
107
110
|
Ruby's
|
108
111
|
|
109
112
|
== Author
|
110
113
|
Daniel J. Berger
|
111
|
-
djberg96 [at gmail dot com]
|
114
|
+
djberg96 [at nospam at gmail dot com]
|
112
115
|
imperator on IRC (irc.freenode.net)
|
data/ext/extconf.rb
ADDED
data/{lib → ext}/solaris/sfile.c
RENAMED
@@ -9,7 +9,7 @@
|
|
9
9
|
* call-seq:
|
10
10
|
* File.acl_count(file_name)
|
11
11
|
*
|
12
|
-
* Returns the number of ACL entries for +file_name+.
|
12
|
+
* Returns the number of ACL entries for +file_name+. Returns 0 if +file_name+
|
13
13
|
* is a trivial file.
|
14
14
|
*/
|
15
15
|
static VALUE acl_count(VALUE klass, VALUE v_path){
|
@@ -34,7 +34,7 @@ static VALUE acl_count(VALUE klass, VALUE v_path){
|
|
34
34
|
* call-seq:
|
35
35
|
* File#acl_count
|
36
36
|
*
|
37
|
-
* Returns the number of ACL entries for the current handle.
|
37
|
+
* Returns the number of ACL entries for the current handle. Returns 0 if
|
38
38
|
* the file is a trivial file.
|
39
39
|
*/
|
40
40
|
static VALUE acl_icount(VALUE self){
|
@@ -115,10 +115,10 @@ static VALUE acl_read(VALUE klass, VALUE v_path){
|
|
115
115
|
* Returns nil if the file is a trivial file.
|
116
116
|
*/
|
117
117
|
static VALUE acl_iread(VALUE self){
|
118
|
+
int i;
|
118
119
|
int num_acls = 0;
|
119
|
-
int fildes = FIX2INT(rb_funcall(self,rb_intern("fileno"),0,0));
|
120
|
+
int fildes = FIX2INT(rb_funcall(self, rb_intern("fileno"), 0, 0));
|
120
121
|
VALUE v_array = Qnil;
|
121
|
-
int i;
|
122
122
|
|
123
123
|
if( (num_acls = facl(fildes, GETACLCNT, 0, NULL)) == -1)
|
124
124
|
rb_sys_fail(0);
|
@@ -152,7 +152,7 @@ static VALUE acl_iread(VALUE self){
|
|
152
152
|
* call-seq:
|
153
153
|
* File.acl_read_text(file_name)
|
154
154
|
*
|
155
|
-
* Returns a textual representation of the ACL for +file_name+.
|
155
|
+
* Returns a textual representation of the ACL for +file_name+. If +file_name+
|
156
156
|
* is a trivial file, nil is returned.
|
157
157
|
*/
|
158
158
|
static VALUE acl_read_text(VALUE klass, VALUE v_path){
|
@@ -190,10 +190,10 @@ static VALUE acl_read_text(VALUE klass, VALUE v_path){
|
|
190
190
|
* call-seq:
|
191
191
|
* File.acl_write_text(file_name, acl_text)
|
192
192
|
*
|
193
|
-
* Sets the ACL for +file_name+ using +acl_text+.
|
193
|
+
* Sets the ACL for +file_name+ using +acl_text+. The +acl_text+ argument is a
|
194
194
|
* human readable ACL text String.
|
195
195
|
*
|
196
|
-
* If +acl_text+ is invalid then a Solaris::
|
196
|
+
* If +acl_text+ is invalid then a Solaris::File::Error is raised, and in most
|
197
197
|
* cases the offending entry number will be identified.
|
198
198
|
*/
|
199
199
|
static VALUE acl_write_text(VALUE klass, VALUE v_path, VALUE v_text){
|
@@ -348,7 +348,7 @@ static VALUE acl_iread_text(VALUE self){
|
|
348
348
|
* Returns true if +file_name+ is a trivial file, i.e. has no additional ACL
|
349
349
|
* entries. Otherwise, it returns false.
|
350
350
|
*/
|
351
|
-
static VALUE
|
351
|
+
static VALUE acl_is_trivial(VALUE klass, VALUE v_path){
|
352
352
|
char pathp[PATH_MAX];
|
353
353
|
int num_acls = 0;
|
354
354
|
VALUE v_bool = Qfalse;
|
@@ -392,7 +392,7 @@ static VALUE acl_itrivial(VALUE self){
|
|
392
392
|
* Adds ACL support for the File class on Solaris
|
393
393
|
*/
|
394
394
|
void Init_file(){
|
395
|
-
/* Error
|
395
|
+
/* Error raised if an error occurs when reading or writing ACL properties */
|
396
396
|
cSolarisFileError = rb_define_class_under(rb_cFile, "SolarisError",
|
397
397
|
rb_eStandardError
|
398
398
|
);
|
@@ -402,7 +402,7 @@ void Init_file(){
|
|
402
402
|
rb_define_singleton_method(rb_cFile, "acl_read", acl_read, 1);
|
403
403
|
rb_define_singleton_method(rb_cFile, "acl_read_text", acl_read_text, 1);
|
404
404
|
rb_define_singleton_method(rb_cFile, "acl_write_text", acl_write_text, 2);
|
405
|
-
rb_define_singleton_method(rb_cFile, "trivial?",
|
405
|
+
rb_define_singleton_method(rb_cFile, "trivial?", acl_is_trivial, 1);
|
406
406
|
rb_define_singleton_method(rb_cFile, "realpath", solaris_realpath, 1);
|
407
407
|
rb_define_singleton_method(rb_cFile, "resolvepath", solaris_resolvepath, 1);
|
408
408
|
|
@@ -418,6 +418,6 @@ void Init_file(){
|
|
418
418
|
"acl_type", "acl_id", "acl_perm", NULL
|
419
419
|
);
|
420
420
|
|
421
|
-
/*
|
421
|
+
/* 0.3.2: The version of this library, returned as a String */
|
422
422
|
rb_define_const(rb_cFile, "SOLARIS_VERSION", rb_str_new2(SOLARIS_VERSION));
|
423
423
|
}
|
data/{lib → ext}/solaris/sfile.h
RENAMED
data/test/tc_solaris_file.rb
CHANGED
@@ -1,25 +1,15 @@
|
|
1
1
|
###############################################################################
|
2
2
|
# tc_solaris_file.rb
|
3
3
|
#
|
4
|
-
# Test suite for the solaris-file package.
|
4
|
+
# Test suite for the solaris-file package. You should run this test case
|
5
|
+
# via the 'rake test' task.
|
5
6
|
###############################################################################
|
6
|
-
|
7
|
-
|
8
|
-
if base == "test" || base =~ /solaris-file.*/
|
9
|
-
require "ftools"
|
10
|
-
Dir.chdir("..") if base == "test"
|
11
|
-
Dir.mkdir("solaris") unless File.exists?("solaris")
|
12
|
-
File.copy("file.so","solaris")
|
13
|
-
$LOAD_PATH.unshift(Dir.pwd)
|
14
|
-
Dir.chdir("test") rescue nil
|
15
|
-
end
|
16
|
-
|
17
|
-
require "test/unit"
|
18
|
-
require "solaris/file"
|
19
|
-
require "open3"
|
7
|
+
require 'test/unit'
|
8
|
+
require 'solaris/file'
|
20
9
|
|
21
10
|
class TC_Solaris_File < Test::Unit::TestCase
|
22
11
|
def setup
|
12
|
+
Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
|
23
13
|
@dir = Dir.pwd
|
24
14
|
@file = "foo.txt" # trivial
|
25
15
|
@file2 = "bar.txt" # non-trivial
|
@@ -37,7 +27,7 @@ class TC_Solaris_File < Test::Unit::TestCase
|
|
37
27
|
end
|
38
28
|
|
39
29
|
def test_version
|
40
|
-
assert_equal("0.3.
|
30
|
+
assert_equal("0.3.2", File::SOLARIS_VERSION)
|
41
31
|
end
|
42
32
|
|
43
33
|
# CLASS METHODS
|
@@ -148,9 +138,11 @@ class TC_Solaris_File < Test::Unit::TestCase
|
|
148
138
|
|
149
139
|
def teardown
|
150
140
|
@dir = nil
|
151
|
-
@file = nil
|
152
|
-
@file2 = nil
|
153
141
|
@fh.close
|
154
142
|
@fh2.close
|
143
|
+
File.delete(@file) if File.exists?(@file)
|
144
|
+
File.delete(@file2) if File.exists?(@file2)
|
145
|
+
@file = nil
|
146
|
+
@file2 = nil
|
155
147
|
end
|
156
148
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: solaris-file
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date:
|
6
|
+
version: 0.3.2
|
7
|
+
date: 2007-07-24 00:00:00 -06:00
|
8
8
|
summary: ACL and other methods for the File class on Solaris
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: djberg96@gmail.com
|
12
|
-
homepage: http://www.rubyforge.org/projects/
|
13
|
-
rubyforge_project:
|
12
|
+
homepage: http://www.rubyforge.org/projects/solarisutils
|
13
|
+
rubyforge_project: solarisutils
|
14
14
|
description: ACL and other methods for the File class on Solaris
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
@@ -18,35 +18,39 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 1.8.0
|
24
24
|
version:
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
- Daniel Berger
|
30
|
+
- Daniel J. Berger
|
31
31
|
files:
|
32
|
+
- ext/extconf.rb
|
33
|
+
- ext/solaris
|
34
|
+
- ext/solaris/sfile.c
|
35
|
+
- ext/solaris/sfile.h
|
36
|
+
- test/tc_solaris_file.rb
|
37
|
+
- examples/test.rb
|
38
|
+
- README
|
32
39
|
- CHANGES
|
33
40
|
- MANIFEST
|
34
|
-
- README
|
35
|
-
- extconf.rb
|
36
|
-
- lib/solaris/sfile.c
|
37
|
-
- lib/solaris/sfile.h
|
38
|
-
- examples/test.rb
|
39
41
|
test_files:
|
40
42
|
- test/tc_solaris_file.rb
|
41
43
|
rdoc_options: []
|
42
44
|
|
43
45
|
extra_rdoc_files:
|
44
|
-
- CHANGES
|
45
46
|
- README
|
47
|
+
- CHANGES
|
48
|
+
- MANIFEST
|
49
|
+
- ext/solaris/sfile.c
|
46
50
|
executables: []
|
47
51
|
|
48
52
|
extensions:
|
49
|
-
- extconf.rb
|
53
|
+
- ext/extconf.rb
|
50
54
|
requirements: []
|
51
55
|
|
52
56
|
dependencies: []
|