rubysl-etc 2.0.3 → 3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee6d053975dbb100b98f68ed45aa64a3c9cf9b0b
4
- data.tar.gz: 7f294c428dcf39f19c43c373b2c5c83d86d00aec
3
+ metadata.gz: e74ff380d65e107d956b8592edb37dedc6778d20
4
+ data.tar.gz: 87cf1a354601e303ae60ba5cff7cda4fb1da4353
5
5
  SHA512:
6
- metadata.gz: 4dc9353611f8807087220d673b85a00709e8ebb147f71438fca607cf1a260aefec5cacae3fa1aa2f9e1af39442e1c48e5a4fde531e4229d29621c8328d2a697c
7
- data.tar.gz: defc957fcf8ace447ddf0f1409d6d87dea77e6772c4d1f9a23001adb25689422b60889ae1a20d3a062e9e082c7904790e3234934c684b9c520bff2e41d751fb0
6
+ metadata.gz: 1ea9386cdd73741ada84da82df12c4f2b13aec8bf8e2f1cfc5ea1a1592c05185c4175fb364ea3332c46a5f87955eb374b115f185c90c5f7ae6d5d4114c5b8e70
7
+ data.tar.gz: 1fa5be7d562a6401b63b1cf84994905c6c333cef40a50701ffba00874106ab3d40860d4e3002c13856ff156d0d507781061f6d89425807a278652d77adc7a1e2
@@ -1,11 +1,14 @@
1
1
  language: ruby
2
- before_install:
3
- - rvm use $RVM --install --binary --fuzzy
4
- - gem update --system
5
- - gem --version
6
- - gem install rubysl-bundler
7
- - gem install rubysl-rake
8
- - rake
9
2
  env:
