sys-admin 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,47 +1,47 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
- require 'rbconfig'
5
-
6
- CLEAN.include("**/*.gem", "**/*.rbx", "**/*.rbc", "ruby.core")
7
-
8
- namespace :gem do
9
- desc "Create the sys-uname gem"
10
- task :create => [:clean] do
11
- require 'rubygems/package'
12
- spec = eval(IO.read('sys-admin.gemspec'))
13
- spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
14
- Gem::Package.build(spec, true)
15
- end
16
-
17
- desc "Install the sys-uname gem"
18
- task :install => [:create] do
19
- file = Dir["*.gem"].first
20
- sh "gem install -l #{file}"
21
- end
22
- end
23
-
24
- Rake::TestTask.new('test') do |t|
25
- case RbConfig::CONFIG['host_os']
26
- when /darwin|osx/i
27
- t.libs << 'lib/darwin'
28
- when /linux/i
29
- t.libs << 'lib/linux'
30
- when /sunos|solaris/i
31
- t.libs << 'lib/sunos'
32
- when /bsd/i
33
- t.libs << 'lib/bsd'
34
- when /windows|win32|mingw|cygwin|dos/i
35
- t.libs << 'lib/windows'
36
- else
37
- t.libs << 'lib/unix'
38
- end
39
-
40
- t.warning = true
41
- t.verbose = true
42
-
43
- t.libs << 'test'
44
- t.test_files = FileList['test/test_sys_admin.rb']
45
- end
46
-
47
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+
6
+ CLEAN.include("**/*.gem", "**/*.rbx", "**/*.rbc", "ruby.core")
7
+
8
+ namespace :gem do
9
+ desc "Create the sys-uname gem"
10
+ task :create => [:clean] do
11
+ require 'rubygems/package'
12
+ spec = eval(IO.read('sys-admin.gemspec'))
13
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
14
+ Gem::Package.build(spec, true)
15
+ end
16
+
17
+ desc "Install the sys-uname gem"
18
+ task :install => [:create] do
19
+ file = Dir["*.gem"].first
20
+ sh "gem install -l #{file}"
21
+ end
22
+ end
23
+
24
+ Rake::TestTask.new('test') do |t|
25
+ case RbConfig::CONFIG['host_os']
26
+ when /darwin|osx/i
27
+ t.libs << 'lib/darwin'
28
+ when /linux/i
29
+ t.libs << 'lib/linux'
30
+ when /sunos|solaris/i
31
+ t.libs << 'lib/sunos'
32
+ when /bsd/i
33
+ t.libs << 'lib/bsd'
34
+ when /windows|win32|mingw|cygwin|dos/i
35
+ t.libs << 'lib/windows'
36
+ else
37
+ t.libs << 'lib/unix'
38
+ end
39
+
40
+ t.warning = true
41
+ t.verbose = true
42
+
43
+ t.libs << 'test'
44
+ t.test_files = FileList['test/test_sys_admin.rb']
45
+ end
46
+
47
+ task :default => :test
@@ -1,26 +1,26 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
3
3
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
- MB4XDTE4MDIxOTIzMjIxMloXDTI4MDIxNzIzMjIxMlowPzERMA8GA1UEAwwIZGpi
4
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
5
5
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
- bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAOFYobQ3ovXNC4RexrdP
7
- malr3eyK6lvQuS5DOQpHQrT3sRbrhAy5c2effNmznnUzDDGnHs+ZKkAeVmUDIi+K
8
- lfXjV8uPEkLMXUpDndg9rbmQmfie07ixCdE9JYRPwfMTcE+jbtUyZqEUIg7XYmuJ
9
- j28bgsq7I9SMOPS9I+3DiEK50NzGd1ixA+RW8yfApC0jU6KkBQBekETvgQ2OOEH+
10
- RwoQ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gAqYmdnzedsQtE
22
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
23
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
24
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
25
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
26
26
  -----END CERTIFICATE-----
