etc 1.4.3 → 1.4.5
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/ChangeLog +4 -140
- data/LICENSE.txt +3 -3
- data/ext/etc/constdefs.h +187 -0
- data/ext/etc/etc.c +96 -46
- data/ext/etc/mkconstants.rb +22 -10
- data/test/etc/test_etc.rb +4 -0
- metadata +6 -24
- data/logs/ChangeLog-1.0.0 +0 -65
- data/logs/ChangeLog-1.0.1 +0 -71
- data/logs/ChangeLog-1.1.0 +0 -143
- data/logs/ChangeLog-1.2.0 +0 -124
- data/logs/ChangeLog-1.3.0 +0 -83
- data/logs/ChangeLog-1.3.1 +0 -145
- data/logs/ChangeLog-1.4.0 +0 -73
- data/logs/ChangeLog-1.4.1 +0 -97
- data/logs/ChangeLog-1.4.2 +0 -22
data/ext/etc/etc.c
CHANGED
@@ -56,7 +56,9 @@ static VALUE sGroup;
|
|
56
56
|
#endif
|
57
57
|
RUBY_EXTERN char *getlogin(void);
|
58
58
|
|
59
|
-
#define RUBY_ETC_VERSION "1.4.
|
59
|
+
#define RUBY_ETC_VERSION "1.4.5"
|
60
|
+
|
61
|
+
#define SYMBOL_LIT(str) ID2SYM(rb_intern_const(str ""))
|
60
62
|
|
61
63
|
#ifdef HAVE_RB_DEPRECATE_CONSTANT
|
62
64
|
void rb_deprecate_constant(VALUE mod, const char *name);
|
@@ -203,7 +205,7 @@ setup_passwd(struct passwd *pwd)
|
|
203
205
|
#endif
|
204
206
|
|
205
207
|
/* call-seq:
|
206
|
-
* getpwuid(uid) -> Passwd
|
208
|
+
* getpwuid(uid) -> Etc::Passwd
|
207
209
|
*
|
208
210
|
* Returns the <tt>/etc/passwd</tt> information for the user with the given
|
209
211
|
* integer +uid+.
|
@@ -215,7 +217,7 @@ setup_passwd(struct passwd *pwd)
|
|
215
217
|
*
|
216
218
|
* See the unix manpage for <code>getpwuid(3)</code> for more detail.
|
217
219
|
*
|
218
|
-
*
|
220
|
+
* *Example:*
|
219
221
|
*
|
220
222
|
* Etc.getpwuid(0)
|
221
223
|
* #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
|
@@ -243,7 +245,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
|
|
243
245
|
}
|
244
246
|
|
245
247
|
/* call-seq:
|
246
|
-
* getpwnam(name) -> Passwd
|
248
|
+
* getpwnam(name) -> Etc::Passwd
|
247
249
|
*
|
248
250
|
* Returns the <tt>/etc/passwd</tt> information for the user with specified
|
249
251
|
* login +name+.
|
@@ -252,7 +254,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
|
|
252
254
|
*
|
253
255
|
* See the unix manpage for <code>getpwnam(3)</code> for more detail.
|
254
256
|
*
|
255
|
-
*
|
257
|
+
* *Example:*
|
256
258
|
*
|
257
259
|
* Etc.getpwnam('root')
|
258
260
|
* #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
|
@@ -307,8 +309,8 @@ each_passwd(void)
|
|
307
309
|
#endif
|
308
310
|
|
309
311
|
/* call-seq:
|
310
|
-
*
|
311
|
-
*
|
312
|
+
* passwd { |struct| block }
|
313
|
+
* passwd -> Etc::Passwd
|
312
314
|
*
|
313
315
|
* Provides a convenient Ruby iterator which executes a block for each entry
|
314
316
|
* in the <tt>/etc/passwd</tt> file.
|
@@ -317,7 +319,7 @@ each_passwd(void)
|
|
317
319
|
*
|
318
320
|
* See ::getpwent above for details.
|
319
321
|
*
|
320
|
-
* Example
|
322
|
+
* *Example:*
|
321
323
|
*
|
322
324
|
* require 'etc'
|
323
325
|
*
|
@@ -343,7 +345,7 @@ etc_passwd(VALUE obj)
|
|
343
345
|
}
|
344
346
|
|
345
347
|
/* call-seq:
|
346
|
-
* Etc::Passwd.each { |struct| block } -> Passwd
|
348
|
+
* Etc::Passwd.each { |struct| block } -> Etc::Passwd
|
347
349
|
* Etc::Passwd.each -> Enumerator
|
348
350
|
*
|
349
351
|
* Iterates for each entry in the <tt>/etc/passwd</tt> file if a block is
|
@@ -355,7 +357,7 @@ etc_passwd(VALUE obj)
|
|
355
357
|
*
|
356
358
|
* See Etc.getpwent above for details.
|
357
359
|
*
|
358
|
-
* Example
|
360
|
+
* *Example:*
|
359
361
|
*
|
360
362
|
* require 'etc'
|
361
363
|
*
|
@@ -377,7 +379,10 @@ etc_each_passwd(VALUE obj)
|
|
377
379
|
return obj;
|
378
380
|
}
|
379
381
|
|
380
|
-
/*
|
382
|
+
/* call-seq:
|
383
|
+
* setpwent
|
384
|
+
*
|
385
|
+
* Resets the process of reading the <tt>/etc/passwd</tt> file, so that the
|
381
386
|
* next call to ::getpwent will return the first entry again.
|
382
387
|
*/
|
383
388
|
static VALUE
|
@@ -389,7 +394,10 @@ etc_setpwent(VALUE obj)
|
|
389
394
|
return Qnil;
|
390
395
|
}
|
391
396
|
|
392
|
-
/*
|
397
|
+
/* call-seq:
|
398
|
+
* endpwent
|
399
|
+
*
|
400
|
+
* Ends the process of scanning through the <tt>/etc/passwd</tt> file begun
|
393
401
|
* with ::getpwent, and closes the file.
|
394
402
|
*/
|
395
403
|
static VALUE
|
@@ -401,7 +409,10 @@ etc_endpwent(VALUE obj)
|
|
401
409
|
return Qnil;
|
402
410
|
}
|
403
411
|
|
404
|
-
/*
|
412
|
+
/* call-seq:
|
413
|
+
* getpwent -> Etc::Passwd
|
414
|
+
*
|
415
|
+
* Returns an entry from the <tt>/etc/passwd</tt> file.
|
405
416
|
*
|
406
417
|
* The first time it is called it opens the file and returns the first entry;
|
407
418
|
* each successive call returns the next entry, or +nil+ if the end of the file
|
@@ -449,7 +460,7 @@ setup_group(struct group *grp)
|
|
449
460
|
#endif
|
450
461
|
|
451
462
|
/* call-seq:
|
452
|
-
* getgrgid(group_id) -> Group
|
463
|
+
* getgrgid(group_id) -> Etc::Group
|
453
464
|
*
|
454
465
|
* Returns information about the group with specified integer +group_id+,
|
455
466
|
* as found in <tt>/etc/group</tt>.
|
@@ -458,7 +469,7 @@ setup_group(struct group *grp)
|
|
458
469
|
*
|
459
470
|
* See the unix manpage for <code>getgrgid(3)</code> for more detail.
|
460
471
|
*
|
461
|
-
*
|
472
|
+
* *Example:*
|
462
473
|
*
|
463
474
|
* Etc.getgrgid(100)
|
464
475
|
* #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
|
@@ -487,7 +498,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
|
|
487
498
|
}
|
488
499
|
|
489
500
|
/* call-seq:
|
490
|
-
* getgrnam(name) -> Group
|
501
|
+
* getgrnam(name) -> Etc::Group
|
491
502
|
*
|
492
503
|
* Returns information about the group with specified +name+, as found in
|
493
504
|
* <tt>/etc/group</tt>.
|
@@ -496,7 +507,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
|
|
496
507
|
*
|
497
508
|
* See the unix manpage for <code>getgrnam(3)</code> for more detail.
|
498
509
|
*
|
499
|
-
*
|
510
|
+
* *Example:*
|
500
511
|
*
|
501
512
|
* Etc.getgrnam('users')
|
502
513
|
* #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
|
@@ -529,7 +540,6 @@ group_ensure(VALUE _)
|
|
529
540
|
return Qnil;
|
530
541
|
}
|
531
542
|
|
532
|
-
|
533
543
|
static VALUE
|
534
544
|
group_iterate(VALUE _)
|
535
545
|
{
|
@@ -552,14 +562,18 @@ each_group(void)
|
|
552
562
|
}
|
553
563
|
#endif
|
554
564
|
|
555
|
-
/*
|
565
|
+
/* call-seq:
|
566
|
+
* group { |struct| block }
|
567
|
+
* group -> Etc::Group
|
568
|
+
*
|
569
|
+
* Provides a convenient Ruby iterator which executes a block for each entry
|
556
570
|
* in the <tt>/etc/group</tt> file.
|
557
571
|
*
|
558
572
|
* The code block is passed an Group struct.
|
559
573
|
*
|
560
574
|
* See ::getgrent above for details.
|
561
575
|
*
|
562
|
-
* Example
|
576
|
+
* *Example:*
|
563
577
|
*
|
564
578
|
* require 'etc'
|
565
579
|
*
|
@@ -586,7 +600,7 @@ etc_group(VALUE obj)
|
|
586
600
|
|
587
601
|
#ifdef HAVE_GETGRENT
|
588
602
|
/* call-seq:
|
589
|
-
* Etc::Group.each { |group| block } ->
|
603
|
+
* Etc::Group.each { |group| block } -> Etc::Group
|
590
604
|
* Etc::Group.each -> Enumerator
|
591
605
|
*
|
592
606
|
* Iterates for each entry in the <tt>/etc/group</tt> file if a block is
|
@@ -596,7 +610,7 @@ etc_group(VALUE obj)
|
|
596
610
|
*
|
597
611
|
* The code block is passed a Group struct.
|
598
612
|
*
|
599
|
-
* Example
|
613
|
+
* *Example:*
|
600
614
|
*
|
601
615
|
* require 'etc'
|
602
616
|
*
|
@@ -617,7 +631,10 @@ etc_each_group(VALUE obj)
|
|
617
631
|
}
|
618
632
|
#endif
|
619
633
|
|
620
|
-
/*
|
634
|
+
/* call-seq:
|
635
|
+
* setgrent
|
636
|
+
*
|
637
|
+
* Resets the process of reading the <tt>/etc/group</tt> file, so that the
|
621
638
|
* next call to ::getgrent will return the first entry again.
|
622
639
|
*/
|
623
640
|
static VALUE
|
@@ -629,7 +646,10 @@ etc_setgrent(VALUE obj)
|
|
629
646
|
return Qnil;
|
630
647
|
}
|
631
648
|
|
632
|
-
/*
|
649
|
+
/* call-seq:
|
650
|
+
* endgrent
|
651
|
+
*
|
652
|
+
* Ends the process of scanning through the <tt>/etc/group</tt> file begun
|
633
653
|
* by ::getgrent, and closes the file.
|
634
654
|
*/
|
635
655
|
static VALUE
|
@@ -641,7 +661,10 @@ etc_endgrent(VALUE obj)
|
|
641
661
|
return Qnil;
|
642
662
|
}
|
643
663
|
|
644
|
-
/*
|
664
|
+
/* call-seq:
|
665
|
+
* getgrent -> Etc::Group
|
666
|
+
*
|
667
|
+
* Returns an entry from the <tt>/etc/group</tt> file.
|
645
668
|
*
|
646
669
|
* The first time it is called it opens the file and returns the first entry;
|
647
670
|
* each successive call returns the next entry, or +nil+ if the end of the file
|
@@ -670,9 +693,21 @@ etc_getgrent(VALUE obj)
|
|
670
693
|
VALUE rb_w32_special_folder(int type);
|
671
694
|
UINT rb_w32_system_tmpdir(WCHAR *path, UINT len);
|
672
695
|
VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
|
696
|
+
#elif defined(LOAD_RELATIVE)
|
697
|
+
static inline VALUE
|
698
|
+
rbconfig(void)
|
699
|
+
{
|
700
|
+
VALUE config;
|
701
|
+
rb_require("rbconfig");
|
702
|
+
config = rb_const_get(rb_path2class("RbConfig"), rb_intern_const("CONFIG"));
|
703
|
+
Check_Type(config, T_HASH);
|
704
|
+
return config;
|
705
|
+
}
|
673
706
|
#endif
|
674
707
|
|
675
|
-
/*
|
708
|
+
/* call-seq:
|
709
|
+
* sysconfdir -> String
|
710
|
+
*
|
676
711
|
* Returns system configuration directory.
|
677
712
|
*
|
678
713
|
* This is typically <code>"/etc"</code>, but is modified by the prefix used
|
@@ -687,12 +722,16 @@ etc_sysconfdir(VALUE obj)
|
|
687
722
|
{
|
688
723
|
#ifdef _WIN32
|
689
724
|
return rb_w32_special_folder(CSIDL_COMMON_APPDATA);
|
725
|
+
#elif defined(LOAD_RELATIVE)
|
726
|
+
return rb_hash_aref(rbconfig(), rb_str_new_lit("sysconfdir"));
|
690
727
|
#else
|
691
728
|
return rb_filesystem_str_new_cstr(SYSCONFDIR);
|
692
729
|
#endif
|
693
730
|
}
|
694
731
|
|
695
|
-
/*
|
732
|
+
/* call-seq:
|
733
|
+
* systmpdir -> String
|
734
|
+
*
|
696
735
|
* Returns system temporary directory; typically "/tmp".
|
697
736
|
*/
|
698
737
|
static VALUE
|
@@ -736,13 +775,15 @@ etc_systmpdir(VALUE _)
|
|
736
775
|
}
|
737
776
|
|
738
777
|
#ifdef HAVE_UNAME
|
739
|
-
/*
|
778
|
+
/* call-seq:
|
779
|
+
* uname -> hash
|
780
|
+
*
|
740
781
|
* Returns the system information obtained by uname system call.
|
741
782
|
*
|
742
783
|
* The return value is a hash which has 5 keys at least:
|
743
784
|
* :sysname, :nodename, :release, :version, :machine
|
744
785
|
*
|
745
|
-
* Example
|
786
|
+
* *Example:*
|
746
787
|
*
|
747
788
|
* require 'etc'
|
748
789
|
* require 'pp'
|
@@ -784,12 +825,12 @@ etc_uname(VALUE obj)
|
|
784
825
|
sysname = "Windows";
|
785
826
|
break;
|
786
827
|
}
|
787
|
-
rb_hash_aset(result,
|
828
|
+
rb_hash_aset(result, SYMBOL_LIT("sysname"), rb_str_new_cstr(sysname));
|
788
829
|
release = rb_sprintf("%lu.%lu.%lu", v.dwMajorVersion, v.dwMinorVersion, v.dwBuildNumber);
|
789
|
-
rb_hash_aset(result,
|
830
|
+
rb_hash_aset(result, SYMBOL_LIT("release"), release);
|
790
831
|
version = rb_sprintf("%s Version %"PRIsVALUE": %"PRIsVALUE, sysname, release,
|
791
832
|
rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding()));
|
792
|
-
rb_hash_aset(result,
|
833
|
+
rb_hash_aset(result, SYMBOL_LIT("version"), version);
|
793
834
|
|
794
835
|
# if defined _MSC_VER && _MSC_VER < 1300
|
795
836
|
# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameW(ptr, plen)
|
@@ -803,7 +844,7 @@ etc_uname(VALUE obj)
|
|
803
844
|
}
|
804
845
|
ALLOCV_END(vbuf);
|
805
846
|
if (NIL_P(nodename)) nodename = rb_str_new(0, 0);
|
806
|
-
rb_hash_aset(result,
|
847
|
+
rb_hash_aset(result, SYMBOL_LIT("nodename"), nodename);
|
807
848
|
|
808
849
|
# ifndef PROCESSOR_ARCHITECTURE_AMD64
|
809
850
|
# define PROCESSOR_ARCHITECTURE_AMD64 9
|
@@ -827,7 +868,7 @@ etc_uname(VALUE obj)
|
|
827
868
|
break;
|
828
869
|
}
|
829
870
|
|
830
|
-
rb_hash_aset(result,
|
871
|
+
rb_hash_aset(result, SYMBOL_LIT("machine"), rb_str_new_cstr(mach));
|
831
872
|
#else
|
832
873
|
struct utsname u;
|
833
874
|
int ret;
|
@@ -838,11 +879,11 @@ etc_uname(VALUE obj)
|
|
838
879
|
rb_sys_fail("uname");
|
839
880
|
|
840
881
|
result = rb_hash_new();
|
841
|
-
rb_hash_aset(result,
|
842
|
-
rb_hash_aset(result,
|
843
|
-
rb_hash_aset(result,
|
844
|
-
rb_hash_aset(result,
|
845
|
-
rb_hash_aset(result,
|
882
|
+
rb_hash_aset(result, SYMBOL_LIT("sysname"), rb_str_new_cstr(u.sysname));
|
883
|
+
rb_hash_aset(result, SYMBOL_LIT("nodename"), rb_str_new_cstr(u.nodename));
|
884
|
+
rb_hash_aset(result, SYMBOL_LIT("release"), rb_str_new_cstr(u.release));
|
885
|
+
rb_hash_aset(result, SYMBOL_LIT("version"), rb_str_new_cstr(u.version));
|
886
|
+
rb_hash_aset(result, SYMBOL_LIT("machine"), rb_str_new_cstr(u.machine));
|
846
887
|
#endif
|
847
888
|
|
848
889
|
return result;
|
@@ -852,7 +893,9 @@ etc_uname(VALUE obj)
|
|
852
893
|
#endif
|
853
894
|
|
854
895
|
#ifdef HAVE_SYSCONF
|
855
|
-
/*
|
896
|
+
/* call-seq:
|
897
|
+
* sysconf(name) -> Integer
|
898
|
+
*
|
856
899
|
* Returns system configuration variable using sysconf().
|
857
900
|
*
|
858
901
|
* _name_ should be a constant under <code>Etc</code> which begins with <code>SC_</code>.
|
@@ -886,7 +929,9 @@ etc_sysconf(VALUE obj, VALUE arg)
|
|
886
929
|
#endif
|
887
930
|
|
888
931
|
#ifdef HAVE_CONFSTR
|
889
|
-
/*
|
932
|
+
/* call-seq:
|
933
|
+
* confstr(name) -> String
|
934
|
+
*
|
890
935
|
* Returns system configuration variable using confstr().
|
891
936
|
*
|
892
937
|
* _name_ should be a constant under <code>Etc</code> which begins with <code>CS_</code>.
|
@@ -933,7 +978,9 @@ etc_confstr(VALUE obj, VALUE arg)
|
|
933
978
|
#endif
|
934
979
|
|
935
980
|
#ifdef HAVE_FPATHCONF
|
936
|
-
/*
|
981
|
+
/* call-seq:
|
982
|
+
* pathconf(name) -> Integer
|
983
|
+
*
|
937
984
|
* Returns pathname configuration variable using fpathconf().
|
938
985
|
*
|
939
986
|
* _name_ should be a constant under <code>Etc</code> which begins with <code>PC_</code>.
|
@@ -1025,7 +1072,9 @@ etc_nprocessors_affin(void)
|
|
1025
1072
|
}
|
1026
1073
|
#endif
|
1027
1074
|
|
1028
|
-
/*
|
1075
|
+
/* call-seq:
|
1076
|
+
* nprocessors -> Integer
|
1077
|
+
*
|
1029
1078
|
* Returns the number of online processors.
|
1030
1079
|
*
|
1031
1080
|
* The result is intended as the number of processes to
|
@@ -1035,7 +1084,7 @@ etc_nprocessors_affin(void)
|
|
1035
1084
|
* - sched_getaffinity(): Linux
|
1036
1085
|
* - sysconf(_SC_NPROCESSORS_ONLN): GNU/Linux, NetBSD, FreeBSD, OpenBSD, DragonFly BSD, OpenIndiana, Mac OS X, AIX
|
1037
1086
|
*
|
1038
|
-
* Example
|
1087
|
+
* *Example:*
|
1039
1088
|
*
|
1040
1089
|
* require 'etc'
|
1041
1090
|
* p Etc.nprocessors #=> 4
|
@@ -1044,7 +1093,7 @@ etc_nprocessors_affin(void)
|
|
1044
1093
|
* process is bound to specific cpus. This is intended for getting better
|
1045
1094
|
* parallel processing.
|
1046
1095
|
*
|
1047
|
-
* Example
|
1096
|
+
* *Example:* (Linux)
|
1048
1097
|
*
|
1049
1098
|
* linux$ taskset 0x3 ./ruby -retc -e "p Etc.nprocessors" #=> 2
|
1050
1099
|
*
|
@@ -1094,7 +1143,7 @@ etc_nprocessors(VALUE obj)
|
|
1094
1143
|
* The Etc module provides a more reliable way to access information about
|
1095
1144
|
* the logged in user than environment variables such as +$USER+.
|
1096
1145
|
*
|
1097
|
-
*
|
1146
|
+
* *Example:*
|
1098
1147
|
*
|
1099
1148
|
* require 'etc'
|
1100
1149
|
*
|
@@ -1118,6 +1167,7 @@ Init_etc(void)
|
|
1118
1167
|
RB_EXT_RACTOR_SAFE(true);
|
1119
1168
|
#endif
|
1120
1169
|
mEtc = rb_define_module("Etc");
|
1170
|
+
/* The version */
|
1121
1171
|
rb_define_const(mEtc, "VERSION", rb_str_new_cstr(RUBY_ETC_VERSION));
|
1122
1172
|
init_constants(mEtc);
|
1123
1173
|
|
data/ext/etc/mkconstants.rb
CHANGED
@@ -35,6 +35,12 @@ opt.def_option('-H FILE', 'specify output header file') {|filename|
|
|
35
35
|
|
36
36
|
opt.parse!
|
37
37
|
|
38
|
+
CONST_PREFIXES = {
|
39
|
+
'SC' => 'for Etc.sysconf; See <tt>man sysconf</tt>',
|
40
|
+
'CS' => 'for Etc.confstr; See <tt>man constr</tt>',
|
41
|
+
'PC' => 'for IO#pathconf; See <tt>man fpathconf</tt>',
|
42
|
+
}
|
43
|
+
|
38
44
|
h = {}
|
39
45
|
COMMENTS = {}
|
40
46
|
|
@@ -49,6 +55,13 @@ DATA.each_line {|s|
|
|
49
55
|
next
|
50
56
|
end
|
51
57
|
h[name] = default_value
|
58
|
+
if additional = CONST_PREFIXES[name[/\A_([A-Z]+)_/, 1]]
|
59
|
+
if comment&.match(/\w\z/)
|
60
|
+
comment << " " << additional
|
61
|
+
else
|
62
|
+
(comment ||= String.new) << " " << additional.sub(/\A\w/) {$&.upcase}
|
63
|
+
end
|
64
|
+
end
|
52
65
|
COMMENTS[name] = comment if comment
|
53
66
|
}
|
54
67
|
DEFS = h.to_a
|
@@ -66,15 +79,11 @@ def each_name(pat)
|
|
66
79
|
}
|
67
80
|
end
|
68
81
|
|
69
|
-
erb_new = lambda do |src,
|
70
|
-
|
71
|
-
ERB.new(src, trim_mode: trim)
|
72
|
-
else
|
73
|
-
ERB.new(src, safe, trim)
|
74
|
-
end
|
82
|
+
erb_new = lambda do |src, trim|
|
83
|
+
ERB.new(src, trim_mode: trim)
|
75
84
|
end
|
76
85
|
|
77
|
-
erb_new.call(<<'EOS',
|
86
|
+
erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_decls")
|
78
87
|
% each_const {|name, default_value|
|
79
88
|
#if !defined(<%=name%>)
|
80
89
|
# if defined(HAVE_CONST_<%=name.upcase%>)
|
@@ -88,7 +97,7 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_decls")
|
|
88
97
|
% }
|
89
98
|
EOS
|
90
99
|
|
91
|
-
erb_new.call(<<'EOS',
|
100
|
+
erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_defs")
|
92
101
|
% each_const {|name, default_value|
|
93
102
|
#if defined(<%=name%>)
|
94
103
|
% if comment = COMMENTS[name]
|
@@ -99,13 +108,13 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs")
|
|
99
108
|
% }
|
100
109
|
EOS
|
101
110
|
|
102
|
-
header_result = erb_new.call(<<'EOS',
|
111
|
+
header_result = erb_new.call(<<'EOS', '%').result(binding)
|
103
112
|
/* autogenerated file */
|
104
113
|
|
105
114
|
<%= gen_const_decls %>
|
106
115
|
EOS
|
107
116
|
|
108
|
-
result = erb_new.call(<<'EOS',
|
117
|
+
result = erb_new.call(<<'EOS', '%').result(binding)
|
109
118
|
/* autogenerated file */
|
110
119
|
|
111
120
|
#ifdef HAVE_LONG_LONG
|
@@ -123,6 +132,9 @@ result = erb_new.call(<<'EOS', nil, '%').result(binding)
|
|
123
132
|
static void
|
124
133
|
init_constants(VALUE mod)
|
125
134
|
{
|
135
|
+
#if 0
|
136
|
+
mod = rb_define_module("Etc");
|
137
|
+
#endif
|
126
138
|
<%= gen_const_defs %>
|
127
139
|
}
|
128
140
|
EOS
|
data/test/etc/test_etc.rb
CHANGED
@@ -169,6 +169,10 @@ class TestEtc < Test::Unit::TestCase
|
|
169
169
|
assert_operator(1, :<=, n)
|
170
170
|
end
|
171
171
|
|
172
|
+
def test_sysconfdir
|
173
|
+
assert_operator(File, :absolute_path?, Etc.sysconfdir)
|
174
|
+
end if File.method_defined?(:absolute_path?)
|
175
|
+
|
172
176
|
def test_ractor
|
173
177
|
return unless Etc.passwd # => skip test if no platform support
|
174
178
|
Etc.endpwent
|
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.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides access to information typically stored in UNIX /etc directory.
|
14
14
|
email:
|
@@ -24,15 +24,6 @@ extra_rdoc_files:
|
|
24
24
|
- ext/etc/etc.c
|
25
25
|
- ext/etc/extconf.rb
|
26
26
|
- ext/etc/mkconstants.rb
|
27
|
-
- logs/ChangeLog-1.0.0
|
28
|
-
- logs/ChangeLog-1.0.1
|
29
|
-
- logs/ChangeLog-1.1.0
|
30
|
-
- logs/ChangeLog-1.2.0
|
31
|
-
- logs/ChangeLog-1.3.0
|
32
|
-
- logs/ChangeLog-1.3.1
|
33
|
-
- logs/ChangeLog-1.4.0
|
34
|
-
- logs/ChangeLog-1.4.1
|
35
|
-
- logs/ChangeLog-1.4.2
|
36
27
|
- test/etc/test_etc.rb
|
37
28
|
files:
|
38
29
|
- ChangeLog
|
@@ -42,22 +33,13 @@ files:
|
|
42
33
|
- ext/etc/etc.c
|
43
34
|
- ext/etc/extconf.rb
|
44
35
|
- ext/etc/mkconstants.rb
|
45
|
-
- logs/ChangeLog-1.0.0
|
46
|
-
- logs/ChangeLog-1.0.1
|
47
|
-
- logs/ChangeLog-1.1.0
|
48
|
-
- logs/ChangeLog-1.2.0
|
49
|
-
- logs/ChangeLog-1.3.0
|
50
|
-
- logs/ChangeLog-1.3.1
|
51
|
-
- logs/ChangeLog-1.4.0
|
52
|
-
- logs/ChangeLog-1.4.1
|
53
|
-
- logs/ChangeLog-1.4.2
|
54
36
|
- test/etc/test_etc.rb
|
55
37
|
homepage: https://github.com/ruby/etc
|
56
38
|
licenses:
|
57
39
|
- Ruby
|
58
40
|
- BSD-2-Clause
|
59
41
|
metadata: {}
|
60
|
-
post_install_message:
|
42
|
+
post_install_message:
|
61
43
|
rdoc_options:
|
62
44
|
- "--main"
|
63
45
|
- README.md
|
@@ -74,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
56
|
- !ruby/object:Gem::Version
|
75
57
|
version: '0'
|
76
58
|
requirements: []
|
77
|
-
rubygems_version: 3.5.
|
78
|
-
signing_key:
|
59
|
+
rubygems_version: 3.5.11
|
60
|
+
signing_key:
|
79
61
|
specification_version: 4
|
80
62
|
summary: Provides access to information typically stored in UNIX /etc directory.
|
81
63
|
test_files: []
|
data/logs/ChangeLog-1.0.0
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
-*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
commit 3402a9366fba4d2bf2f4ea20df16c95121876bc4
|
4
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
5
|
-
AuthorDate: 2017-12-13 14:31:00 +0900
|
6
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
7
|
-
CommitDate: 2017-12-13 14:31:00 +0900
|
8
|
-
|
9
|
-
Bump release date
|
10
|
-
|
11
|
-
commit be7fadb654340282ff71a500a47f88a0b4c47a1d
|
12
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
13
|
-
AuthorDate: 2017-12-13 14:30:42 +0900
|
14
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
15
|
-
CommitDate: 2017-12-13 14:30:42 +0900
|
16
|
-
|
17
|
-
Added badge of Travis
|
18
|
-
|
19
|
-
commit 97aca32b82f6cd8c309ae515e36d86c4d4822e4c
|
20
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
21
|
-
AuthorDate: 2017-12-13 14:23:26 +0900
|
22
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
23
|
-
CommitDate: 2017-12-13 14:23:26 +0900
|
24
|
-
|
25
|
-
prepare to release 1.0.0
|
26
|
-
|
27
|
-
commit 744646073bcd4e7c5b65ae5921cf4c1d5697e35e
|
28
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
29
|
-
AuthorDate: 2017-11-28 12:17:10 +0900
|
30
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
31
|
-
CommitDate: 2017-11-28 12:20:44 +0900
|
32
|
-
|
33
|
-
Pick commits from ruby core repository.
|
34
|
-
|
35
|
-
* https://github.com/ruby/ruby/commit/0f7fed9253
|
36
|
-
* https://github.com/ruby/ruby/commit/8fc8587e05
|
37
|
-
* https://github.com/ruby/ruby/commit/1333c0f0df
|
38
|
-
* https://github.com/ruby/ruby/commit/e4ff51b05a
|
39
|
-
* https://github.com/ruby/ruby/commit/1852b4a866
|
40
|
-
* https://github.com/ruby/ruby/commit/b5b2bd86f1
|
41
|
-
* https://github.com/ruby/ruby/commit/253fd5fe6b
|
42
|
-
|
43
|
-
commit 0e8f8547412d33a35752ef4272d78fc18cf3a5ed
|
44
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
45
|
-
AuthorDate: 2017-10-20 16:51:22 +0900
|
46
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
47
|
-
CommitDate: 2017-10-20 16:51:22 +0900
|
48
|
-
|
49
|
-
Update README with rdoc of Etc module
|
50
|
-
|
51
|
-
commit 86a04b45feed2bc88d44399e127ed675d5d0f41c
|
52
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
53
|
-
AuthorDate: 2017-09-13 14:32:17 +0900
|
54
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
55
|
-
CommitDate: 2017-09-13 14:32:17 +0900
|
56
|
-
|
57
|
-
make frozen
|
58
|
-
|
59
|
-
commit 91ce5d0039fe10d86b35a3c114fabb9a7ae86344
|
60
|
-
Author: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
61
|
-
AuthorDate: 2017-07-18 14:38:26 +0900
|
62
|
-
Commit: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
63
|
-
CommitDate: 2017-07-18 14:38:26 +0900
|
64
|
-
|
65
|
-
fixed wrong license name
|