10
- - RVM=rbx-nightly-d21 RUBYLIB=lib
11
- script: bundle exec mspec spec
3
+ - RUBYLIB=lib
4
+ - RUBYLIB=
5
+ script: mspec spec
6
+ rvm:
7
+ - 2.0.0
8
+ - rbx-2.2.1
9
+ matrix:
10
+ exclude:
11
+ - rvm: 2.0.0
12
+ env: RUBYLIB=lib
13
+ - rvm: rbx-2.2.1
14
+ env: RUBYLIB=
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/lib/etc.rb CHANGED
@@ -1 +1,179 @@
1
- require "rubysl/etc"
1
+ # This file is generated FFI::FileProcessor from etc.rb.ffi.
2
+
3
+ class Struct::Passwd < Rubinius::FFI::Struct
4
+ layout :pw_name, Rubinius::Config['rbx.platform.pwd.pw_name.type'].to_sym,
5
+ Rubinius::Config['rbx.platform.pwd.pw_name.offset'],
6
+ :pw_passwd, Rubinius::Config['rbx.platform.pwd.pw_passwd.type'].to_sym,
7
+ Rubinius::Config['rbx.platform.pwd.pw_passwd.offset'],
8
+ :pw_uid, Rubinius::Config['rbx.platform.pwd.pw_uid.type'].to_sym,
9
+ Rubinius::Config['rbx.platform.pwd.pw_uid.offset'],
10
+ :pw_gid, Rubinius::Config['rbx.platform.pwd.pw_gid.type'].to_sym,
11
+ Rubinius::Config['rbx.platform.pwd.pw_gid.offset'],
12
+ :pw_gecos, Rubinius::Config['rbx.platform.pwd.pw_gecos.type'].to_sym,
13
+ Rubinius::Config['rbx.platform.pwd.pw_gecos.offset'],
14
+ :pw_dir, Rubinius::Config['rbx.platform.pwd.pw_dir.type'].to_sym,
15
+ Rubinius::Config['rbx.platform.pwd.pw_dir.offset'],
16
+ :pw_shell, Rubinius::Config['rbx.platform.pwd.pw_shell.type'].to_sym,
17
+ Rubinius::Config['rbx.platform.pwd.pw_shell.offset']
18
+
19
+ def name; self[:pw_name]; end
20
+ def passwd; self[:pw_passwd]; end
21
+ def uid; self[:pw_uid]; end
22
+ def gid; self[:pw_gid]; end
23
+ def gecos; self[:pw_gecos]; end
24
+ def dir; self[:pw_dir]; end
25
+ def shell; self[:pw_shell]; end
26
+ end
27
+
28
+ class Struct::Group < Rubinius::FFI::Struct
29
+ layout :gr_name, Rubinius::Config['rbx.platform.grp.gr_name.type'].to_sym,
30
+ Rubinius::Config['rbx.platform.grp.gr_name.offset'],
31
+ :gr_passwd, Rubinius::Config['rbx.platform.grp.gr_passwd.type'].to_sym,
32
+ Rubinius::Config['rbx.platform.grp.gr_passwd.offset'],
33
+ :gr_gid, Rubinius::Config['rbx.platform.grp.gr_gid.type'].to_sym,
34
+ Rubinius::Config['rbx.platform.grp.gr_gid.offset'],
35
+ :gr_mem, Rubinius::Config['rbx.platform.grp.gr_mem.type'].to_sym,
36
+ Rubinius::Config['rbx.platform.grp.gr_mem.offset']
37
+
38
+ FFI = Rubinius::FFI
39
+
40
+ def name; self[:gr_name]; end
41
+ def gid; self[:gr_gid]; end
42
+ def passwd; self[:gr_passwd]; end
43
+ def mem
44
+ ptr = self[:gr_mem].read_pointer
45
+
46
+ ary = []
47
+ i = 1
48
+
49
+ while not ptr.null? do
50
+ ary << ptr.read_string
51
+ ptr = (self[:gr_mem] + i * FFI::Pointer.size).read_pointer
52
+ i += 1
53
+ end
54
+
55
+ ary
56
+ end
57
+ end
58
+
59
+ module Etc
60
+ FFI = Rubinius::FFI
61
+
62
+ const_set(:Passwd, Struct::Passwd)
63
+ const_set(:Group, Struct::Group)
64
+
65
+ def self.getlogin
66
+ getpwuid.name
67
+ end
68
+
69
+ def self.getpwnam(name)
70
+ login = StringValue(name)
71
+
72
+ passwd_ptr = FFI::Platform::POSIX.getpwnam(name)
73
+ if passwd_ptr.nil?
74
+ raise ArgumentError, "cannot find user - #{name}"
75
+ end
76
+
77
+ Struct::Passwd.new(passwd_ptr)
78
+ end
79
+
80
+ def self.getpwuid(uid = Process.uid)
81
+ uid = Rubinius::Type.coerce_to(uid, Integer, :to_int)
82
+
83
+ passwd_ptr = FFI::Platform::POSIX.getpwuid(uid)
84
+ if passwd_ptr.nil?
85
+ raise ArgumentError, "cannot find user - #{uid}"
86
+ end
87
+
88
+ Struct::Passwd.new(passwd_ptr)
89
+ end
90
+
91
+ def self.setpwent
92
+ FFI::Platform::POSIX.setpwent
93
+ end
94
+
95
+ def self.getpwent
96
+ passwd_ptr = FFI::Platform::POSIX.getpwent
97
+ return nil if passwd_ptr.nil?
98
+
99
+ Struct::Passwd.new(passwd_ptr)
100
+ end
101
+
102
+ def self.endpwent
103
+ FFI::Platform::POSIX.endpwent
104
+ end
105
+
106
+ def self.passwd
107
+ Rubinius.synchronize(self) do
108
+ begin
109
+ setpwent
110
+
111
+ loop do
112
+ pw = getpwent
113
+ return if pw.nil?
114
+
115
+ yield pw
116
+ end
117
+ ensure
118
+ endpwent
119
+ end
120
+ end
121
+ end
122
+
123
+ def self.getgrnam(name)
124
+ name = StringValue(name)
125
+
126
+ group_ptr = FFI::Platform::POSIX.getgrnam(name)
127
+ if group_ptr.nil?
128
+ raise ArgumentError, "cannot find group - #{name}"
129
+ end
130
+
131
+ Struct::Group.new(group_ptr)
132
+ end
133
+
134
+ def self.getgrgid(gid = Process.gid)
135
+ gid = Rubinius::Type.coerce_to(gid, Integer, :to_int)
136
+
137
+ group_ptr = FFI::Platform::POSIX.getgrgid(gid)
138
+ if group_ptr.nil?
139
+ raise ArgumentError, "cannot find group - #{gid}"
140
+ end
141
+
142
+ Struct::Group.new(group_ptr)
143
+ end
144
+
145
+ def self.setgrent
146
+ FFI::Platform::POSIX.setgrent
147
+ end
148
+
149
+ def self.getgrent
150
+ group_ptr = FFI::Platform::POSIX.getgrent
151
+ return nil if group_ptr.nil?
152
+
153
+ Struct::Group.new(group_ptr)
154
+ end
155
+
156
+ def self.endgrent
157
+ FFI::Platform::POSIX.endgrent
158
+ end
159
+
160
+ def self.group
161
+ Rubinius.synchronize(self) do
162
+ begin
163
+ raise "parallel group iteration" if @parallel_iteration
164
+ @parallel_iteration = true
165
+ setgrent
166
+
167
+ loop do
168
+ gr = getgrent
169
+ return if gr.nil?
170
+
171
+ yield gr
172
+ end
173
+ ensure
174
+ endgrent
175
+ @parallel_iteration = false
176
+ end
177
+ end
178
+ end
179
+ end
@@ -1,2 +1,2 @@
1
- require "rubysl/etc/etc"
1
+ require "etc"
2
2
  require "rubysl/etc/version"
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Etc
3
- VERSION = "2.0.3"
3
+ VERSION = "3.0"
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.files = `git ls-files`.split($/)
15
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
- spec.extensions = ["lib/rubysl/etc/extconf.rb"]
16
+ spec.extensions = []
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-etc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: '3.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-05 00:00:00.000000000 Z
11
+ date: 2017-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi2-generators
@@ -84,20 +84,18 @@ description: Ruby standard library etc.
84
84
  email:
85
85
  - brixen@gmail.com
86
86
  executables: []
87
- extensions:
88
- - lib/rubysl/etc/extconf.rb
87
+ extensions: []
89
88
  extra_rdoc_files: []
90
89
  files:
91
90
  - ".gitignore"
92
91
  - ".travis.yml"
93
92
  - Gemfile
94
93
  - LICENSE
94
+ - MRI_LICENSE
95
95
  - README.md
96
96
  - Rakefile
97
97
  - lib/etc.rb
98
98
  - lib/rubysl/etc.rb
99
- - lib/rubysl/etc/etc.rb.ffi
100
- - lib/rubysl/etc/extconf.rb
101
99
  - lib/rubysl/etc/version.rb
102
100
  - rubysl-etc.gemspec
103
101
  - spec/endgrent_spec.rb
@@ -136,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
134
  version: '0'
137
135
  requirements: []
138
136
  rubyforge_project:
139
- rubygems_version: 2.0.7
137
+ rubygems_version: 2.5.1
140
138
  signing_key:
141
139
  specification_version: 4
142
140
  summary: Ruby standard library etc.
@@ -157,4 +155,3 @@ test_files:
157
155
  - spec/shared/windows.rb
158
156
  - spec/struct_group_spec.rb
159
157
  - spec/struct_passwd_spec.rb