@@ -1,162 +1,162 @@
1
- = Description
2
- A unified, cross-platform replacement for the Etc module that allows you to
3
- get information about users and groups.
4
-
5
- = Synopsis
6
- require 'sys/admin'
7
- include Sys
8
-
9
- Admin.get_login # -> 'djberge'
10
- Admin.get_user('djberge') # -> Admin::User object
11
- Admin.get_group(501) # -> Admin::Group object
12
-
13
- # Iterate over all users
14
- Admin.users do |usr|
15
- p usr
16
- end
17
-
18
- # Iterate over all groups
19
- Admin.groups do |grp|
20
- p grp
21
- end
22
-
23
- = Constants
24
-
25
- = Class Methods
26
- == Sys::Admin
27
- Admin.get_group(name)
28
- Admin.get_group(gid)
29
- Returns a Group object for the given name or gid. Raises an Admin::Error
30
- if a group cannot be found for that name or GID.
31
-
32
- Admin.get_login
33
- Returns the login for the process. If this is called from a process that
34
- has no controlling terminal, then it resorts to returning the "LOGNAME"
35
- or "USER" environment variable. If neither of those is defined, then nil
36
- is returned.
37
-
38
- Note that this method will probably return the real user login, but may
39
- return the effective user login. YMMV depending on your platform and how
40
- the program is run.
41
-
42
- Admin.get_user(name)
43
- Admin.get_user(uid)
44
- Returns a User object for the given name or uid. Raises an Admin::Error if
45
- a user cannot be found for that name or user ID.
46
-
47
- Admin.groups
48
- Admin.groups{ |grp| ... }
49
- In block form, yields a Group object for each group on the system. In
50
- non-block form, returns an Array of Group objects.
51
-
52
- Admin.users
53
- Admin.users{ |grp| ... }
54
- In block form, yields a User object for each group on the system. In
55
- non-block form, returns an Array of User objects.
56
-
57
- == Sys::Admin::Group
58
- Group.new
59
- Group.new{ |grp| ... }
60
- Creates and returns a Group object, which encapsulates the information
61
- typically found within an /etc/group entry, i.e. a struct group. If a
62
- block is provided, yields the object back to the block.
63
-
64
- At the moment this is only useful for MS Windows.
65
-
66
- == Sys::Admin::User
67
- User.new
68
- User.new{ |usr| ... }
69
- Creates and returns a User object, which encapsulates the information
70
- typically found within an /etc/passwd entry, i.e. a struct passwd. If a
71
- block is provided, yields the object back to the block.
72
-
73
- At the moment this is only useful for MS Windows.
74
-
75
- = Instance Methods
76
- == Sys::Admin::Group
77
- Group#gid
78
- The group id.
79
-
80
- Group#members
81
- An array of users that are members of the group.
82
-
83
- Group#name
84
- The name of the group.
85
-
86
- Group#passwd
87
- The group password, if any.
88
-
89
- == Sys::Admin::User
90
- User#age
91
- Used in the past for password aging. Deprecated in favor of /etc/shadow.
92
-
93
- User#change
94
- Next date a password change will be needed.
95
-
96
- User#class
97
- The user's access class.
98
-
99
- User#comment
100
- Another comment field. Rarely used.
101
-
102
- User#dir
103
- The absolute pathname of the user's home directory.
104
-
105
- User#expire
106
- Account expiration date.
107
-
108
- User#gecos
109
- A comment field. Rarely used.
110
-
111
- User#gid
112
- The user's primary group id.
113
-
114
- User#login_device
115
- The name of the terminal device the user last logged on with.
116
-
117
- User#login_host
118
- The hostname from which the user last logged in.
119
-
120
- User#login_time
121
- The last time the user logged in.
122
-
123
- User#name
124
- The user name associated with the account.
125
-
126
- User#passwd
127
- The user's encrypted password. Deprecated in favor of /etc/shadow.
128
-
129
- User#quota
130
- The user's alloted amount of disk space.
131
-
132
- User#shell
133
- The user's login shell.
134
-
135
- User#uid
136
- The user's user id.
137
-
138
- == Notes
139
- Not all platforms support all of the User members. The only ones that are
140
- supported on all platforms are name, uid, gid, dir and shell. The rest
141
- will simply return nil if they aren't supported.
142
-
143
- == Known Bugs
144
- None that I am aware of. Please log any bugs you find on the project
145
- website at http://www.rubyforge.org/projects/sysutils.
146
-
147
- == License
148
- Artistic 2.0
149
-
150
- == Copyright
151
- Copyright 2002-2014, Daniel J. Berger
152
-
153
- All Rights Reserved. This module is free software. It may be used,
154
- redistributed and/or modified under the same terms as Ruby itself.
155
-
156
- == Warranty
157
- This library is provided "as is" and without any express or
158
- implied warranties, including, without limitation, the implied
159
- warranties of merchantability and fitness for a particular purpose.
160
-
161
- == Author
162
- Daniel J. Berger
1
+ = Description
2
+ A unified, cross-platform replacement for the Etc module that allows you to
3
+ get information about users and groups.
4
+
5
+ = Synopsis
6
+ require 'sys/admin'
7
+ include Sys
8
+
9
+ Admin.get_login # -> 'djberge'
10
+ Admin.get_user('djberge') # -> Admin::User object
11
+ Admin.get_group(501) # -> Admin::Group object
12
+
13
+ # Iterate over all users
14
+ Admin.users do |usr|
15
+ p usr
16
+ end
17
+
18
+ # Iterate over all groups
19
+ Admin.groups do |grp|
20
+ p grp
21
+ end
22
+
23
+ = Constants
24
+
25
+ = Class Methods
26
+ == Sys::Admin
27
+ Admin.get_group(name)
28
+ Admin.get_group(gid)
29
+ Returns a Group object for the given name or gid. Raises an Admin::Error
30
+ if a group cannot be found for that name or GID.
31
+
32
+ Admin.get_login
33
+ Returns the login for the process. If this is called from a process that
34
+ has no controlling terminal, then it resorts to returning the "LOGNAME"
35
+ or "USER" environment variable. If neither of those is defined, then nil
36
+ is returned.
37
+
38
+ Note that this method will probably return the real user login, but may
39
+ return the effective user login. YMMV depending on your platform and how
40
+ the program is run.
41
+
42
+ Admin.get_user(name)
43
+ Admin.get_user(uid)
44
+ Returns a User object for the given name or uid. Raises an Admin::Error if
45
+ a user cannot be found for that name or user ID.
46
+
47
+ Admin.groups
48
+ Admin.groups{ |grp| ... }
49
+ In block form, yields a Group object for each group on the system. In
50
+ non-block form, returns an Array of Group objects.
51
+
52
+ Admin.users
53
+ Admin.users{ |grp| ... }
54
+ In block form, yields a User object for each group on the system. In
55
+ non-block form, returns an Array of User objects.
56
+
57
+ == Sys::Admin::Group
58
+ Group.new
59
+ Group.new{ |grp| ... }
60
+ Creates and returns a Group object, which encapsulates the information
61
+ typically found within an /etc/group entry, i.e. a struct group. If a
62
+ block is provided, yields the object back to the block.
63
+
64
+ At the moment this is only useful for MS Windows.
65
+
66
+ == Sys::Admin::User
67
+ User.new
68
+ User.new{ |usr| ... }
69
+ Creates and returns a User object, which encapsulates the information
70
+ typically found within an /etc/passwd entry, i.e. a struct passwd. If a
71
+ block is provided, yields the object back to the block.
72
+
73
+ At the moment this is only useful for MS Windows.
74
+
75
+ = Instance Methods
76
+ == Sys::Admin::Group
77
+ Group#gid
78
+ The group id.
79
+
80
+ Group#members
81
+ An array of users that are members of the group.
82
+
83
+ Group#name
84
+ The name of the group.
85
+
86
+ Group#passwd
87
+ The group password, if any.
88
+
89
+ == Sys::Admin::User
90
+ User#age
91
+ Used in the past for password aging. Deprecated in favor of /etc/shadow.
92
+
93
+ User#change
94
+ Next date a password change will be needed.
95
+
96
+ User#class
97
+ The user's access class.
98
+
99
+ User#comment
100
+ Another comment field. Rarely used.
101
+
102
+ User#dir
103
+ The absolute pathname of the user's home directory.
104
+
105
+ User#expire
106
+ Account expiration date.
107
+
108
+ User#gecos
109
+ A comment field. Rarely used.
110
+
111
+ User#gid
112
+ The user's primary group id.
113
+
114
+ User#login_device
115
+ The name of the terminal device the user last logged on with.
116
+
117
+ User#login_host
118
+ The hostname from which the user last logged in.
119
+
120
+ User#login_time
121
+ The last time the user logged in.
122
+
123
+ User#name
124
+ The user name associated with the account.
125
+
126
+ User#passwd
127
+ The user's encrypted password. Deprecated in favor of /etc/shadow.
128
+
129
+ User#quota
130
+ The user's alloted amount of disk space.
131
+
132
+ User#shell
133
+ The user's login shell.
134
+
135
+ User#uid
136
+ The user's user id.
137
+
138
+ == Notes
139
+ Not all platforms support all of the User members. The only ones that are
140
+ supported on all platforms are name, uid, gid, dir and shell. The rest
141
+ will simply return nil if they aren't supported.
142
+
143
+ == Known Bugs
144
+ None that I am aware of. Please log any bugs you find on the project
145
+ website at http://www.rubyforge.org/projects/sysutils.
146
+
147
+ == License
148
+ Artistic 2.0
149
+
150
+ == Copyright
151
+ Copyright 2002-2014, Daniel J. Berger
152
+
153
+ All Rights Reserved. This module is free software. It may be used,
154
+ redistributed and/or modified under the same terms as Ruby itself.
155
+
156
+ == Warranty
157
+ This library is provided "as is" and without any express or
158
+ implied warranties, including, without limitation, the implied
159
+ warranties of merchantability and fitness for a particular purpose.
160
+
161
+ == Author
162
+ Daniel J. Berger