supplement 1.7 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -5,7 +5,7 @@
5
5
  |___/\__,_| .__/| .__/|_|\___|_| |_| |_|\___|_| |_|\__|
6
6
  |_| |_|
7
7
 
8
- Copyright (c) 2009-2013, Bertram Scharpf <software@bertram-scharpf.de>.
8
+ Copyright (C) 2009-2014, Bertram Scharpf <software@bertram-scharpf.de>.
9
9
  All rights reserved.
10
10
 
11
11
  Redistribution and use in source and binary forms, with or without
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = supplement 1.7 -- Useful Ruby enhancements
1
+ = supplement 2.2.1 -- Useful Ruby enhancements
2
2
 
3
3
  Some simple Ruby extensions.
4
4
 
@@ -39,7 +39,8 @@ Now here it is where I can just point to.
39
39
  * Array#notempty?
40
40
  * Hash#notempty?
41
41
  * Struct.[]
42
+ * Process.renice
42
43
  * Interval timer
43
44
  * File system stats
44
- * File#flockb using a block
45
+ * LockedFile
45
46
 
@@ -12,7 +12,8 @@ rule ".o" => ".c" do |t|
12
12
  end
13
13
 
14
14
  DLs = {
15
- "supplement.so" => %w(supplement.o sync.o),
15
+ "supplement.so" => %w(supplement.o process.o),
16
+ "supplement/locked.so" => %w(supplement/locked.o),
16
17
  "supplement/filesys.so" => %w(supplement/filesys.o),
17
18
  "supplement/itimer.so" => %w(supplement/itimer.o),
18
19
  "supplement/terminal.so" => %w(supplement/terminal.o),
@@ -21,7 +21,6 @@ Autorake.configure {
21
21
  enable :string_start_with
22
22
  enable :thread_exclusive
23
23
  end
24
- have_header "rubysig.h"
25
24
  end
26
25
  end
27
26
 
@@ -30,12 +29,17 @@ Autorake.configure {
30
29
  have_header "st.h"
31
30
  have_header "rubyio.h"
32
31
  have_header "re.h"
32
+ have_header "rubysig.h"
33
33
  else
34
34
  have_header "ruby/ruby.h"
35
35
  have_header "ruby/st.h"
36
36
  have_header "ruby/io.h"
37
37
  have_header "ruby/re.h"
38
+
39
+ have_function "rb_thread_wait_for"
38
40
  end
39
41
 
42
+ have_function "cbrt"
43
+
40
44
  }
41
45
 
@@ -0,0 +1,71 @@
1
+ /*
2
+ * process.c -- Renice; sync all
3
+ */
4
+
5
+
6
+ #include "process.h"
7
+
8
+ #if HAVE_HEADER_RUBY_H
9
+ #include <ruby.h>
10
+ #elif HAVE_HEADER_RUBY_RUBY_H
11
+ #include <ruby/ruby.h>
12
+ #endif
13
+
14
+ #include <sys/time.h>
15
+ #include <sys/resource.h>
16
+
17
+ #include <unistd.h>
18
+
19
+
20
+ static VALUE rb_process_renice( int argc, VALUE *argv, VALUE obj);
21
+ static VALUE rb_process_sync( VALUE obj);
22
+
23
+
24
+ /*
25
+ * call-seq:
26
+ * Process.renice( pid = nil, priority) -> nil
27
+ *
28
+ * Set a new nice value. If pid is +nil+, renice the current process.
29
+ */
30
+
31
+ VALUE
32
+ rb_process_renice( int argc, VALUE *argv, VALUE obj)
33
+ {
34
+ VALUE p1, p2;
35
+ pid_t pid;
36
+ int prio;
37
+
38
+ if (rb_scan_args( argc, argv, "11", &p1, &p2) == 1)
39
+ pid = getpid(), prio = NUM2INT( p1);
40
+ else
41
+ pid = NUM2INT( p1), prio = NUM2INT( p2);
42
+
43
+ rb_secure(2);
44
+ if (setpriority( PRIO_PROCESS, pid, prio) < 0)
45
+ rb_sys_fail(0);
46
+
47
+ return Qnil;
48
+ }
49
+
50
+
51
+ /*
52
+ * call-seq:
53
+ * Process.sync -> nil
54
+ *
55
+ * Force completion of pending disk writes (flush cache). See sync(8).
56
+ */
57
+
58
+ VALUE
59
+ rb_process_sync( VALUE obj)
60
+ {
61
+ sync();
62
+ return Qnil;
63
+ }
64
+
65
+
66
+ void Init_supplement_process( void)
67
+ {
68
+ rb_define_singleton_method( rb_mProcess, "renice", rb_process_renice, -1);
69
+ rb_define_singleton_method( rb_mProcess, "sync", rb_process_sync, 0);
70
+ }
71
+
@@ -0,0 +1,13 @@
1
+ /*
2
+ * process.h -- Renice; sync all
3
+ */
4
+
5
+
6
+ #ifndef __PROCESS_H__
7
+ #define __PROCESS_H__
8
+
9
+
10
+ extern void Init_supplement_process( void);
11
+
12
+ #endif
13
+
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "supplement.h"
6
6
 
7
- #include "sync.h"
7
+ #include "process.h"
8
8
 
9
9
  #if HAVE_HEADER_ST_H
10
10
  #include <st.h>
@@ -29,12 +29,6 @@
29
29
  #endif
30
30
 
31
31
 
32
- #include <sys/stat.h>
33
- #include <sys/file.h>
34
- #include <math.h>
35
-
36
-
37
-
38
32
  #ifdef HAVE_HEADER_RUBY_H
39
33
  /* Oh what a bug! */
40
34
  #define R_MATCH( obj) RMATCH( obj)
@@ -42,16 +36,6 @@
42
36
  #endif
43
37
 
44
38
 
45
- struct supplement_flock {
46
- struct supplement_flock *prev;
47
- VALUE file;
48
- int op;
49
- int last_op;
50
- };
51
-
52
- static struct supplement_flock *flocks_root = NULL;
53
-
54
-
55
39
  static VALUE supplement_index_blk( VALUE);
56
40
  static VALUE supplement_index_ref( VALUE, VALUE);
57
41
  static VALUE supplement_rindex_blk( VALUE);
@@ -64,11 +48,7 @@ static VALUE supplement_rindex_val( VALUE, VALUE);
64
48
  static VALUE supplement_reject( VALUE);
65
49
  static VALUE supplement_invert_yield( VALUE);
66
50
  #endif
67
- static VALUE supplement_each_line( VALUE);
68
- static void supplement_init_flock( struct supplement_flock *, VALUE, VALUE);
69
- static VALUE supplement_do_unflock( VALUE);
70
51
  static VALUE supplement_do_unumask( VALUE);
71
- static VALUE supplement_chdir( VALUE);
72
52
  #ifdef FEATURE_THREAD_EXCLUSIVE
73
53
  static VALUE bsruby_set_thread_critical( VALUE);
74
54
  #endif
@@ -81,8 +61,6 @@ static ID id_eqq;
81
61
  #ifdef FEATURE_ARRAY_SELECT_BANG
82
62
  static ID id_reject_bang;
83
63
  #endif
84
- static ID id_chdir;
85
- static ID id_path;
86
64
  static ID id_mkdir;
87
65
  static ID id_index;
88
66
 
@@ -828,6 +806,9 @@ rb_num_sqrt( VALUE num)
828
806
  VALUE
829
807
  rb_num_cbrt( VALUE num)
830
808
  {
809
+ #if HAVE_FUNC_CBRT
810
+ return rb_float_new( cbrt( RFLOAT_VALUE( rb_Float( num))));
811
+ #else
831
812
  double n;
832
813
  int neg;
833
814
  int i;
@@ -848,6 +829,7 @@ rb_num_cbrt( VALUE num)
848
829
  n = w;
849
830
  }
850
831
  return rb_float_new( neg ? -n : n);
832
+ #endif
851
833
  }
852
834
 
853
835
 
@@ -1205,120 +1187,6 @@ rb_file_size( VALUE obj)
1205
1187
  }
