sys-admin 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/MANIFEST +3 -3
- data/README +1 -1
- data/doc/sys-admin-unix.txt +2 -2
- data/doc/sys-admin-windows.txt +8 -2
- data/ext/sys/admin.c +8 -8
- data/ext/sys/admin.h +1 -1
- data/test/test_sys_admin.rb +1 -1
- data/test/test_sys_admin_windows.rb +10 -0
- metadata +6 -6
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.5.1 - 23-Jul-2009
|
2
|
+
* Added the User#dir attribute. This attribute contains a user's home
|
3
|
+
directory if set, or nil if it isn't.
|
4
|
+
* User objects returned by the Admin.users method now include the uid.
|
5
|
+
Previously only the Admin.get_user method set it.
|
6
|
+
* Added win32-security as a dependency.
|
7
|
+
* Changed license to Artistic 2.0.
|
8
|
+
|
1
9
|
== 1.5.0 - 29-Mar-2009
|
2
10
|
* INTERFACE CHANGE (WINDOWS ONLY): The interface for MS Windows has undergone
|
3
11
|
a radical change. Most methods now accept a hash of options that are
|
data/MANIFEST
CHANGED
data/README
CHANGED
data/doc/sys-admin-unix.txt
CHANGED
@@ -145,10 +145,10 @@ User#uid
|
|
145
145
|
website at http://www.rubyforge.org/projects/sysutils.
|
146
146
|
|
147
147
|
== License
|
148
|
-
|
148
|
+
Artistic 2.0
|
149
149
|
|
150
150
|
== Copyright
|
151
|
-
Copyright 2002-
|
151
|
+
Copyright 2002-2009, Daniel J. Berger
|
152
152
|
|
153
153
|
All Rights Reserved. This module is free software. It may be used,
|
154
154
|
redistributed and/or modified under the same terms as Ruby itself.
|
data/doc/sys-admin-windows.txt
CHANGED
@@ -226,6 +226,12 @@ User#description
|
|
226
226
|
|
227
227
|
User#description=
|
228
228
|
Sets the description of the account.
|
229
|
+
|
230
|
+
User#dir
|
231
|
+
Returns the user's home directory.
|
232
|
+
|
233
|
+
User#dir=
|
234
|
+
Sets the user's home directory.
|
229
235
|
|
230
236
|
User#disabled?
|
231
237
|
Returns whether or not the account is disabled.
|
@@ -311,10 +317,10 @@ User#status
|
|
311
317
|
website at http://www.rubyforge.org/projects/sysutils.
|
312
318
|
|
313
319
|
== License
|
314
|
-
|
320
|
+
Artistic 2.0
|
315
321
|
|
316
322
|
== Copyright
|
317
|
-
Copyright 2002-
|
323
|
+
Copyright 2002-2009, Daniel J. Berger
|
318
324
|
|
319
325
|
All Rights Reserved. This module is free software. It may be used,
|
320
326
|
redistributed and/or modified under the same terms as Ruby itself.
|
data/ext/sys/admin.c
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
/*
|
5
5
|
* call-seq:
|
6
6
|
* User.new
|
7
|
-
* User.new{ |user| ... }
|
7
|
+
* User.new{ |user| ... }
|
8
8
|
*
|
9
9
|
* Creates and returns a User object, which encapsulates the information
|
10
10
|
* typically found within an /etc/passwd entry, i.e. a struct passwd.
|
@@ -21,11 +21,11 @@ static VALUE user_init(VALUE self){
|
|
21
21
|
/*
|
22
22
|
* call-seq:
|
23
23
|
* Group.new
|
24
|
-
* Group.new{ |user| ... }
|
24
|
+
* Group.new{ |user| ... }
|
25
25
|
*
|
26
26
|
* Creates and returns a Group object, which encapsulates the information
|
27
27
|
* typically found within an /etc/group entry, i.e. a struct group.
|
28
|
-
*
|
28
|
+
*
|
29
29
|
* If a block is provided, yields the object back to the block.
|
30
30
|
*/
|
31
31
|
static VALUE group_init(VALUE self){
|
@@ -100,7 +100,7 @@ static VALUE admin_get_login(VALUE klass){
|
|
100
100
|
/* call-seq:
|
101
101
|
* Admin.get_user(name)
|
102
102
|
* Admin.get_user(uid)
|
103
|
-
*
|
103
|
+
*
|
104
104
|
* Returns a User object for the given +name+ or +uid+. Raises an Admin::Error
|
105
105
|
* if a user cannot be found for that name or user ID.
|
106
106
|
*/
|
@@ -118,13 +118,13 @@ static VALUE admin_get_user(VALUE klass, VALUE v_value){
|
|
118
118
|
/* call-seq:
|
119
119
|
* Admin.get_group(name)
|
120
120
|
* Admin.get_group(gid)
|
121
|
-
*
|
121
|
+
*
|
122
122
|
* Returns a Group object for the given +name+ or +gid+. Raises an Admin::Error
|
123
123
|
* if a group cannot be found for that name or GID.
|
124
124
|
*
|
125
125
|
*--
|
126
126
|
* Developer's Note:
|
127
|
-
*
|
127
|
+
*
|
128
128
|
* I generally oppose method overloading like this, but for this method, and
|
129
129
|
* for only two types, I can live with it for the added convenience it
|
130
130
|
* provides.
|
@@ -235,7 +235,7 @@ static VALUE admin_users_body(VALUE klass){
|
|
235
235
|
else
|
236
236
|
rb_ary_push(v_array, get_user(pwd_p));
|
237
237
|
}
|
238
|
-
#else
|
238
|
+
#else
|
239
239
|
while(getpwent_r(&pwd, buf, USER_BUF_SIZE) != NULL){
|
240
240
|
if(rb_block_given_p())
|
241
241
|
rb_yield(get_user(&pwd));
|
@@ -404,6 +404,6 @@ void Init_admin(){
|
|
404
404
|
|
405
405
|
/* Constants */
|
406
406
|
|
407
|
-
/* 1.5.
|
407
|
+
/* 1.5.1: The version of this library */
|
408
408
|
rb_define_const(cAdmin, "VERSION", rb_str_new2(SYS_ADMIN_VERSION));
|
409
409
|
}
|
data/ext/sys/admin.h
CHANGED
data/test/test_sys_admin.rb
CHANGED
@@ -256,6 +256,16 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
256
256
|
assert_respond_to(@user, :uid=)
|
257
257
|
end
|
258
258
|
|
259
|
+
def test_user_dir_basic
|
260
|
+
assert_respond_to(@user, :dir)
|
261
|
+
assert_respond_to(@user, :dir=)
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_user_dir
|
265
|
+
assert_nothing_raised{ Admin.get_user(@user_name, :localaccount => true) }
|
266
|
+
assert_kind_of(String, @user_name.dir)
|
267
|
+
end
|
268
|
+
|
259
269
|
# Group class
|
260
270
|
|
261
271
|
def test_group_instance_caption
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-23 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: " The sys-admin library is a unified, cross platform replacement for the\n 'etc' library that ships as part of the Ruby standard library. It\n provides a common interface for all platforms, including MS Windows. In\n addition, it provides an interface for adding, deleting and configuring\n users on MS Windows.\n"
|
17
17
|
email: djberg96@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
@@ -40,8 +40,8 @@ files:
|
|
40
40
|
- ext/sys/admin.h
|
41
41
|
has_rdoc: true
|
42
42
|
homepage: http://www.rubyforge.org/projects/sysutils
|
43
|
-
licenses:
|
44
|
-
|
43
|
+
licenses:
|
44
|
+
- Artistic 2.0
|
45
45
|
post_install_message:
|
46
46
|
rdoc_options: []
|
47
47
|
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements: []
|
63
63
|
|
64
64
|
rubyforge_project: sysutils
|
65
|
-
rubygems_version: 1.3.
|
65
|
+
rubygems_version: 1.3.4
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
68
|
summary: A unified, cross platform replacement for the "etc" library.
|