160
- has_rdoc:
@@ -1,182 +0,0 @@
1
- class Struct::Passwd < Rubinius::FFI::Struct
2
- @@@
3
- struct do |s|
4
- s.include "sys/types.h"
5
- s.include "pwd.h"
6
-
7
- s.name "struct passwd"
8
- s.field :pw_name, :string
9
- s.field :pw_passwd, :string
10
- s.field :pw_uid, :uid_t
11
- s.field :pw_gid, :gid_t
12
- s.field :pw_gecos, :string
13
- s.field :pw_dir, :string
14
- s.field :pw_shell, :string
15
- end
16
- @@@
17
-
18
- def name; self[:pw_name]; end
19
- def passwd; self[:pw_passwd]; end
20
- def uid; self[:pw_uid]; end
21
- def gid; self[:pw_gid]; end
22
- def gecos; self[:pw_gecos]; end
23
- def dir; self[:pw_dir]; end
24
- def shell; self[:pw_shell]; end
25
- end
26
-
27
- class Struct::Group < Rubinius::FFI::Struct
28
- @@@
29
- struct do |s|
30
- s.include "sys/types.h"
31
- s.include "grp.h"
32
-
33
- s.name "struct group"
34
- s.field :gr_name, :string
35
- s.field :gr_passwd, :string
36
- s.field :gr_gid, :gid_t
37
- s.field :gr_mem, :pointer
38
- end
39
- @@@
40
-
41
- FFI = Rubinius::FFI
42
-
43
- def name; self[:gr_name]; end
44
- def gid; self[:gr_gid]; end
45
- def passwd; self[:gr_passwd]; end
46
- def mem
47
- ptr = self[:gr_mem].read_pointer
48
-
49
- ary = []
50
- i = 1
51
-
52
- while not ptr.null? do
53
- ary << ptr.read_string
54
- ptr = (self[:gr_mem] + i * FFI::Pointer.size).read_pointer
55
- i += 1
56
- end
57
-
58
- ary
59
- end
60
- end
61
-
62
- module Etc
63
- FFI = Rubinius::FFI
64
-
65
- const_set(:Passwd, Struct::Passwd)
66
- const_set(:Group, Struct::Group)
67
-
68
- def self.getlogin
69
- getpwuid.name
70
- end
71
-
72
- def self.getpwnam(name)
73
- login = StringValue(name)
74
-
75
- passwd_ptr = FFI::Platform::POSIX.getpwnam(name)
76
- if passwd_ptr.nil?
77
- raise ArgumentError, "cannot find user - #{name}"
78
- end
79
-
80
- Struct::Passwd.new(passwd_ptr)
81
- end
82
-
83
- def self.getpwuid(uid = Process.uid)
84
- uid = Rubinius::Type.coerce_to(uid, Integer, :to_int)
85
-
86
- passwd_ptr = FFI::Platform::POSIX.getpwuid(uid)
87
- if passwd_ptr.nil?
88
- raise ArgumentError, "cannot find user - #{uid}"
89
- end
90
-
91
- Struct::Passwd.new(passwd_ptr)
92
- end
93
-
94
- def self.setpwent
95
- FFI::Platform::POSIX.setpwent
96
- end
97
-
98
- def self.getpwent
99
- passwd_ptr = FFI::Platform::POSIX.getpwent
100
- return nil if passwd_ptr.nil?
101
-
102
- Struct::Passwd.new(passwd_ptr)
103
- end
104
-
105
- def self.endpwent
106
- FFI::Platform::POSIX.endpwent
107
- end
108
-
109
- def self.passwd
110
- Rubinius.synchronize(self) do
111
- begin
112
- setpwent
113
-
114
- loop do
115
- pw = getpwent
116
- return if pw.nil?
117
-
118
- yield pw
119
- end
120
- ensure
121
- endpwent
122
- end
123
- end
124
- end
125
-
126
- def self.getgrnam(name)
127
- name = StringValue(name)
128
-
129
- group_ptr = FFI::Platform::POSIX.getgrnam(name)
130
- if group_ptr.nil?
131
- raise ArgumentError, "cannot find group - #{name}"
132
- end
133
-
134
- Struct::Group.new(group_ptr)
135
- end
136
-
137
- def self.getgrgid(gid = Process.gid)
138
- gid = Rubinius::Type.coerce_to(gid, Integer, :to_int)
139
-
140
- group_ptr = FFI::Platform::POSIX.getgrgid(gid)
141
- if group_ptr.nil?
142
- raise ArgumentError, "cannot find group - #{gid}"
143
- end
144
-
145
- Struct::Group.new(group_ptr)
146
- end
147
-
148
- def self.setgrent
149
- FFI::Platform::POSIX.setgrent
150
- end
151
-
152
- def self.getgrent
153
- group_ptr = FFI::Platform::POSIX.getgrent
154
- return nil if group_ptr.nil?
155
-
156
- Struct::Group.new(group_ptr)
157
- end
158
-
159
- def self.endgrent
160
- FFI::Platform::POSIX.endgrent
161
- end
162
-
163
- def self.group
164
- Rubinius.synchronize(self) do
165
- begin
166
- raise "parallel group iteration" if @parallel_iteration
167
- @parallel_iteration = true
168
- setgrent
169
-
170
- loop do
171
- gr = getgrent
172
- return if gr.nil?
173
-
174
- yield gr
175
- end
176
- ensure
177
- endgrent
178
- @parallel_iteration = false
179
- end
180
- end
181
- end
182
- end
@@ -1,15 +0,0 @@
1
- require "ffi2/generators"
2
-
3
- FFI::FileProcessor.new "etc.rb.ffi", "etc.rb"
4
-
5
- # Fake out rubygem's expected build steps with extconf.rb
6
- File.open "Makefile", "w" do |f|
7
- f.puts <<-EOM
8
- .PHONY: all install
9
-
10
- all:
11
-
12
- install:
13
-
14
- EOM
15
- end