1206
1188
 
1207
1189
 
1208
- /*
1209
- * call-seq:
1210
- * flockb( excl = nil, nb = nil) { || ... } -> nil
1211
- *
1212
- * Lock file using the <code>flock()</code> system call.
1213
- * When the <code>nb</code> flag is <code>true</code>, the method
1214
- * won't block but rather raise an exception. Catch
1215
- * <code>SystemCallError</code>. The calls may be nested in any order.
1216
- *
1217
- * File.open "/var/mail/joe", "a" do |f|
1218
- * f.flockb true do
1219
- * f.write another_message
1220
- * end
1221
- * end
1222
- */
1223
-
1224
- VALUE
1225
- rb_file_flockb( int argc, VALUE *argv, VALUE file)
1226
- {
1227
- VALUE excl, nb;
1228
- struct supplement_flock cur_flock;
1229
- #ifdef HAVE_HEADER_RUBY_H
1230
- OpenFile *fptr;
1231
- #else
1232
- rb_io_t *fptr;
1233
- #endif
1234
- int op;
1235
-
1236
- rb_scan_args( argc, argv, "02", &excl, &nb);
1237
- supplement_init_flock( &cur_flock, file, excl);
1238
-
1239
- op = cur_flock.op | LOCK_NB;
1240
- GetOpenFile( file, fptr);
1241
- #ifdef HAVE_HEADER_RUBY_H
1242
- while (flock( fileno( fptr->f), op) < 0) {
1243
- #else
1244
- while (flock( fptr->fd, op) < 0) {
1245
- #endif
1246
- switch (errno) {
1247
- case EAGAIN:
1248
- case EACCES:
1249
- #if defined( EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
1250
- case EWOULDBLOCK:
1251
- #endif
1252
- if (!RTEST( nb)) {
1253
- rb_thread_polling(); /* busy wait */
1254
- rb_io_check_closed( fptr);
1255
- continue;
1256
- }
1257
- /* fall through */
1258
- default:
1259
- #ifdef HAVE_HEADER_RUBY_H
1260
- rb_sys_fail( fptr->path);
1261
- #else
1262
- rb_sys_fail_str( fptr->pathv);
1263
- #endif
1264
- }
1265
- }
1266
- cur_flock.prev = flocks_root;
1267
- flocks_root = &cur_flock;
1268
- return rb_ensure( rb_yield, Qnil, supplement_do_unflock, Qnil);
1269
- }
1270
-
1271
- void
1272
- supplement_init_flock( struct supplement_flock *s, VALUE file, VALUE excl)
1273
- {
1274
- struct supplement_flock *i;
1275
-
1276
- s->file = file;
1277
-
1278
- s->last_op = LOCK_UN;
1279
- for (i = flocks_root; i != NULL; i = i->prev) {
1280
- if (i->file == file) {
1281
- s->last_op = i->op;
1282
- break;
1283
- }
1284
- }
1285
-
1286
- switch (s->last_op) {
1287
- case LOCK_UN:
1288
- case LOCK_SH:
1289
- s->op = RTEST( excl) ? LOCK_EX : LOCK_SH;
1290
- break;
1291
- case LOCK_EX:
1292
- s->op = LOCK_EX;
1293
- break;
1294
- default:
1295
- s->op = LOCK_UN; /* should never be reached. */
1296
- break;
1297
- }
1298
- }
1299
-
1300
- VALUE
1301
- supplement_do_unflock( VALUE v)
1302
- {
1303
- #ifdef HAVE_HEADER_RUBY_H
1304
- OpenFile *fptr;
1305
- #else
1306
- rb_io_t *fptr;
1307
- #endif
1308
- int fd;
1309
-
1310
- GetOpenFile( flocks_root->file, fptr);
1311
- #ifdef HAVE_HEADER_RUBY_H
1312
- flock( fileno( fptr->f), flocks_root->last_op);
1313
- #else
1314
- flock( fptr->fd, flocks_root->last_op);
1315
- #endif
1316
- flocks_root = flocks_root->prev;
1317
-
1318
- return Qnil;
1319
- }
1320
-
1321
-
1322
1190
  /*
1323
1191
  * call-seq:
1324
1192
  * umask() -> int
@@ -1447,40 +1315,6 @@ rb_dir_entries_bang( VALUE self)
1447
1315
  }
1448
1316
 
1449
1317
 
1450
- /*
1451
- * call-seq:
1452
- * chdir() -> nil
1453
- * chdir() { |path| ... } -> obj
1454
- *
1455
- * As you probably expect, change the working directory like in
1456
- * <code>Dir.chdir</code>.
1457
- *
1458
- */
1459
-
1460
- VALUE
1461
- rb_dir_chdir( VALUE dir)
1462
- {
1463
- VALUE path;
1464
-
1465
- if (!id_chdir) {
1466
- id_chdir = rb_intern( "chdir");
1467
- id_path = rb_intern( "path");
1468
- }
1469
- path = rb_funcall( dir, id_path, 0);
1470
- if (rb_block_given_p())
1471
- return rb_iterate( &supplement_chdir, path, &rb_yield, Qnil);
1472
- else {
1473
- supplement_chdir( path);
1474
- return Qnil;
1475
- }
1476
- }
1477
-
1478
- VALUE
1479
- supplement_chdir( VALUE path)
1480
- {
1481
- return rb_funcall( rb_cDir, id_chdir, 1, path);
1482
- }
1483
-
1484
1318
 
1485
1319
  /*
1486
1320
  * Document-class: Match
@@ -1669,13 +1503,11 @@ void Init_supplement( void)
1669
1503
  rb_define_method( rb_cHash, "notempty?", rb_hash_notempty_p, 0);
1670
1504
 
1671
1505
  rb_define_method( rb_cFile, "size", rb_file_size, 0);
1672
- rb_define_method( rb_cFile, "flockb", rb_file_flockb, -1);
1673
1506
  rb_define_singleton_method( rb_cFile, "umask", rb_file_s_umask, -1);
1674
1507
 
1675
1508
  rb_define_singleton_method( rb_cDir, "current", rb_dir_s_current, 0);
1676
1509
  rb_define_singleton_method( rb_cDir, "mkdir!", rb_dir_s_mkdir_bang, -1);
1677
1510
  rb_define_method( rb_cDir, "entries!", rb_dir_entries_bang, 0);
1678
- rb_define_method( rb_cDir, "chdir", rb_dir_chdir, 0);
1679
1511
 
1680
1512
  rb_define_method( rb_cMatch, "begin", rb_match_begin, -1);
1681
1513
  rb_define_method( rb_cMatch, "end", rb_match_end, -1);
@@ -1693,11 +1525,9 @@ void Init_supplement( void)
1693
1525
  #ifdef FEATURE_ARRAY_SELECT_BANG
1694
1526
  id_reject_bang = 0;
1695
1527
  #endif
1696
- id_chdir = 0;
1697
- id_path = 0;
1698
1528
  id_mkdir = 0;
1699
1529
  id_index = 0;
1700
1530
 
1701
- Init_supplement_sync();
1531
+ Init_supplement_process();
1702
1532
  }
1703
1533
 
@@ -63,12 +63,10 @@ extern VALUE rb_num_cbrt( VALUE);
63
63
  extern VALUE rb_hash_notempty_p( VALUE);
64
64
 
65
65
  extern VALUE rb_file_size( VALUE);
66
- extern VALUE rb_file_flockb( int, VALUE *, VALUE);
67
66
  extern VALUE rb_file_s_umask( int, VALUE *);
68
67
  extern VALUE rb_dir_s_current( VALUE);
69
68
  extern VALUE rb_dir_s_mkdir_bang( int, VALUE *);
70
69
  extern VALUE rb_dir_entries_bang( VALUE);
71
- extern VALUE rb_dir_chdir( VALUE);
72
70
 
73
71
  extern VALUE rb_match_begin( int, VALUE *, VALUE);
74
72
  extern VALUE rb_match_end( int, VALUE *, VALUE);
@@ -0,0 +1,49 @@
1
+ #
2
+ # supplement/dir.rb -- More Dir methods
3
+ #
4
+
5
+ class Dir
6
+
7
+ class <<self
8
+
9
+ # :call-seq:
10
+ # Dir.nuke!( name) -> nil
11
+ #
12
+ # Delete a directory, all its contents and all subdirectories.
13
+ # WARNING! This can cause serious damage.
14
+ #
15
+ def nuke! n
16
+ (new n).entries!.each { |e|
17
+ p = File.join n, e
18
+ if File.directory? p then
19
+ nuke! p
20
+ else
21
+ File.unlink p
22
+ end
23
+ }
24
+ rmdir n
25
+ nil
26
+ end
27
+
28
+ # :call-seq:
29
+ # Dir.rmpath( name) -> nil
30
+ #
31
+ # Delete as many empty directories as possible.
32
+ #
33
+ def rmpath n
34
+ case n
35
+ when "/", "." then
36
+ else
37
+ if (new n).entries!.empty? then
38
+ rmdir n
39
+ d = File.dirname n
40
+ rmpath d
41
+ end
42
+ end
43
+ nil
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
@@ -5,7 +5,11 @@
5
5
  #ifndef __SUPPLEMENT_FILESYS_H__
6
6
  #define __SUPPLEMENT_FILESYS_H__
7
7
 
8
- #include <ruby.h>
8
+ #if HAVE_HEADER_RUBY_H
9
+ #include <ruby.h>
10
+ #elif HAVE_HEADER_RUBY_RUBY_H
11
+ #include <ruby/ruby.h>
12
+ #endif
9
13
 
10
14
 
11
15
  extern VALUE rb_fsstat_s_alloc( VALUE);
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "itimer.h"
7
7
 
8
- #include <math.h>
8
+ #include <sys/time.h>
9
9
 
10
10
  static void suppelement_sec_timeval( VALUE, struct timeval *t);
11
11
  static VALUE suppelement_timeval_sec( struct timeval *);
@@ -61,7 +61,7 @@ suppelement_sec_timeval( VALUE secs, struct timeval *t)
61
61
  d = modf( RFLOAT_VALUE(secs), &f);
62
62
  t->tv_sec = (time_t) f, t->tv_usec = (time_t) (d*1e6+0.5);
63
63
  if (f != t->tv_sec)
64
- rb_raise( rb_eRangeError, "time interval out of Time range",
64
+ rb_raise( rb_eRangeError, "time interval %f out of Time range",
65
65
  RFLOAT_VALUE(secs));
66
66
  }
67
67
  break;
@@ -5,7 +5,11 @@
5
5
  #ifndef __SUPPLEMENT_ITIMER_H__
6
6
  #define __SUPPLEMENT_ITIMER_H__
7
7
 
8
- #include <ruby.h>
8
+ #if HAVE_HEADER_RUBY_H
9
+ #include <ruby.h>
10
+ #elif HAVE_HEADER_RUBY_RUBY_H
11
+ #include <ruby/ruby.h>
12
+ #endif
9
13
 
10
14
 
11
15
  extern VALUE rb_process_setitimer( int, VALUE *, VALUE);
@@ -0,0 +1,127 @@
1
+ /*
2
+ * supplement/locked.c -- Locked File
3
+ */
4
+
5
+ #include "locked.h"
6
+
7
+ #if HAVE_HEADER_RUBYIO_H
8
+ #include <rubyio.h>
9
+ #elif HAVE_HEADER_RUBY_IO_H
10
+ #include <ruby/io.h>
11
+ #endif
12
+
13
+ #include <sys/file.h>
14
+
15
+
16
+ /*
17
+ * Document-class: LockedFile
18
+ *
19
+ * Open a File and lock it.
20
+ */
21
+
22
+ /*
23
+ * call-seq:
24
+ * LockedFile.open( *args) -> file
25
+ * LockedFile.open( *args) { |file| ... } -> ob.j
26
+ *
27
+ * Same as File.open but do an +flock+. If the lock fails, the method
28
+ * +lock_failed+ will be called. If that doesn't exist, another lock
29
+ * will be tried.
30
+ */
31
+
32
+ VALUE
33
+ rb_locked_init( int argc, VALUE *argv, VALUE self)
34
+ {
35
+ #ifdef HAVE_HEADER_RUBY_H
36
+ OpenFile *fptr;
37
+ #else
38
+ rb_io_t *fptr;
39
+ #endif
40
+ #ifdef HAVE_FUNC_RB_THREAD_WAIT_FOR
41
+ struct timeval time;
42
+ #endif
43
+ int op;
44
+
45
+ rb_call_super( argc, argv);
46
+ GetOpenFile( self, fptr);
47
+
48
+ op = fptr->mode & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
49
+ op |= LOCK_NB;
50
+ #ifdef HAVE_HEADER_RUBY_H
51
+ while (flock( fileno( fptr->f), op) < 0) {
52
+ #else
53
+ while (flock( fptr->fd, op) < 0) {
54
+ #endif
55
+ static ID id_lock_failed = 0;
56
+
57
+ switch (errno) {
58
+ case EINTR:
59
+ break;
60
+ case EAGAIN:
61
+ case EACCES:
62
+ #if defined( EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
63
+ case EWOULDBLOCK:
64
+ #endif
65
+ if (id_lock_failed == 0)
66
+ id_lock_failed = rb_intern( "lock_failed");
67
+ if (rb_respond_to( self, id_lock_failed))
68
+ rb_funcall( self, id_lock_failed, 0);
69
+ else {
70
+ #ifdef HAVE_FUNC_RB_THREAD_WAIT_FOR
71
+ time.tv_sec = 0;
72
+ time.tv_usec = 100 * 1000;
73
+ rb_thread_wait_for(time);
74
+ #else
75
+ rb_thread_polling();
76
+ #endif
77
+ }
78
+ break;
79
+ default:
80
+ #ifdef HAVE_HEADER_RUBY_H
81
+ rb_sys_fail( fptr->path);
82
+ #else
83
+ rb_sys_fail_str( fptr->pathv);
84
+ #endif
85
+ break;
86
+ }
87
+ }
88
+ return self;
89
+ }
90
+
91
+
92
+ /*
93
+ * call-seq:
94
+ * close() -> nil
95
+ *
96
+ * Unlock using flock and close.
97
+ */
98
+
99
+ VALUE
100
+ rb_locked_close( VALUE self)
101
+ {
102
+ #ifdef HAVE_HEADER_RUBY_H
103
+ OpenFile *fptr;
104
+ #else
105
+ rb_io_t *fptr;
106
+ #endif
107
+
108
+ GetOpenFile( self, fptr);
109
+ #ifdef HAVE_HEADER_RUBY_H
110
+ flock( fileno( fptr->f), LOCK_UN);
111
+ #else
112
+ flock( fptr->fd, LOCK_UN);
113
+ #endif
114
+ rb_call_super( 0, NULL);
115
+ return Qnil;
116
+ }
117
+
118
+ void Init_locked( void)
119
+ {
120
+ VALUE rb_cLockedFile;
121
+
122
+ rb_cLockedFile = rb_define_class( "LockedFile", rb_cFile);
123
+
124
+ rb_define_method( rb_cLockedFile, "initialize", &rb_locked_init, -1);
125
+ rb_define_method( rb_cLockedFile, "close", &rb_locked_close, 0);
126
+ }
127
+
@@ -0,0 +1,20 @@
1
+ /*
2
+ * supplement/filesys.h -- File system tools
3
+ */
4
+
5
+ #ifndef __SUPPLEMENT_FILESYS_H__
6
+ #define __SUPPLEMENT_FILESYS_H__
7
+
8
+ #if HAVE_HEADER_RUBY_H
9
+ #include <ruby.h>
10
+ #elif HAVE_HEADER_RUBY_RUBY_H
11
+ #include <ruby/ruby.h>
12
+ #endif
13
+
14
+ VALUE rb_locked_init( int argc, VALUE *argv, VALUE self);
15
+ VALUE rb_locked_close( VALUE self);
16
+
17
+ extern void Init_locked( void);
18
+
19
+ #endif
20
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supplement
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.7'
4
+ version: 2.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-25 00:00:00.000000000 Z
12
+ date: 2015-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: autorake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.0'
22
22
  type: :runtime
@@ -24,13 +24,12 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '2.0'
30
- description: ! 'Simple methods that didn''t manage to become part of standard Ruby.
31
-
32
- '
33
- email: <software@bertram-scharpf.de>
30
+ description: |
31
+ Simple methods that didn't manage to become part of standard Ruby.
32
+ email: "<software@bertram-scharpf.de>"
34
33
  executables: []
35
34
  extensions:
36
35
  - lib/mkrf_conf
@@ -42,8 +41,11 @@ files:
42
41
  - lib/Rakefile
43
42
  - lib/supplement.c
44
43
  - lib/supplement.h
45
- - lib/sync.c
46
- - lib/sync.h
44
+ - lib/process.c
45
+ - lib/process.h
46
+ - lib/supplement/locked.c
47
+ - lib/supplement/locked.h
48
+ - lib/supplement/dir.rb
47
49
  - lib/supplement/filesys.c
48
50
  - lib/supplement/filesys.h
49
51
  - lib/supplement/itimer.c
@@ -58,28 +60,28 @@ homepage: http://www.bertram-scharpf.de/software/supplement
58
60
  licenses: []
59
61
  post_install_message:
60
62
  rdoc_options:
61
- - --charset
63
+ - "--charset"
62
64
  - utf-8
63
- - --main
65
+ - "--main"
64
66
  - README
65
67
  require_paths:
66
68
  - lib
67
69
  required_ruby_version: !ruby/object:Gem::Requirement
68
70
  none: false
69
71
  requirements:
70
- - - ! '>='
72
+ - - ">="
71
73
  - !ruby/object:Gem::Version
72
74
  version: '0'
73
75
  required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  none: false
75
77
  requirements:
76
- - - ! '>='
78
+ - - ">="
77
79
  - !ruby/object:Gem::Version
78
80
  version: '0'
79
81
  requirements:
80
82
  - Ruby and the autorake gem
81
83
  rubyforge_project: NONE
82
- rubygems_version: 1.8.25
84
+ rubygems_version: 1.8.29
83
85
  signing_key:
84
86
  specification_version: 3
85
87
  summary: Simple Ruby extensions
data/lib/sync.c DELETED
@@ -1,34 +0,0 @@
1
- /*
2
- * sync.c -- Sync all
3
- */
4
-
5
-
6
- #include "sync.h"
7
-
8
- #include <ruby.h>
9
- #include <unistd.h>
10
-
11
-
12
- static VALUE rb_process_sync( VALUE obj);
13
-
14
-
15
- /*
16
- * call-seq:
17
- * Process.sync -> nil
18
- *
19
- * Force completion of pending disk writes (flush cache). See sync(8).
20
- */
21
-
22
- VALUE
23
- rb_process_sync( VALUE obj)
24
- {
25
- sync();
26
- return Qnil;
27
- }
28
-
29
-
30
- void Init_supplement_sync( void)
31
- {
32
- rb_define_singleton_method( rb_mProcess, "sync", rb_process_sync, 0);
33
- }
34
-
data/lib/sync.h DELETED
@@ -1,13 +0,0 @@
1
- /*
2
- * sync.h -- Sync all
3
- */
4
-
5
-
6
- #ifndef __SYNC_H__
7
- #define __SYNC_H__
8
-
9
-
10
- extern void Init_supplement_sync( void);
11
-
12
- #endif
13
-