libcdb-ruby 0.0.4-x86-mingw32 → 0.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b993cec61f86683c025950f69dc9358d1ef8262
4
+ data.tar.gz: 19bd6833b01d4a27f97af38ab96047a0497a722d
5
+ SHA512:
6
+ metadata.gz: 9779d90315a8c34375d81fba60b3bc01b1a46c02e985c7b232b87360dfc67aedaaf586fd3feb9f2c83cd70b5c6f566617a561e8d1fefc7075e36ccb6190d68fc
7
+ data.tar.gz: 9ef836c683568ffe8b9568ef5cdb55b490bb787a8f5ca5d6493b656c3c8e7f613a86853a7bd7469db5fac0b2e43e3a5770ac6eeffa0c131bf6153de395174dd1
data/ChangeLog CHANGED
@@ -1,5 +1,15 @@
1
+ # markup: rd
2
+
1
3
  = Revision history for libcdb-ruby
2
4
 
5
+ == 0.1.0 [unreleased]
6
+
7
+ * Removed usage of +RARRAY_PTR+ (cf. Ruby bug
8
+ {#8399}[https://bugs.ruby-lang.org/issues/8399]).
9
+ * Fixed clobbering errors in <tt>CDB.open</tt>.
10
+ * <b>Dropped support for Ruby 1.8.7.</b>
11
+ * Housekeeping.
12
+
3
13
  == 0.0.4 [2012-08-09]
4
14
 
5
15
  * Fixed writing with Ruby 1.9.3 on Windows.
data/README CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to libcdb-ruby version 0.0.4
5
+ This documentation refers to libcdb-ruby version 0.1.0
6
6
 
7
7
 
8
8
  == DESCRIPTION
9
9
 
10
10
  The libcdb-ruby library provides Ruby bindings for the
11
- TinyCDB[http://corpit.ru/mjt/tinycdb.html] package for
11
+ TinyCDB[http://www.corpit.ru/mjt/tinycdb.html] package for
12
12
  creating and reading {constant databases}[http://cr.yp.to/cdb.html].
13
13
 
14
14
  require 'libcdb'
@@ -63,9 +63,8 @@ creating and reading {constant databases}[http://cr.yp.to/cdb.html].
63
63
  == PREREQUISITES
64
64
 
65
65
  <b></b>
66
- * Ruby 1.8.7+ or 1.9+ (see {below}[rdoc-label:label-SUPPORTED+PLATFORMS]
67
- for details)
68
- * TinyCDB[http://corpit.ru/mjt/tinycdb.html] headers (not needed when
66
+ * Ruby 1.9+ (see {below}[rdoc-label:label-SUPPORTED+PLATFORMS] for details)
67
+ * TinyCDB[http://www.corpit.ru/mjt/tinycdb.html] headers (not needed when
69
68
  installing the fat binary gem on Windows)
70
69
 
71
70
  Debian/Ubuntu:: +libcdb-dev+
@@ -76,8 +75,9 @@ creating and reading {constant databases}[http://cr.yp.to/cdb.html].
76
75
  == SUPPORTED PLATFORMS
77
76
 
78
77
  <b></b>
79
- Linux:: 1.8 & 1.9 (Tested on Ubuntu with 1.8.7p361, 1.9.2p320 and 1.9.3p195)
80
- Windows:: 1.9 only (Tested on XP with 1.9.2p290 and 1.9.3p194)
78
+ Linux:: MRI 1.9 & 2.0 (Tested on 64-bit Ubuntu GNU/Linux with 1.9.2p323,
79
+ 1.9.3p286 and 2.0.0p119)
80
+ Windows:: MRI 1.9 (Tested on 32-bit Windows XP with 1.9.2p290 and 1.9.3p194)
81
81
 
82
82
 
83
83
  == LINKS
@@ -86,13 +86,13 @@ Windows:: 1.9 only (Tested on XP with 1.9.2p290 and 1.9.3p194)
86
86
  Documentation:: http://blackwinter.github.com/libcdb-ruby
87
87
  Source code:: http://github.com/blackwinter/libcdb-ruby
88
88
  RubyGem:: http://rubygems.org/gems/libcdb-ruby
89
- TinyCDB:: http://corpit.ru/mjt/tinycdb.html
89
+ TinyCDB:: http://www.corpit.ru/mjt/tinycdb.html
90
90
  CDB:: http://cr.yp.to/cdb.html
91
91
 
92
92
 
93
93
  == AUTHORS
94
94
 
95
- * Jens Wille <mailto:jens.wille@uni-koeln.de>
95
+ * Jens Wille <mailto:jens.wille@gmail.com>
96
96
 
97
97
 
98
98
  == CREDITS
@@ -110,6 +110,8 @@ team for making extension building such a breeze :)
110
110
  Copyright (C) 2012 University of Cologne,
111
111
  Albertus-Magnus-Platz, 50923 Cologne, Germany
112
112
 
113
+ Copyright (C) 2013 Jens Wille
114
+
113
115
  libcdb-ruby is free software: you can redistribute it and/or modify it
114
116
  under the terms of the GNU Affero General Public License as published by
115
117
  the Free Software Foundation, either version 3 of the License, or (at your
data/Rakefile CHANGED
@@ -20,9 +20,14 @@ begin
20
20
  :version => LibCDB::CDB::VERSION,
21
21
  :summary => %q{Ruby bindings for CDB Constant Databases.},
22
22
  :author => %q{Jens Wille},
23
- :email => %q{jens.wille@uni-koeln.de},
23
+ :email => %q{jens.wille@gmail.com},
24
+ :license => %q{AGPL},
24
25
  :homepage => :blackwinter,
25
- :extension => { :cross_config_options => cco }
26
+ :extension => {
27
+ :cross_config_options => cco,
28
+ :ruby_versions => RUBY_VERSION
29
+ },
30
+ required_ruby_version: '>= 1.9.2'
26
31
  }
27
32
  }}
28
33
  rescue LoadError => err
@@ -1,5 +1,5 @@
1
- #ifndef __RUBY_CDB_H__
2
- #define __RUBY_CDB_H__
1
+ #ifndef RUBY_CDB_H
2
+ #define RUBY_CDB_H
3
3
 
4
4
  #ifdef HAVE_RUBY_IO_H
5
5
  #define RCDB_GET_FD(fptr) (fptr)->fd
@@ -71,4 +71,4 @@ rcdb_##what##er_inspect(VALUE self) {\
71
71
  extern VALUE cCDB;
72
72
  void rcdb_init_cdb(void);
73
73
 
74
- #endif /* __RUBY_CDB_H__ */
74
+ #endif /* RUBY_CDB_H */
@@ -33,13 +33,13 @@ RCDB_READER_DEFINE_READ(data)
33
33
 
34
34
  /* Helper method */
35
35
  static VALUE
36
- _rcdb_reader_iter_push(VALUE val, VALUE ary) {
36
+ rcdb_reader_iter_push(VALUE val, VALUE ary) {
37
37
  return rb_ary_push(ary, val);
38
38
  }
39
39
 
40
40
  /* Helper method */
41
41
  static VALUE
42
- _rcdb_reader_iter_aset(VALUE pair, VALUE hash) {
42
+ rcdb_reader_iter_aset(VALUE pair, VALUE hash) {
43
43
  VALUE key = rb_ary_entry(pair, 0), val = rb_ary_entry(pair, 1), old;
44
44
 
45
45
  if (!st_lookup(RHASH_TBL(hash), key, 0)) {
@@ -63,19 +63,19 @@ _rcdb_reader_iter_aset(VALUE pair, VALUE hash) {
63
63
 
64
64
  /* Helper method */
65
65
  static VALUE
66
- _rcdb_reader_break_equal(VALUE val, VALUE ary) {
66
+ rcdb_reader_break_equal(VALUE val, VALUE ary) {
67
67
  RCDB_READER_BREAK_EQUAL(val, Qtrue)
68
68
  }
69
69
 
70
70
  /* Helper method */
71
71
  static VALUE
72
- _rcdb_reader_break_equal2(VALUE pair, VALUE ary) {
72
+ rcdb_reader_break_equal2(VALUE pair, VALUE ary) {
73
73
  RCDB_READER_BREAK_EQUAL(rb_ary_entry(pair, 1), rb_ary_entry(pair, 0))
74
74
  }
75
75
 
76
76
  /* Helper method */
77
77
  static VALUE
78
- _rcdb_reader_break_shift(VALUE val, VALUE ary) {
78
+ rcdb_reader_break_shift(VALUE val, VALUE ary) {
79
79
  rb_ary_shift(ary);
80
80
  rb_iter_break();
81
81
 
@@ -84,14 +84,14 @@ _rcdb_reader_break_shift(VALUE val, VALUE ary) {
84
84
 
85
85
  /* Helper method */
86
86
  static VALUE
87
- _rcdb_reader_iter_inc(VALUE val, long *i) {
87
+ rcdb_reader_iter_inc(VALUE val, long *i) {
88
88
  ++*i;
89
89
  return Qnil;
90
90
  }
91
91
 
92
92
  /* Helper method */
93
93
  static VALUE
94
- _rcdb_reader_iter_dump(VALUE val, VALUE str) {
94
+ rcdb_reader_iter_dump(VALUE val, VALUE str) {
95
95
  rb_str_append(str, val);
96
96
  rb_str_cat2(str, "\n");
97
97
 
@@ -100,7 +100,7 @@ _rcdb_reader_iter_dump(VALUE val, VALUE str) {
100
100
 
101
101
  /* Helper method */
102
102
  static VALUE
103
- _rcdb_reader_dump_pair(VALUE key, VALUE val) {
103
+ rcdb_reader_dump_pair(VALUE key, VALUE val) {
104
104
  VALUE str = rb_str_new2("");
105
105
 
106
106
  rb_str_cat2(str, "+");
@@ -117,22 +117,17 @@ _rcdb_reader_dump_pair(VALUE key, VALUE val) {
117
117
 
118
118
  /* Helper method */
119
119
  static VALUE
120
- _rcdb_reader_yield_dump(VALUE pair, VALUE ary) {
121
- return rb_yield(_rcdb_reader_dump_pair(
120
+ rcdb_reader_yield_dump(VALUE pair, VALUE ary) {
121
+ return rb_yield(rcdb_reader_dump_pair(
122
122
  rb_ary_entry(pair, 0), rb_ary_entry(pair, 1)));
123
123
  }
124
124
 
125
125
  /* Helper method */
126
126
  static VALUE
127
- _rcdb_reader_yield_dump2(VALUE val, VALUE ary) {
128
- return rb_yield(_rcdb_reader_dump_pair(rb_ary_entry(ary, 0), val));
127
+ rcdb_reader_yield_dump2(VALUE val, VALUE ary) {
128
+ return rb_yield(rcdb_reader_dump_pair(rb_ary_entry(ary, 0), val));
129
129
  }
130
130
 
131
- RCDB_READER_DEFINE_CALL(each)
132
- RCDB_READER_DEFINE_CALL(each_key)
133
- RCDB_READER_DEFINE_CALL(each_value)
134
- RCDB_READER_DEFINE_CALL(each_dump)
135
-
136
131
  /*
137
132
  * call-seq:
138
133
  * reader.each { |key, val| ... } -> reader
@@ -160,7 +155,7 @@ rcdb_reader_each(int argc, VALUE *argv, VALUE self) {
160
155
  }
161
156
 
162
157
  while (cdb_findnext(&cdbf) > 0) {
163
- rb_yield(_rcdb_reader_read_data(cdb));
158
+ rb_yield(rcdb_reader_read_data(cdb));
164
159
  }
165
160
  }
166
161
  else {
@@ -168,8 +163,8 @@ rcdb_reader_each(int argc, VALUE *argv, VALUE self) {
168
163
 
169
164
  while (cdb_seqnext(&cdbp, cdb) > 0) {
170
165
  rb_yield(rb_ary_new3(2,
171
- _rcdb_reader_read_key(cdb),
172
- _rcdb_reader_read_data(cdb)));
166
+ rcdb_reader_read_key(cdb),
167
+ rcdb_reader_read_data(cdb)));
173
168
  }
174
169
  }
175
170
 
@@ -187,19 +182,16 @@ rcdb_reader_each(int argc, VALUE *argv, VALUE self) {
187
182
  */
188
183
  static VALUE
189
184
  rcdb_reader_each_dump(int argc, VALUE *argv, VALUE self) {
190
- VALUE key, args = rb_ary_new3(1, self), ary = rb_ary_new();
191
- VALUE (*block)(ANYARGS) = _rcdb_reader_yield_dump;
185
+ VALUE key;
192
186
 
193
187
  RCDB_RETURN_ENUMERATOR(self, argc, argv, 1);
194
188
 
195
189
  if (rb_scan_args(argc, argv, "01", &key) == 1 && !NIL_P(key)) {
196
- rb_ary_push(ary, key);
197
- rb_ary_push(args, key);
198
-
199
- block = _rcdb_reader_yield_dump2;
190
+ RCDB_READER_ITERATE0(each, yield_dump2, rb_ary_new3(1, key))
191
+ }
192
+ else {
193
+ RCDB_READER_ITERATE1(each, yield_dump, rb_ary_new())
200
194
  }
201
-
202
- rb_iterate(_rcdb_reader_call_each, args, block, ary);
203
195
 
204
196
  return self;
205
197
  }
@@ -222,7 +214,7 @@ rcdb_reader_each_key(VALUE self) {
222
214
  cdb_seqinit(&cdbp, cdb);
223
215
 
224
216
  while (cdb_seqnext(&cdbp, cdb) > 0) {
225
- if (!st_lookup(RHASH_TBL(hash), key = _rcdb_reader_read_key(cdb), 0)) {
217
+ if (!st_lookup(RHASH_TBL(hash), key = rcdb_reader_read_key(cdb), 0)) {
226
218
  rb_hash_aset(hash, key, Qtrue);
227
219
  rb_yield(key);
228
220
  }
@@ -248,7 +240,7 @@ rcdb_reader_each_value(VALUE self) {
248
240
  cdb_seqinit(&cdbp, cdb);
249
241
 
250
242
  while (cdb_seqnext(&cdbp, cdb) > 0) {
251
- rb_yield(_rcdb_reader_read_data(cdb));
243
+ rb_yield(rcdb_reader_read_data(cdb));
252
244
  }
253
245
 
254
246
  return self;
@@ -262,10 +254,9 @@ rcdb_reader_each_value(VALUE self) {
262
254
  */
263
255
  static VALUE
264
256
  rcdb_reader_fetch(VALUE self, VALUE key) {
265
- RCDB_READER_ITERATE0(each, iter_push,
266
- rb_ary_new(), rb_ary_new3(2, self, key))
267
-
268
- return arg;
257
+ VALUE ary = rb_ary_new();
258
+ RCDB_READER_ITERATE0(each, iter_push, ary)
259
+ return ary;
269
260
  }
270
261
 
271
262
  /*
@@ -283,7 +274,7 @@ rcdb_reader_fetch_first(VALUE self, VALUE key) {
283
274
  RCDB_READER_GET(self, cdb);
284
275
 
285
276
  if (cdb_find(cdb, RSTRING_PTR(key), RSTRING_LEN(key)) > 0) {
286
- val = _rcdb_reader_read_data(cdb);
277
+ val = rcdb_reader_read_data(cdb);
287
278
  }
288
279
 
289
280
  return val;
@@ -355,7 +346,7 @@ rcdb_reader_values(VALUE self) {
355
346
  static VALUE
356
347
  rcdb_reader_values_at(int argc, VALUE *argv, VALUE self) {
357
348
  VALUE ary = rb_ary_new();
358
- long i;
349
+ int i;
359
350
 
360
351
  for (i = 0; i < argc; i++) {
361
352
  rb_ary_push(ary, rcdb_reader_fetch(self, argv[i]));
@@ -1,30 +1,22 @@
1
- #ifndef __RCDB_READER_H__
2
- #define __RCDB_READER_H__
1
+ #ifndef RCDB_READER_H
2
+ #define RCDB_READER_H
3
3
 
4
4
  #define RCDB_READER_GET(obj, ptr) RCDB_GET_STRUCT(read, cdb, obj, ptr)
5
5
 
6
- #define RCDB_READER_DEFINE_CALL(iter) \
7
- static VALUE \
8
- _rcdb_reader_call_##iter(VALUE args) {\
9
- VALUE self = rb_ary_shift(args);\
10
- return rb_funcall2(self, rb_intern(#iter),\
11
- RARRAY_LEN(args), RARRAY_PTR(args));\
12
- }
13
-
14
- #define RCDB_READER_ITERATE0(method, block, arg1, arg2) \
15
- VALUE arg = arg1;\
16
- rb_iterate(_rcdb_reader_call_##method, arg2, _rcdb_reader_##block, arg);
6
+ #define RCDB_READER_ITERATE0(method, block, arg) \
7
+ rb_block_call(self, rb_intern(#method), 1, &key, rcdb_reader_##block, arg);
17
8
 
18
- #define RCDB_READER_ITERATE1(method, block, arg1) \
19
- RCDB_READER_ITERATE0(method, block, arg1, rb_ary_new3(1, self))
9
+ #define RCDB_READER_ITERATE1(method, block, arg) \
10
+ VALUE ret = arg;\
11
+ rb_block_call(self, rb_intern(#method), 0, 0, rcdb_reader_##block, ret);
20
12
 
21
- #define RCDB_READER_ITERATE(method, block, arg1) \
22
- RCDB_READER_ITERATE1(method, block, arg1)\
23
- return arg;
13
+ #define RCDB_READER_ITERATE(method, block, arg) \
14
+ RCDB_READER_ITERATE1(method, block, arg)\
15
+ return ret;
24
16
 
25
- #define RCDB_READER_ITERATE_ARY(method, block, arg1) \
26
- RCDB_READER_ITERATE1(method, block, arg1)\
27
- return rb_ary_entry(arg, 0);
17
+ #define RCDB_READER_ITERATE_ARY(method, block, arg) \
18
+ RCDB_READER_ITERATE1(method, block, arg)\
19
+ return rb_ary_entry(ret, 0);
28
20
 
29
21
  #define RCDB_READER_BREAK_EQUAL(val, ret) \
30
22
  if (RTEST(rb_funcall(val, rb_intern("=="), 1, rb_ary_entry(ary, 1)))) {\
@@ -36,7 +28,7 @@ _rcdb_reader_call_##iter(VALUE args) {\
36
28
 
37
29
  #define RCDB_READER_DEFINE_READ(what) \
38
30
  static VALUE \
39
- _rcdb_reader_read_##what(struct cdb *cdb) {\
31
+ rcdb_reader_read_##what(struct cdb *cdb) {\
40
32
  size_t len;\
41
33
  VALUE ret;\
42
34
  \
@@ -52,4 +44,4 @@ _rcdb_reader_read_##what(struct cdb *cdb) {\
52
44
  extern VALUE cCDBReader;
53
45
  void rcdb_init_reader(void);
54
46
 
55
- #endif /* __RCDB_READER_H__ */
47
+ #endif /* RCDB_READER_H */
@@ -99,7 +99,7 @@ rcdb_writer_put_value(struct cdb_make *cdbm, VALUE key, VALUE val, enum cdb_put_
99
99
  }
100
100
 
101
101
  for (i = 0; i < RARRAY_LEN(val); i++) {
102
- rcdb_writer_put_pair(cdbm, key, RARRAY_PTR(val)[i], mode);
102
+ rcdb_writer_put_pair(cdbm, key, rb_ary_entry(val, i), mode);
103
103
  }
104
104
 
105
105
  break;
@@ -113,7 +113,7 @@ rcdb_writer_put_value(struct cdb_make *cdbm, VALUE key, VALUE val, enum cdb_put_
113
113
  static VALUE
114
114
  rcdb_writer_put(int argc, VALUE *argv, VALUE self, enum cdb_put_mode mode) {
115
115
  struct cdb_make *cdbm = NULL;
116
- VALUE arg, val;
116
+ VALUE arg, val, tmp;
117
117
  long i;
118
118
 
119
119
  RCDB_WRITER_GET(self, cdbm);
@@ -127,7 +127,7 @@ rcdb_writer_put(int argc, VALUE *argv, VALUE self, enum cdb_put_mode mode) {
127
127
  val = rb_str_new2("");
128
128
 
129
129
  for (i = 0; i < RARRAY_LEN(arg); i++) {
130
- rcdb_writer_put_pair(cdbm, RARRAY_PTR(arg)[i], val, mode);
130
+ rcdb_writer_put_pair(cdbm, rb_ary_entry(arg, i), val, mode);
131
131
  }
132
132
 
133
133
  break;
@@ -136,9 +136,11 @@ rcdb_writer_put(int argc, VALUE *argv, VALUE self, enum cdb_put_mode mode) {
136
136
  st_foreach(RHASH_TBL(arg), rcdb_writer_push_pair, val);
137
137
 
138
138
  for (i = 0; i < RARRAY_LEN(val); i++) {
139
+ tmp = rb_ary_entry(val, i);
140
+
139
141
  rcdb_writer_put_value(cdbm,
140
- rb_ary_entry(RARRAY_PTR(val)[i], 0),
141
- rb_ary_entry(RARRAY_PTR(val)[i], 1),
142
+ rb_ary_entry(tmp, 0),
143
+ rb_ary_entry(tmp, 1),
142
144
  mode);
143
145
  }
144
146
 
@@ -1,9 +1,9 @@
1
- #ifndef __RCDB_WRITER_H__
2
- #define __RCDB_WRITER_H__
1
+ #ifndef RCDB_WRITER_H
2
+ #define RCDB_WRITER_H
3
3
 
4
4
  #define RCDB_WRITER_GET(obj, ptr) RCDB_GET_STRUCT(writ, cdb_make, obj, ptr)
5
5
 
6
6
  extern VALUE cCDBWriter;
7
7
  void rcdb_init_writer(void);
8
8
 
9
- #endif /* __RCDB_WRITER_H__ */
9
+ #endif /* RCDB_WRITER_H */
@@ -1,5 +1,5 @@
1
- #ifndef __RUBY_LIBCDB_H__
2
- #define __RUBY_LIBCDB_H__
1
+ #ifndef RUBY_LIBCDB_H
2
+ #define RUBY_LIBCDB_H
3
3
 
4
4
  #include <ruby.h>
5
5
  #if HAVE_RUBY_IO_H
@@ -24,4 +24,4 @@
24
24
 
25
25
  extern VALUE mLibCDB;
26
26
 
27
- #endif /* __RUBY_LIBCDB_H__ */
27
+ #endif /* RUBY_LIBCDB_H */
Binary file
@@ -5,8 +5,8 @@ module LibCDB
5
5
  module Version
6
6
 
7
7
  MAJOR = 0
8
- MINOR = 0
9
- TINY = 4
8
+ MINOR = 1
9
+ TINY = 0
10
10
 
11
11
  class << self
12
12
 
data/lib/libcdb.rb CHANGED
@@ -45,7 +45,15 @@ module LibCDB
45
45
  begin
46
46
  yield cdb
47
47
  ensure
48
- cdb.close
48
+ err = $!
49
+
50
+ begin
51
+ cdb.close
52
+ rescue
53
+ raise unless err
54
+ end
55
+
56
+ raise err if err
49
57
  end
50
58
  else
51
59
  cdb
@@ -68,11 +68,11 @@ describe LibCDB::CDB::Reader do
68
68
  end
69
69
 
70
70
  it "should know if it doesn't have a key" do
71
- @db.should_not have_key('key3')
71
+ @db.should_not have_key('k3')
72
72
  end
73
73
 
74
74
  it "should know if it doesn't have a value" do
75
- @db.should_not have_value('value3.2')
75
+ @db.should_not have_value('v3.2')
76
76
  end
77
77
 
78
78
  it "should dump itself" do
@@ -108,11 +108,11 @@ describe LibCDB::CDB::Reader do
108
108
  end
109
109
 
110
110
  it "should know its size" do
111
- @db.size.should == 11
111
+ @db.size.should == TEST_DATA.size
112
112
  end
113
113
 
114
114
  it "should know its total" do
115
- @db.total.should == 56
115
+ @db.total.should == TEST_DATA.values.flatten.size
116
116
  end
117
117
 
118
118
  it "should know its keys" do
@@ -124,27 +124,27 @@ describe LibCDB::CDB::Reader do
124
124
  end
125
125
 
126
126
  it "should know if it has a key" do
127
- @db.should have_key('key3')
127
+ @db.should have_key('k3')
128
128
  end
129
129
 
130
130
  it "should know if it doesn't have a key" do
131
- @db.should_not have_key('key33')
131
+ @db.should_not have_key('none')
132
132
  end
133
133
 
134
134
  it "should know if it has a value" do
135
- @db.should have_value('value3.2')
135
+ @db.should have_value('v3.2')
136
136
  end
137
137
 
138
138
  it "should know if it doesn't have a value" do
139
- @db.should_not have_value('value33.22')
139
+ @db.should_not have_value('none')
140
140
  end
141
141
 
142
142
  it "should get a single value" do
143
- @db['key1'].should == 'value1.1'
143
+ @db['k1'].should == 'v1.1'
144
144
  end
145
145
 
146
146
  it "should not get non-existent value" do
147
- @db['key33'].should be_nil
147
+ @db['none'].should be_nil
148
148
  end
149
149
 
150
150
  it "should get each value" do
@@ -162,21 +162,21 @@ describe LibCDB::CDB::Reader do
162
162
  end
163
163
 
164
164
  it "should get last value" do
165
- @db.fetch_last('key10').should == 'value10.10'
165
+ @db.fetch_last('k10').should == 'v10.10'
166
166
  end
167
167
 
168
168
  it "should find the key for a value" do
169
- @db.key('value3.2').should == 'key3'
169
+ @db.key('v3.2').should == 'k3'
170
170
  end
171
171
 
172
172
  it "should not find the key for a non-existent value" do
173
- @db.key('value33.22').should be_nil
173
+ @db.key('none').should be_nil
174
174
  end
175
175
 
176
176
  it "should dump records for key" do
177
177
  d = []
178
- @db.each_dump('key3') { |e| d << e }
179
- d.should == %w[+4,8:key3->value3.1 +4,8:key3->value3.2 +4,8:key3->value3.3]
178
+ @db.each_dump('k3') { |e| d << e }
179
+ d.should == %w[+2,4:k3->v3.1 +2,4:k3->v3.2 +2,4:k3->v3.3]
180
180
  end
181
181
 
182
182
  it "should convert itself into a hash" do
data/spec/spec_helper.rb CHANGED
@@ -8,8 +8,8 @@ RSpec.configure { |config|
8
8
  TEST_DATA = {}
9
9
 
10
10
  1.upto(10) { |i|
11
- v = TEST_DATA["key#{i}"] = []
12
- 1.upto(i) { |j| v << "value#{i}.#{j}" }
11
+ v = TEST_DATA["k#{i}"] = []
12
+ 1.upto(i) { |j| v << "v#{i}.#{j}" }
13
13
  }
14
14
 
15
15
  TEST_DATA['a' * 1024] = Array('b' * 1024 ** 2)
metadata CHANGED
@@ -1,18 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libcdb-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: x86-mingw32
7
6
  authors:
8
7
  - Jens Wille
9
8
  autorequire:
10
9
  bindir: bin
11
- cert_chain: []
12
- date: 2012-08-09 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQswCQYDVQQDDAJ3dzEb
14
+ MBkGCgmSJomT8ixkARkWC2JsYWNrd2ludGVyMRIwEAYKCZImiZPyLGQBGRYCZGUw
15
+ HhcNMTMwMTMxMDkyMjIyWhcNMTQwMTMxMDkyMjIyWjA+MQswCQYDVQQDDAJ3dzEb
16
+ MBkGCgmSJomT8ixkARkWC2JsYWNrd2ludGVyMRIwEAYKCZImiZPyLGQBGRYCZGUw
17
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVXmfa6rbTwKOvtuGoROc1
18
+ I4qZjgLX0BA4WecYB97PjwLJmJ1hRvf9JulVCJYYmt5ZEPPXbgi9xLbcp6ofGmnC
19
+ i68/kbhcz20/fRUtIJ2phU3ypQTEd2pFddpL7SR2FxLkzvvg5E6nslGn7o2erDpO
20
+ 8sm610A3xsgT/eNIr9QA7k4pHh18X1KvZKmmQR4/AjVyKmKawzauKUoHHepjvjVs
21
+ s0pVoM7UmOmrS4SafQ3OwUo37f19CVdN2/FW7z3e5+iYhKxdIFdhniX9iDWtA3Jn
22
+ 7oUOtiolhCRK4P/c30UjTCDkRkOldsWciFUasROJ5VAV2SVv7FtGHoQLDZ/++tRr
23
+ AgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFIAPWU4BEoYUe82hY/0EkoGd
24
+ Oo/WMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAf2YnB0mj42of22dA
25
+ MimgJCAEgB3H5aHbZ6B5WVnFvrC2UUnhP+/kLj/6UgOfqcasy4Xh62NVGuNrf7rF
26
+ 7NMN87XwexGuU2GCpIMUd6VCTA7zMP2OWuXEcba7jT5OtiI55buO0J4CRtyeX1XF
27
+ qwlGgx4ItcGhMTlDFXj3IkpeVtjD8O7yWE21bHf9lLURmqK/r9KjoxrrVi7+cESJ
28
+ H19TDW3R9p594jCl1ykPs3dz/0Bk+r1HTd35Yw+yBbyprSJb4S7OcRRHCryuo09l
29
+ NBGyZvOBuqUp0xostWSk0dfxyn/YQ7eqvQRGBhK1VGa7Tg/KYqnemDE57+VOXrua
30
+ 59wzaA==
31
+ -----END CERTIFICATE-----
32
+ date: 2013-08-03 00:00:00.000000000 Z
13
33
  dependencies: []
14
34
  description: Ruby bindings for CDB Constant Databases.
15
- email: jens.wille@uni-koeln.de
35
+ email: jens.wille@gmail.com
16
36
  executables: []
17
37
  extensions: []
18
38
  extra_rdoc_files:
@@ -24,32 +44,34 @@ extra_rdoc_files:
24
44
  - ext/libcdb/ruby_cdb_reader.c
25
45
  - ext/libcdb/ruby_cdb_writer.c
26
46
  files:
27
- - lib/libcdb-ruby.rb
28
47
  - lib/cdb.rb
29
- - lib/libcdb/version.rb
48
+ - lib/libcdb-ruby.rb
30
49
  - lib/libcdb.rb
50
+ - lib/libcdb/version.rb
31
51
  - COPYING
32
- - TODO
33
52
  - ChangeLog
34
- - Rakefile
35
53
  - README
36
- - ext/libcdb/ruby_cdb_writer.c
37
- - ext/libcdb/ruby_cdb.h
38
- - ext/libcdb/libcdb_ruby.def
54
+ - Rakefile
55
+ - TODO
39
56
  - ext/libcdb/extconf.rb
40
- - ext/libcdb/ruby_cdb_writer.h
41
- - ext/libcdb/ruby_libcdb.h
42
- - ext/libcdb/ruby_cdb_reader.h
43
57
  - ext/libcdb/libcdb.c
44
- - ext/libcdb/ruby_cdb_reader.c
58
+ - ext/libcdb/libcdb_ruby.def
45
59
  - ext/libcdb/ruby_cdb.c
46
- - spec/spec_helper.rb
60
+ - ext/libcdb/ruby_cdb.h
61
+ - ext/libcdb/ruby_cdb_reader.c
62
+ - ext/libcdb/ruby_cdb_reader.h
63
+ - ext/libcdb/ruby_cdb_writer.c
64
+ - ext/libcdb/ruby_cdb_writer.h
65
+ - ext/libcdb/ruby_libcdb.h
47
66
  - spec/libcdb/reader_spec.rb
48
67
  - spec/libcdb/writer_spec.rb
68
+ - spec/spec_helper.rb
49
69
  - .rspec
50
70
  - lib/libcdb/libcdb_ruby.so
51
71
  homepage: http://github.com/blackwinter/libcdb-ruby
52
- licenses: []
72
+ licenses:
73
+ - AGPL
74
+ metadata: {}
53
75
  post_install_message:
54
76
  rdoc_options:
55
77
  - --charset
@@ -57,27 +79,25 @@ rdoc_options:
57
79
  - --line-numbers
58
80
  - --all
59
81
  - --title
60
- - libcdb-ruby Application documentation (v0.0.4)
82
+ - libcdb-ruby Application documentation (v0.1.0)
61
83
  - --main
62
84
  - README
63
85
  require_paths:
64
86
  - lib
65
87
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
88
  requirements:
68
- - - ! '>='
89
+ - - '>='
69
90
  - !ruby/object:Gem::Version
70
- version: '0'
91
+ version: 1.9.2
71
92
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
93
  requirements:
74
- - - ! '>='
94
+ - - '>='
75
95
  - !ruby/object:Gem::Version
76
96
  version: '0'
77
97
  requirements: []
78
98
  rubyforge_project:
79
- rubygems_version: 1.8.24
99
+ rubygems_version: 2.0.6
80
100
  signing_key:
81
- specification_version: 3
101
+ specification_version: 4
82
102
  summary: Ruby bindings for CDB Constant Databases.
83
103
  test_files: []