etc 1.0.1 → 1.1.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 +4 -4
- data/ext/etc/constdefs.h +1494 -0
- data/ext/etc/etc.c +12 -14
- data/ext/etc/extconf.rb +3 -1
- data/stub/etc.rb +1 -0
- metadata +5 -11
- data/.gitignore +0 -13
- data/.travis.yml +0 -7
- data/Gemfile +0 -4
- data/Rakefile +0 -13
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/etc.gemspec +0 -40
data/ext/etc/etc.c
CHANGED
@@ -52,6 +52,8 @@ char *getenv();
|
|
52
52
|
#endif
|
53
53
|
char *getlogin();
|
54
54
|
|
55
|
+
#define RUBY_ETC_VERSION "1.1.0"
|
56
|
+
|
55
57
|
#include "constdefs.h"
|
56
58
|
|
57
59
|
/* call-seq:
|
@@ -98,7 +100,7 @@ static VALUE
|
|
98
100
|
safe_setup_str(const char *str)
|
99
101
|
{
|
100
102
|
if (str == 0) str = "";
|
101
|
-
return
|
103
|
+
return rb_str_new2(str);
|
102
104
|
}
|
103
105
|
|
104
106
|
static VALUE
|
@@ -217,7 +219,6 @@ etc_getpwnam(VALUE obj, VALUE nam)
|
|
217
219
|
struct passwd *pwd;
|
218
220
|
const char *p = StringValueCStr(nam);
|
219
221
|
|
220
|
-
rb_check_safe_obj(nam);
|
221
222
|
pwd = getpwnam(p);
|
222
223
|
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %"PRIsVALUE, nam);
|
223
224
|
return setup_passwd(pwd);
|
@@ -229,7 +230,7 @@ etc_getpwnam(VALUE obj, VALUE nam)
|
|
229
230
|
#ifdef HAVE_GETPWENT
|
230
231
|
static int passwd_blocking = 0;
|
231
232
|
static VALUE
|
232
|
-
passwd_ensure(
|
233
|
+
passwd_ensure(VALUE _)
|
233
234
|
{
|
234
235
|
endpwent();
|
235
236
|
passwd_blocking = (int)Qfalse;
|
@@ -237,7 +238,7 @@ passwd_ensure(void)
|
|
237
238
|
}
|
238
239
|
|
239
240
|
static VALUE
|
240
|
-
passwd_iterate(
|
241
|
+
passwd_iterate(VALUE _)
|
241
242
|
{
|
242
243
|
struct passwd *pw;
|
243
244
|
|
@@ -461,7 +462,6 @@ etc_getgrnam(VALUE obj, VALUE nam)
|
|
461
462
|
struct group *grp;
|
462
463
|
const char *p = StringValueCStr(nam);
|
463
464
|
|
464
|
-
rb_check_safe_obj(nam);
|
465
465
|
grp = getgrnam(p);
|
466
466
|
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %"PRIsVALUE, nam);
|
467
467
|
return setup_group(grp);
|
@@ -473,7 +473,7 @@ etc_getgrnam(VALUE obj, VALUE nam)
|
|
473
473
|
#ifdef HAVE_GETGRENT
|
474
474
|
static int group_blocking = 0;
|
475
475
|
static VALUE
|
476
|
-
group_ensure(
|
476
|
+
group_ensure(VALUE _)
|
477
477
|
{
|
478
478
|
endgrent();
|
479
479
|
group_blocking = (int)Qfalse;
|
@@ -482,7 +482,7 @@ group_ensure(void)
|
|
482
482
|
|
483
483
|
|
484
484
|
static VALUE
|
485
|
-
group_iterate(
|
485
|
+
group_iterate(VALUE _)
|
486
486
|
{
|
487
487
|
struct group *pw;
|
488
488
|
|
@@ -645,7 +645,7 @@ etc_sysconfdir(VALUE obj)
|
|
645
645
|
* Returns system temporary directory; typically "/tmp".
|
646
646
|
*/
|
647
647
|
static VALUE
|
648
|
-
etc_systmpdir(
|
648
|
+
etc_systmpdir(VALUE _)
|
649
649
|
{
|
650
650
|
VALUE tmpdir;
|
651
651
|
#ifdef _WIN32
|
@@ -677,7 +677,10 @@ etc_systmpdir(void)
|
|
677
677
|
}
|
678
678
|
# endif
|
679
679
|
#endif
|
680
|
+
#ifndef RB_PASS_KEYWORDS
|
681
|
+
/* untaint on Ruby < 2.7 */
|
680
682
|
FL_UNSET(tmpdir, FL_TAINT);
|
683
|
+
#endif
|
681
684
|
return tmpdir;
|
682
685
|
}
|
683
686
|
|
@@ -754,9 +757,6 @@ etc_uname(VALUE obj)
|
|
754
757
|
# ifndef PROCESSOR_ARCHITECTURE_AMD64
|
755
758
|
# define PROCESSOR_ARCHITECTURE_AMD64 9
|
756
759
|
# endif
|
757
|
-
# ifndef PROCESSOR_ARCHITECTURE_IA64
|
758
|
-
# define PROCESSOR_ARCHITECTURE_IA64 6
|
759
|
-
# endif
|
760
760
|
# ifndef PROCESSOR_ARCHITECTURE_INTEL
|
761
761
|
# define PROCESSOR_ARCHITECTURE_INTEL 0
|
762
762
|
# endif
|
@@ -768,9 +768,6 @@ etc_uname(VALUE obj)
|
|
768
768
|
case PROCESSOR_ARCHITECTURE_ARM:
|
769
769
|
mach = "ARM";
|
770
770
|
break;
|
771
|
-
case PROCESSOR_ARCHITECTURE_IA64:
|
772
|
-
mach = "IA64";
|
773
|
-
break;
|
774
771
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
775
772
|
mach = "x86";
|
776
773
|
break;
|
@@ -1068,6 +1065,7 @@ Init_etc(void)
|
|
1068
1065
|
VALUE mEtc;
|
1069
1066
|
|
1070
1067
|
mEtc = rb_define_module("Etc");
|
1068
|
+
rb_define_const(mEtc, "VERSION", rb_str_new_cstr(RUBY_ETC_VERSION));
|
1071
1069
|
init_constants(mEtc);
|
1072
1070
|
|
1073
1071
|
rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0);
|
data/ext/etc/extconf.rb
CHANGED
@@ -41,10 +41,12 @@ have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
|
|
41
41
|
have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
|
42
42
|
have_struct_member('struct group', 'gr_passwd', 'grp.h')
|
43
43
|
|
44
|
+
# for https://github.com/ruby/etc
|
44
45
|
srcdir = File.expand_path("..", __FILE__)
|
45
|
-
if !File.
|
46
|
+
if !File.exist?("#{srcdir}/depend")
|
46
47
|
%x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h]
|
47
48
|
end
|
49
|
+
|
48
50
|
$distcleanfiles << "constdefs.h"
|
49
51
|
|
50
52
|
create_makefile("etc")
|
data/stub/etc.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "#{RUBY_VERSION[/\d+\.\d+/]}/etc.so"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,18 +74,13 @@ extensions:
|
|
74
74
|
- ext/etc/extconf.rb
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".gitignore"
|
78
|
-
- ".travis.yml"
|
79
|
-
- Gemfile
|
80
77
|
- LICENSE.txt
|
81
78
|
- README.md
|
82
|
-
-
|
83
|
-
- bin/console
|
84
|
-
- bin/setup
|
85
|
-
- etc.gemspec
|
79
|
+
- ext/etc/constdefs.h
|
86
80
|
- ext/etc/etc.c
|
87
81
|
- ext/etc/extconf.rb
|
88
82
|
- ext/etc/mkconstants.rb
|
83
|
+
- stub/etc.rb
|
89
84
|
- test/etc/test_etc.rb
|
90
85
|
homepage: https://github.com/ruby/etc
|
91
86
|
licenses:
|
@@ -106,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
101
|
- !ruby/object:Gem::Version
|
107
102
|
version: '0'
|
108
103
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.7.7
|
104
|
+
rubygems_version: 3.0.3
|
111
105
|
signing_key:
|
112
106
|
specification_version: 4
|
113
107
|
summary: Provides access to information typically stored in UNIX /etc directory.
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/test_*.rb']
|
8
|
-
end
|
9
|
-
|
10
|
-
require "rake/extensiontask"
|
11
|
-
Rake::ExtensionTask.new("etc")
|
12
|
-
|
13
|
-
task :default => :test
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "etc"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/etc.gemspec
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = "etc"
|
5
|
-
spec.version = "1.0.1"
|
6
|
-
spec.authors = ["Yukihiro Matsumoto"]
|
7
|
-
spec.email = ["matz@ruby-lang.org"]
|
8
|
-
|
9
|
-
spec.summary = %q{Provides access to information typically stored in UNIX /etc directory.}
|
10
|
-
spec.description = %q{Provides access to information typically stored in UNIX /etc directory.}
|
11
|
-
spec.homepage = "https://github.com/ruby/etc"
|
12
|
-
spec.license = "BSD-2-Clause"
|
13
|
-
|
14
|
-
spec.files = %w[
|
15
|
-
.gitignore
|
16
|
-
.travis.yml
|
17
|
-
Gemfile
|
18
|
-
LICENSE.txt
|
19
|
-
README.md
|
20
|
-
Rakefile
|
21
|
-
bin/console
|
22
|
-
bin/setup
|
23
|
-
etc.gemspec
|
24
|
-
ext/etc/etc.c
|
25
|
-
ext/etc/extconf.rb
|
26
|
-
ext/etc/mkconstants.rb
|
27
|
-
test/etc/test_etc.rb
|
28
|
-
]
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
spec.extensions = %w{ext/etc/extconf.rb}
|
33
|
-
|
34
|
-
spec.required_ruby_version = ">= 2.3.0"
|
35
|
-
|
36
|
-
spec.add_development_dependency "bundler"
|
37
|
-
spec.add_development_dependency "rake"
|
38
|
-
spec.add_development_dependency "rake-compiler"
|
39
|
-
spec.add_development_dependency "test-unit"
|
40
|
-
end
|