moneta 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README.md +52 -51
- data/Rakefile +1 -3
- data/lib/moneta/adapters/daybreak.rb +7 -9
- data/lib/moneta/adapters/file.rb +2 -2
- data/lib/moneta/adapters/memcached/dalli.rb +1 -0
- data/lib/moneta/adapters/memcached/native.rb +1 -0
- data/lib/moneta/transformer.rb +4 -4
- data/lib/moneta/transformer/config.rb +2 -1
- data/lib/moneta/version.rb +1 -1
- data/script/benchmarks +52 -44
- data/script/generate-specs +238 -49
- data/spec/helper.rb +4 -0
- data/spec/moneta/adapter_activerecord_spec.rb +5 -0
- data/spec/moneta/adapter_cassandra_spec.rb +5 -0
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_client_spec.rb +5 -0
- data/spec/moneta/adapter_cookie_spec.rb +4 -0
- data/spec/moneta/adapter_couch_spec.rb +5 -0
- data/spec/moneta/adapter_datamapper_spec.rb +5 -0
- data/spec/moneta/adapter_daybreak_spec.rb +4 -0
- data/spec/moneta/adapter_dbm_spec.rb +4 -0
- data/spec/moneta/adapter_file_spec.rb +5 -0
- data/spec/moneta/adapter_fog_spec.rb +5 -0
- data/spec/moneta/adapter_gdbm_spec.rb +5 -0
- data/spec/moneta/adapter_hbase_spec.rb +5 -0
- data/spec/moneta/adapter_leveldb_spec.rb +4 -0
- data/spec/moneta/adapter_localmemcache_spec.rb +5 -0
- data/spec/moneta/adapter_lruhash_spec.rb +4 -0
- data/spec/moneta/adapter_memcached_dalli_spec.rb +5 -0
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_memcached_native_spec.rb +5 -0
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_memcached_spec.rb +5 -0
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_memory_spec.rb +4 -0
- data/spec/moneta/adapter_mongo_spec.rb +5 -0
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_pstore_spec.rb +5 -0
- data/spec/moneta/adapter_redis_spec.rb +5 -0
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +5 -0
- data/spec/moneta/adapter_restclient_spec.rb +5 -0
- data/spec/moneta/adapter_riak_spec.rb +5 -0
- data/spec/moneta/adapter_sdbm_spec.rb +4 -0
- data/spec/moneta/adapter_sequel_spec.rb +5 -0
- data/spec/moneta/adapter_sqlite_spec.rb +5 -0
- data/spec/moneta/adapter_tdb_spec.rb +4 -0
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +4 -0
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +4 -0
- data/spec/moneta/adapter_yaml_spec.rb +5 -0
- data/spec/moneta/cache_file_memory_spec.rb +5 -0
- data/spec/moneta/cache_memory_null_spec.rb +4 -0
- data/spec/moneta/expires_file_spec.rb +5 -0
- data/spec/moneta/expires_memory_spec.rb +4 -0
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +4 -0
- data/spec/moneta/lock_spec.rb +4 -0
- data/spec/moneta/null_adapter_spec.rb +4 -0
- data/spec/moneta/optionmerger_spec.rb +5 -1
- data/spec/moneta/pool_spec.rb +5 -0
- data/spec/moneta/proxy_expires_memory_spec.rb +4 -0
- data/spec/moneta/proxy_redis_spec.rb +5 -0
- data/spec/moneta/shared_spec.rb +5 -0
- data/spec/moneta/simple_activerecord_spec.rb +6 -1
- data/spec/moneta/simple_activerecord_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_cassandra_spec.rb +6 -1
- data/spec/moneta/simple_client_tcp_spec.rb +6 -1
- data/spec/moneta/simple_client_unix_spec.rb +6 -1
- data/spec/moneta/simple_couch_spec.rb +6 -1
- data/spec/moneta/simple_couch_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_datamapper_spec.rb +6 -1
- data/spec/moneta/simple_datamapper_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_datamapper_with_repository_spec.rb +6 -1
- data/spec/moneta/simple_daybreak_spec.rb +5 -1
- data/spec/moneta/simple_daybreak_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_dbm_spec.rb +5 -1
- data/spec/moneta/simple_dbm_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_file_spec.rb +6 -1
- data/spec/moneta/simple_file_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_fog_spec.rb +6 -1
- data/spec/moneta/simple_fog_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_gdbm_spec.rb +5 -1
- data/spec/moneta/simple_gdbm_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_hashfile_spec.rb +6 -1
- data/spec/moneta/simple_hashfile_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_hbase_spec.rb +6 -1
- data/spec/moneta/simple_hbase_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_leveldb_spec.rb +5 -1
- data/spec/moneta/simple_leveldb_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_localmemcache_spec.rb +6 -1
- data/spec/moneta/simple_localmemcache_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_lruhash_spec.rb +5 -1
- data/spec/moneta/simple_lruhash_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_memcached_dalli_spec.rb +6 -1
- data/spec/moneta/simple_memcached_native_spec.rb +6 -1
- data/spec/moneta/simple_memcached_spec.rb +6 -1
- data/spec/moneta/simple_memory_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_compress_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_json_key_serializer_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_json_serializer_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_json_value_serializer_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_prefix_spec.rb +5 -1
- data/spec/moneta/simple_memory_with_snappy_compress_spec.rb +5 -1
- data/spec/moneta/simple_mongo_spec.rb +6 -1
- data/spec/moneta/simple_null_spec.rb +5 -1
- data/spec/moneta/simple_pstore_spec.rb +6 -1
- data/spec/moneta/simple_pstore_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_redis_spec.rb +6 -1
- data/spec/moneta/simple_restclient_spec.rb +6 -1
- data/spec/moneta/simple_riak_spec.rb +6 -1
- data/spec/moneta/simple_riak_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_sdbm_spec.rb +5 -1
- data/spec/moneta/simple_sdbm_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_sequel_spec.rb +6 -1
- data/spec/moneta/simple_sequel_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_sqlite_spec.rb +6 -1
- data/spec/moneta/simple_sqlite_with_expires_spec.rb +6 -1
- data/spec/moneta/simple_tdb_spec.rb +5 -1
- data/spec/moneta/simple_tdb_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_tokyocabinet_spec.rb +5 -1
- data/spec/moneta/simple_tokyocabinet_with_expires_spec.rb +5 -1
- data/spec/moneta/simple_yaml_spec.rb +6 -1
- data/spec/moneta/simple_yaml_with_expires_spec.rb +6 -1
- data/spec/moneta/stack_file_memory_spec.rb +5 -0
- data/spec/moneta/stack_memory_file_spec.rb +5 -0
- data/spec/moneta/transformer_bencode_spec.rb +8 -0
- data/spec/moneta/transformer_bert_spec.rb +8 -0
- data/spec/moneta/transformer_bson_spec.rb +8 -0
- data/spec/moneta/transformer_bzip2_spec.rb +8 -0
- data/spec/moneta/transformer_json_spec.rb +8 -0
- data/spec/moneta/transformer_key_marshal_spec.rb +8 -0
- data/spec/moneta/transformer_key_to_s_spec.rb +72 -0
- data/spec/moneta/transformer_key_yaml_spec.rb +8 -0
- data/spec/moneta/transformer_lzma_spec.rb +8 -0
- data/spec/moneta/transformer_lzo_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_base64_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_escape_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_hmac_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_md5_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_prefix_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_sha1_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_sha256_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_sha384_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_sha512_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_truncate_spec.rb +8 -0
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +8 -0
- data/spec/moneta/transformer_msgpack_spec.rb +8 -0
- data/spec/moneta/transformer_ox_spec.rb +8 -0
- data/spec/moneta/transformer_quicklz_spec.rb +8 -0
- data/spec/moneta/transformer_snappy_spec.rb +8 -0
- data/spec/moneta/transformer_tnet_spec.rb +8 -0
- data/spec/moneta/transformer_value_marshal_spec.rb +8 -0
- data/spec/moneta/transformer_value_yaml_spec.rb +8 -0
- data/spec/moneta/transformer_yaml_spec.rb +8 -0
- data/spec/moneta/transformer_zlib_spec.rb +8 -0
- data/spec/monetaspecs.rb +11 -0
- metadata +4 -2
data/script/generate-specs
CHANGED
@@ -50,7 +50,11 @@ class Specs
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def without_persist
|
53
|
-
new(:specs => specs.without(:persist).with(:not_persist))
|
53
|
+
new(:specs => specs.without(:persist).without(:multiprocess).with(:not_persist))
|
54
|
+
end
|
55
|
+
|
56
|
+
def without_multiprocess
|
57
|
+
new(:specs => specs.without(:multiprocess))
|
54
58
|
end
|
55
59
|
|
56
60
|
def with_expires
|
@@ -96,8 +100,8 @@ class Specs
|
|
96
100
|
end
|
97
101
|
end
|
98
102
|
|
99
|
-
ADAPTER_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :increment, :persist], :key => %w(string), :value => %w(string))
|
100
|
-
STANDARD_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :marshallable_key, :marshallable_value, :transform_value, :increment, :persist])
|
103
|
+
ADAPTER_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :increment, :persist, :multiprocess], :key => %w(string), :value => %w(string))
|
104
|
+
STANDARD_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :marshallable_key, :marshallable_value, :transform_value, :increment, :persist, :multiprocess])
|
101
105
|
TRANSFORMER_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :transform_value, :increment])
|
102
106
|
|
103
107
|
header = "# Generated by #{File.basename(__FILE__)}\n"
|
@@ -226,62 +230,62 @@ end
|
|
226
230
|
'simple_dbm' => {
|
227
231
|
:store => :DBM,
|
228
232
|
:options => ':file => File.join(make_tempdir, "simple_dbm")',
|
229
|
-
:specs => STANDARD_SPECS
|
233
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
230
234
|
},
|
231
235
|
'simple_dbm_with_expires' => {
|
232
236
|
:store => :DBM,
|
233
237
|
:options => ':file => File.join(make_tempdir, "simple_dbm_with_expires"), :expires => true',
|
234
|
-
:specs => STANDARD_SPECS.with_expires
|
238
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
235
239
|
},
|
236
240
|
'simple_tdb' => {
|
237
241
|
:store => :TDB,
|
238
242
|
:options => ':file => File.join(make_tempdir, "simple_tdb")',
|
239
|
-
:specs => STANDARD_SPECS
|
243
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
240
244
|
},
|
241
245
|
'simple_tdb_with_expires' => {
|
242
246
|
:store => :TDB,
|
243
247
|
:options => ':file => File.join(make_tempdir, "simple_tdb_with_expires"), :expires => true',
|
244
|
-
:specs => STANDARD_SPECS.with_expires
|
248
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
245
249
|
},
|
246
250
|
'simple_daybreak' => {
|
247
251
|
:store => :Daybreak,
|
248
252
|
:options => ':file => File.join(make_tempdir, "simple_daybreak")',
|
249
|
-
:specs => STANDARD_SPECS
|
253
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
250
254
|
},
|
251
255
|
'simple_daybreak_with_expires' => {
|
252
256
|
:store => :Daybreak,
|
253
257
|
:options => ':file => File.join(make_tempdir, "simple_daybreak_with_expires"), :expires => true',
|
254
|
-
:specs => STANDARD_SPECS.with_expires
|
258
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
255
259
|
},
|
256
260
|
'simple_gdbm' => {
|
257
261
|
:store => :GDBM,
|
258
262
|
:options => ':file => File.join(make_tempdir, "simple_gdbm")',
|
259
|
-
:specs => STANDARD_SPECS
|
263
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
260
264
|
},
|
261
265
|
'simple_gdbm_with_expires' => {
|
262
266
|
:store => :GDBM,
|
263
267
|
:options => ':file => File.join(make_tempdir, "simple_gdbm_with_expires"), :expires => true',
|
264
|
-
:specs => STANDARD_SPECS.with_expires
|
268
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
265
269
|
},
|
266
270
|
'simple_sdbm' => {
|
267
271
|
:store => :SDBM,
|
268
272
|
:options => ':file => File.join(make_tempdir, "simple_sdbm")',
|
269
|
-
:specs => STANDARD_SPECS
|
273
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
270
274
|
},
|
271
275
|
'simple_sdbm_with_expires' => {
|
272
276
|
:store => :SDBM,
|
273
277
|
:options => ':file => File.join(make_tempdir, "simple_sdbm_with_expires"), :expires => true',
|
274
|
-
:specs => STANDARD_SPECS.with_expires
|
278
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
275
279
|
},
|
276
280
|
'simple_leveldb' => {
|
277
281
|
:store => :LevelDB,
|
278
282
|
:options => ':dir => File.join(make_tempdir, "simple_leveldb")',
|
279
|
-
:specs => STANDARD_SPECS
|
283
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
280
284
|
},
|
281
285
|
'simple_leveldb_with_expires' => {
|
282
286
|
:store => :LevelDB,
|
283
287
|
:options => ':dir => File.join(make_tempdir, "simple_leveldb_with_expires"), :expires => true',
|
284
|
-
:specs => STANDARD_SPECS.with_expires
|
288
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
285
289
|
},
|
286
290
|
'simple_pstore' => {
|
287
291
|
:store => :PStore,
|
@@ -320,12 +324,12 @@ end
|
|
320
324
|
'simple_tokyocabinet' => {
|
321
325
|
:store => :TokyoCabinet,
|
322
326
|
:options => ':file => File.join(make_tempdir, "simple_tokyocabinet")',
|
323
|
-
:specs => STANDARD_SPECS
|
327
|
+
:specs => STANDARD_SPECS.without_multiprocess
|
324
328
|
},
|
325
329
|
'simple_tokyocabinet_with_expires' => {
|
326
330
|
:store => :TokyoCabinet,
|
327
331
|
:options => ':file => File.join(make_tempdir, "simple_tokyocabinet_with_expires"), :expires => true',
|
328
|
-
:specs => STANDARD_SPECS.with_expires
|
332
|
+
:specs => STANDARD_SPECS.without_multiprocess.with_expires
|
329
333
|
},
|
330
334
|
'simple_sqlite' => {
|
331
335
|
:store => :Sqlite,
|
@@ -605,7 +609,12 @@ end},
|
|
605
609
|
adapter :Memory
|
606
610
|
end},
|
607
611
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
608
|
-
:load_value => '::Zlib::Inflate.inflate(value)'
|
612
|
+
:load_value => '::Zlib::Inflate.inflate(value)',
|
613
|
+
:tests => %{
|
614
|
+
it 'compile transformer class' do
|
615
|
+
store.should_not be_nil
|
616
|
+
Moneta::Transformer::ZlibValue.should_not be_nil
|
617
|
+
end}
|
609
618
|
},
|
610
619
|
'transformer_bzip2' => {
|
611
620
|
:build => %{Moneta.build do
|
@@ -613,7 +622,12 @@ end},
|
|
613
622
|
adapter :Memory
|
614
623
|
end},
|
615
624
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
616
|
-
:load_value => '::Bzip2.uncompress(value)'
|
625
|
+
:load_value => '::Bzip2.uncompress(value)',
|
626
|
+
:tests => %{
|
627
|
+
it 'compile transformer class' do
|
628
|
+
store.should_not be_nil
|
629
|
+
Moneta::Transformer::Bzip2Value.should_not be_nil
|
630
|
+
end}
|
617
631
|
},
|
618
632
|
'transformer_lzo' => {
|
619
633
|
:build => %{Moneta.build do
|
@@ -621,7 +635,12 @@ end},
|
|
621
635
|
adapter :Memory
|
622
636
|
end},
|
623
637
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
624
|
-
:load_value => '::LZO.decompress(value)'
|
638
|
+
:load_value => '::LZO.decompress(value)',
|
639
|
+
:tests => %{
|
640
|
+
it 'compile transformer class' do
|
641
|
+
store.should_not be_nil
|
642
|
+
Moneta::Transformer::LzoValue.should_not be_nil
|
643
|
+
end}
|
625
644
|
},
|
626
645
|
'transformer_lzma' => {
|
627
646
|
:build => %{Moneta.build do
|
@@ -629,7 +648,12 @@ end},
|
|
629
648
|
adapter :Memory
|
630
649
|
end},
|
631
650
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
632
|
-
:load_value => '::LZMA.decompress(value)'
|
651
|
+
:load_value => '::LZMA.decompress(value)',
|
652
|
+
:tests => %{
|
653
|
+
it 'compile transformer class' do
|
654
|
+
store.should_not be_nil
|
655
|
+
Moneta::Transformer::LzmaValue.should_not be_nil
|
656
|
+
end}
|
633
657
|
},
|
634
658
|
'transformer_snappy' => {
|
635
659
|
:build => %{Moneta.build do
|
@@ -637,7 +661,12 @@ end},
|
|
637
661
|
adapter :Memory
|
638
662
|
end},
|
639
663
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
640
|
-
:load_value => '::Snappy.inflate(value)'
|
664
|
+
:load_value => '::Snappy.inflate(value)',
|
665
|
+
:tests => %{
|
666
|
+
it 'compile transformer class' do
|
667
|
+
store.should_not be_nil
|
668
|
+
Moneta::Transformer::SnappyValue.should_not be_nil
|
669
|
+
end}
|
641
670
|
},
|
642
671
|
'transformer_quicklz' => {
|
643
672
|
:build => %{Moneta.build do
|
@@ -645,7 +674,12 @@ end},
|
|
645
674
|
adapter :Memory
|
646
675
|
end},
|
647
676
|
:specs => TRANSFORMER_SPECS.stringvalues_only,
|
648
|
-
:load_value => '::QuickLZ.decompress(value)'
|
677
|
+
:load_value => '::QuickLZ.decompress(value)',
|
678
|
+
:tests => %{
|
679
|
+
it 'compile transformer class' do
|
680
|
+
store.should_not be_nil
|
681
|
+
Moneta::Transformer::QuicklzValue.should_not be_nil
|
682
|
+
end}
|
649
683
|
},
|
650
684
|
'transformer_json' => {
|
651
685
|
:build => %{Moneta.build do
|
@@ -653,7 +687,12 @@ end},
|
|
653
687
|
adapter :Memory
|
654
688
|
end},
|
655
689
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
656
|
-
:load_value => '::MultiJson.load(value).first'
|
690
|
+
:load_value => '::MultiJson.load(value).first',
|
691
|
+
:tests => %{
|
692
|
+
it 'compile transformer class' do
|
693
|
+
store.should_not be_nil
|
694
|
+
Moneta::Transformer::JsonKeyJsonValue.should_not be_nil
|
695
|
+
end}
|
657
696
|
},
|
658
697
|
'transformer_bert' => {
|
659
698
|
:build => %{Moneta.build do
|
@@ -661,7 +700,12 @@ end},
|
|
661
700
|
adapter :Memory
|
662
701
|
end},
|
663
702
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
664
|
-
:load_value => '::BERT.decode(value)'
|
703
|
+
:load_value => '::BERT.decode(value)',
|
704
|
+
:tests => %{
|
705
|
+
it 'compile transformer class' do
|
706
|
+
store.should_not be_nil
|
707
|
+
Moneta::Transformer::BertKeyBertValue.should_not be_nil
|
708
|
+
end}
|
665
709
|
},
|
666
710
|
'transformer_bencode' => {
|
667
711
|
:build => %{Moneta.build do
|
@@ -669,7 +713,13 @@ end},
|
|
669
713
|
adapter :Memory
|
670
714
|
end},
|
671
715
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
672
|
-
:load_value => '::BEncode.load(value)'
|
716
|
+
:load_value => '::BEncode.load(value)',
|
717
|
+
:tests => %{
|
718
|
+
it 'compile transformer class' do
|
719
|
+
store.should_not be_nil
|
720
|
+
Moneta::Transformer::BencodeKeyBencodeValue.should_not be_nil
|
721
|
+
end}
|
722
|
+
|
673
723
|
},
|
674
724
|
'transformer_bson' => {
|
675
725
|
:build => %{Moneta.build do
|
@@ -677,7 +727,12 @@ end},
|
|
677
727
|
adapter :Memory
|
678
728
|
end},
|
679
729
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
680
|
-
:load_value => "::BSON.deserialize(value)['v']"
|
730
|
+
:load_value => "::BSON.deserialize(value)['v']",
|
731
|
+
:tests => %{
|
732
|
+
it 'compile transformer class' do
|
733
|
+
store.should_not be_nil
|
734
|
+
Moneta::Transformer::BsonKeyBsonValue.should_not be_nil
|
735
|
+
end}
|
681
736
|
},
|
682
737
|
'transformer_ox' => {
|
683
738
|
:build => %{Moneta.build do
|
@@ -685,7 +740,12 @@ end},
|
|
685
740
|
adapter :Memory
|
686
741
|
end},
|
687
742
|
:specs => TRANSFORMER_SPECS,
|
688
|
-
:load_value => '::Ox.parse_obj(value)'
|
743
|
+
:load_value => '::Ox.parse_obj(value)',
|
744
|
+
:tests => %{
|
745
|
+
it 'compile transformer class' do
|
746
|
+
store.should_not be_nil
|
747
|
+
Moneta::Transformer::OxKeyOxValue.should_not be_nil
|
748
|
+
end}
|
689
749
|
},
|
690
750
|
'transformer_tnet' => {
|
691
751
|
:build => %{Moneta.build do
|
@@ -693,7 +753,12 @@ end},
|
|
693
753
|
adapter :Memory
|
694
754
|
end},
|
695
755
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
696
|
-
:load_value => '::TNetstring.parse(value).first'
|
756
|
+
:load_value => '::TNetstring.parse(value).first',
|
757
|
+
:tests => %{
|
758
|
+
it 'compile transformer class' do
|
759
|
+
store.should_not be_nil
|
760
|
+
Moneta::Transformer::TnetKeyTnetValue.should_not be_nil
|
761
|
+
end}
|
697
762
|
},
|
698
763
|
'transformer_msgpack' => {
|
699
764
|
:build => %{Moneta.build do
|
@@ -701,7 +766,12 @@ end},
|
|
701
766
|
adapter :Memory
|
702
767
|
end},
|
703
768
|
:specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only,
|
704
|
-
:load_value => '::MessagePack.unpack(value)'
|
769
|
+
:load_value => '::MessagePack.unpack(value)',
|
770
|
+
:tests => %{
|
771
|
+
it 'compile transformer class' do
|
772
|
+
store.should_not be_nil
|
773
|
+
Moneta::Transformer::MsgpackKeyMsgpackValue.should_not be_nil
|
774
|
+
end}
|
705
775
|
},
|
706
776
|
'transformer_marshal' => {
|
707
777
|
:build => %{Moneta.build do
|
@@ -709,7 +779,12 @@ end},
|
|
709
779
|
adapter :Memory
|
710
780
|
end},
|
711
781
|
:specs => TRANSFORMER_SPECS,
|
712
|
-
:load_value => '::Marshal.load(value)'
|
782
|
+
:load_value => '::Marshal.load(value)',
|
783
|
+
:tests => %{
|
784
|
+
it 'compile transformer class' do
|
785
|
+
store.should_not be_nil
|
786
|
+
Moneta::Transformer::MarshalKeyMarshalValue.should_not be_nil
|
787
|
+
end}
|
713
788
|
},
|
714
789
|
'transformer_key_marshal' => {
|
715
790
|
:build => %{Moneta.build do
|
@@ -717,7 +792,25 @@ end},
|
|
717
792
|
adapter :Memory
|
718
793
|
end},
|
719
794
|
:specs => TRANSFORMER_SPECS.returnsame,
|
720
|
-
:load_value => 'value'
|
795
|
+
:load_value => 'value',
|
796
|
+
:tests => %{
|
797
|
+
it 'compile transformer class' do
|
798
|
+
store.should_not be_nil
|
799
|
+
Moneta::Transformer::MarshalKey.should_not be_nil
|
800
|
+
end}
|
801
|
+
},
|
802
|
+
'transformer_key_to_s' => {
|
803
|
+
:build => %{Moneta.build do
|
804
|
+
use :Transformer, :key => :to_s
|
805
|
+
adapter :Memory
|
806
|
+
end},
|
807
|
+
:specs => TRANSFORMER_SPECS.returnsame.simplekeys_only,
|
808
|
+
:load_value => 'value',
|
809
|
+
:tests => %{
|
810
|
+
it 'compile transformer class' do
|
811
|
+
store.should_not be_nil
|
812
|
+
Moneta::Transformer::To_sKey.should_not be_nil
|
813
|
+
end}
|
721
814
|
},
|
722
815
|
'transformer_value_marshal' => {
|
723
816
|
:build => %{Moneta.build do
|
@@ -725,7 +818,12 @@ end},
|
|
725
818
|
adapter :Memory
|
726
819
|
end},
|
727
820
|
:specs => TRANSFORMER_SPECS,
|
728
|
-
:load_value => '::Marshal.load(value)'
|
821
|
+
:load_value => '::Marshal.load(value)',
|
822
|
+
:tests => %{
|
823
|
+
it 'compile transformer class' do
|
824
|
+
store.should_not be_nil
|
825
|
+
Moneta::Transformer::MarshalValue.should_not be_nil
|
826
|
+
end}
|
729
827
|
},
|
730
828
|
'transformer_yaml' => {
|
731
829
|
:build => %{Moneta.build do
|
@@ -733,7 +831,12 @@ end},
|
|
733
831
|
adapter :Memory
|
734
832
|
end},
|
735
833
|
:specs => TRANSFORMER_SPECS,
|
736
|
-
:load_value => '::YAML.load(value)'
|
834
|
+
:load_value => '::YAML.load(value)',
|
835
|
+
:tests => %{
|
836
|
+
it 'compile transformer class' do
|
837
|
+
store.should_not be_nil
|
838
|
+
Moneta::Transformer::YamlKeyYamlValue.should_not be_nil
|
839
|
+
end}
|
737
840
|
},
|
738
841
|
'transformer_key_yaml' => {
|
739
842
|
:build => %{Moneta.build do
|
@@ -741,7 +844,12 @@ end},
|
|
741
844
|
adapter :Memory
|
742
845
|
end},
|
743
846
|
:specs => TRANSFORMER_SPECS.returnsame,
|
744
|
-
:load_value => 'value'
|
847
|
+
:load_value => 'value',
|
848
|
+
:tests => %{
|
849
|
+
it 'compile transformer class' do
|
850
|
+
store.should_not be_nil
|
851
|
+
Moneta::Transformer::YamlKey.should_not be_nil
|
852
|
+
end}
|
745
853
|
},
|
746
854
|
'transformer_value_yaml' => {
|
747
855
|
:build => %{Moneta.build do
|
@@ -749,7 +857,12 @@ end},
|
|
749
857
|
adapter :Memory
|
750
858
|
end},
|
751
859
|
:specs => TRANSFORMER_SPECS,
|
752
|
-
:load_value => '::YAML.load(value)'
|
860
|
+
:load_value => '::YAML.load(value)',
|
861
|
+
:tests => %{
|
862
|
+
it 'compile transformer class' do
|
863
|
+
store.should_not be_nil
|
864
|
+
Moneta::Transformer::YamlValue.should_not be_nil
|
865
|
+
end}
|
753
866
|
},
|
754
867
|
'transformer_marshal_hmac' => {
|
755
868
|
:build => %{Moneta.build do
|
@@ -757,7 +870,12 @@ end},
|
|
757
870
|
adapter :Memory
|
758
871
|
end},
|
759
872
|
:specs => STANDARD_SPECS.without_persist,
|
760
|
-
:load_value => '::Marshal.load(::Moneta::Transformer::Helper.hmacverify(value, \'secret\'))'
|
873
|
+
:load_value => '::Marshal.load(::Moneta::Transformer::Helper.hmacverify(value, \'secret\'))',
|
874
|
+
:tests => %{
|
875
|
+
it 'compile transformer class' do
|
876
|
+
store.should_not be_nil
|
877
|
+
Moneta::Transformer::MarshalKeyMarshalHmacValue.should_not be_nil
|
878
|
+
end}
|
761
879
|
},
|
762
880
|
'transformer_marshal_base64' => {
|
763
881
|
:build => %{Moneta.build do
|
@@ -765,14 +883,24 @@ end},
|
|
765
883
|
adapter :Memory
|
766
884
|
end},
|
767
885
|
:specs => STANDARD_SPECS.without_persist,
|
768
|
-
:load_value => '::Marshal.load(value.unpack(\'m\').first)'
|
886
|
+
:load_value => '::Marshal.load(value.unpack(\'m\').first)',
|
887
|
+
:tests => %{
|
888
|
+
it 'compile transformer class' do
|
889
|
+
store.should_not be_nil
|
890
|
+
Moneta::Transformer::MarshalBase64KeyMarshalBase64Value.should_not be_nil
|
891
|
+
end}
|
769
892
|
},
|
770
893
|
'transformer_marshal_prefix' => {
|
771
894
|
:build => %{Moneta.build do
|
772
895
|
use :Transformer, :key => [:marshal, :prefix], :value => :marshal, :prefix => 'moneta'
|
773
896
|
adapter :Memory
|
774
897
|
end},
|
775
|
-
:specs => STANDARD_SPECS.without_persist
|
898
|
+
:specs => STANDARD_SPECS.without_persist,
|
899
|
+
:tests => %{
|
900
|
+
it 'compile transformer class' do
|
901
|
+
store.should_not be_nil
|
902
|
+
Moneta::Transformer::MarshalPrefixKeyMarshalValue.should_not be_nil
|
903
|
+
end}
|
776
904
|
},
|
777
905
|
'transformer_marshal_uuencode' => {
|
778
906
|
:build => %{Moneta.build do
|
@@ -780,14 +908,24 @@ end},
|
|
780
908
|
adapter :Memory
|
781
909
|
end},
|
782
910
|
:specs => STANDARD_SPECS.without_persist,
|
783
|
-
:load_value => '::Marshal.load(value.unpack(\'u\').first)'
|
911
|
+
:load_value => '::Marshal.load(value.unpack(\'u\').first)',
|
912
|
+
:tests => %{
|
913
|
+
it 'compile transformer class' do
|
914
|
+
store.should_not be_nil
|
915
|
+
Moneta::Transformer::MarshalUuencodeKeyMarshalUuencodeValue.should_not be_nil
|
916
|
+
end}
|
784
917
|
},
|
785
918
|
'transformer_marshal_escape' => {
|
786
919
|
:build => %{Moneta.build do
|
787
920
|
use :Transformer, :key => [:marshal, :escape], :value => :marshal
|
788
921
|
adapter :Memory
|
789
922
|
end},
|
790
|
-
:specs => STANDARD_SPECS.without_persist
|
923
|
+
:specs => STANDARD_SPECS.without_persist,
|
924
|
+
:tests => %{
|
925
|
+
it 'compile transformer class' do
|
926
|
+
store.should_not be_nil
|
927
|
+
Moneta::Transformer::MarshalEscapeKeyMarshalValue.should_not be_nil
|
928
|
+
end}
|
791
929
|
},
|
792
930
|
'transformer_marshal_md5' => {
|
793
931
|
:build => %{Moneta.build do
|
@@ -795,6 +933,11 @@ end},
|
|
795
933
|
adapter :Memory
|
796
934
|
end},
|
797
935
|
:specs => STANDARD_SPECS.without_persist,
|
936
|
+
:tests => %{
|
937
|
+
it 'compile transformer class' do
|
938
|
+
store.should_not be_nil
|
939
|
+
Moneta::Transformer::MarshalMd5KeyMarshalValue.should_not be_nil
|
940
|
+
end}
|
798
941
|
},
|
799
942
|
'transformer_marshal_sha1' => {
|
800
943
|
:build => %{Moneta.build do
|
@@ -802,6 +945,11 @@ end},
|
|
802
945
|
adapter :Memory
|
803
946
|
end},
|
804
947
|
:specs => STANDARD_SPECS.without_persist,
|
948
|
+
:tests => %{
|
949
|
+
it 'compile transformer class' do
|
950
|
+
store.should_not be_nil
|
951
|
+
Moneta::Transformer::MarshalSha1KeyMarshalValue.should_not be_nil
|
952
|
+
end}
|
805
953
|
},
|
806
954
|
'transformer_marshal_sha256' => {
|
807
955
|
:build => %{Moneta.build do
|
@@ -809,6 +957,11 @@ end},
|
|
809
957
|
adapter :Memory
|
810
958
|
end},
|
811
959
|
:specs => STANDARD_SPECS.without_persist,
|
960
|
+
:tests => %{
|
961
|
+
it 'compile transformer class' do
|
962
|
+
store.should_not be_nil
|
963
|
+
Moneta::Transformer::MarshalSha256KeyMarshalValue.should_not be_nil
|
964
|
+
end}
|
812
965
|
},
|
813
966
|
'transformer_marshal_sha384' => {
|
814
967
|
:build => %{Moneta.build do
|
@@ -816,6 +969,11 @@ end},
|
|
816
969
|
adapter :Memory
|
817
970
|
end},
|
818
971
|
:specs => STANDARD_SPECS.without_persist,
|
972
|
+
:tests => %{
|
973
|
+
it 'compile transformer class' do
|
974
|
+
store.should_not be_nil
|
975
|
+
Moneta::Transformer::MarshalSha384KeyMarshalValue.should_not be_nil
|
976
|
+
end}
|
819
977
|
},
|
820
978
|
'transformer_marshal_sha512' => {
|
821
979
|
:build => %{Moneta.build do
|
@@ -823,6 +981,11 @@ end},
|
|
823
981
|
adapter :Memory
|
824
982
|
end},
|
825
983
|
:specs => STANDARD_SPECS.without_persist,
|
984
|
+
:tests => %{
|
985
|
+
it 'compile transformer class' do
|
986
|
+
store.should_not be_nil
|
987
|
+
Moneta::Transformer::MarshalSha512KeyMarshalValue.should_not be_nil
|
988
|
+
end}
|
826
989
|
},
|
827
990
|
'transformer_marshal_rmd160' => {
|
828
991
|
:build => %{Moneta.build do
|
@@ -830,6 +993,11 @@ end},
|
|
830
993
|
adapter :Memory
|
831
994
|
end},
|
832
995
|
:specs => STANDARD_SPECS.without_persist,
|
996
|
+
:tests => %{
|
997
|
+
it 'compile transformer class' do
|
998
|
+
store.should_not be_nil
|
999
|
+
Moneta::Transformer::MarshalRmd160KeyMarshalValue.should_not be_nil
|
1000
|
+
end}
|
833
1001
|
},
|
834
1002
|
'transformer_marshal_md5_spread' => {
|
835
1003
|
:build => %{Moneta.build do
|
@@ -837,6 +1005,11 @@ end},
|
|
837
1005
|
adapter :Memory
|
838
1006
|
end},
|
839
1007
|
:specs => STANDARD_SPECS.without_persist,
|
1008
|
+
:tests => %{
|
1009
|
+
it 'compile transformer class' do
|
1010
|
+
store.should_not be_nil
|
1011
|
+
Moneta::Transformer::MarshalMd5SpreadKeyMarshalValue.should_not be_nil
|
1012
|
+
end}
|
840
1013
|
},
|
841
1014
|
'transformer_marshal_truncate' => {
|
842
1015
|
:build => %{Moneta.build do
|
@@ -844,6 +1017,11 @@ end},
|
|
844
1017
|
adapter :Memory
|
845
1018
|
end},
|
846
1019
|
:specs => STANDARD_SPECS.without_persist,
|
1020
|
+
:tests => %{
|
1021
|
+
it 'compile transformer class' do
|
1022
|
+
store.should_not be_nil
|
1023
|
+
Moneta::Transformer::MarshalTruncateKeyMarshalValue.should_not be_nil
|
1024
|
+
end}
|
847
1025
|
},
|
848
1026
|
'adapter_activerecord' => {
|
849
1027
|
:build => "Moneta::Adapters::ActiveRecord.new(:connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'adapter_activerecord') })",
|
@@ -932,15 +1110,15 @@ end
|
|
932
1110
|
},
|
933
1111
|
'adapter_dbm' => {
|
934
1112
|
:build => 'Moneta::Adapters::DBM.new(:file => File.join(make_tempdir, "adapter_dbm"))',
|
935
|
-
:specs => ADAPTER_SPECS
|
1113
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
936
1114
|
},
|
937
1115
|
'adapter_tdb' => {
|
938
1116
|
:build => 'Moneta::Adapters::TDB.new(:file => File.join(make_tempdir, "adapter_tdb"))',
|
939
|
-
:specs => ADAPTER_SPECS
|
1117
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
940
1118
|
},
|
941
1119
|
'adapter_daybreak' => {
|
942
1120
|
:build => 'Moneta::Adapters::Daybreak.new(:file => File.join(make_tempdir, "adapter_daybreak"))',
|
943
|
-
:specs => ADAPTER_SPECS.returnsame
|
1121
|
+
:specs => ADAPTER_SPECS.without_multiprocess.returnsame
|
944
1122
|
},
|
945
1123
|
'adapter_file' => {
|
946
1124
|
:build => 'Moneta::Adapters::File.new(:dir => File.join(make_tempdir, "adapter_file"))',
|
@@ -1046,11 +1224,11 @@ end}
|
|
1046
1224
|
},
|
1047
1225
|
'adapter_sdbm' => {
|
1048
1226
|
:build => 'Moneta::Adapters::SDBM.new(:file => File.join(make_tempdir, "adapter_sdbm"))',
|
1049
|
-
:specs => ADAPTER_SPECS
|
1227
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
1050
1228
|
},
|
1051
1229
|
'adapter_leveldb' => {
|
1052
1230
|
:build => 'Moneta::Adapters::LevelDB.new(:dir => File.join(make_tempdir, "adapter_leveldb"))',
|
1053
|
-
:specs => ADAPTER_SPECS
|
1231
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
1054
1232
|
},
|
1055
1233
|
'adapter_sequel' => {
|
1056
1234
|
:build => 'Moneta::Adapters::Sequel.new(:db => (defined?(JRUBY_VERSION) ? "jdbc:sqlite:" : "sqlite:") + File.join(make_tempdir, "adapter_sequel"))',
|
@@ -1062,11 +1240,11 @@ end}
|
|
1062
1240
|
},
|
1063
1241
|
'adapter_tokyocabinet_bdb' => {
|
1064
1242
|
:build => 'Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_bdb"), :type => :bdb)',
|
1065
|
-
:specs => ADAPTER_SPECS
|
1243
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
1066
1244
|
},
|
1067
1245
|
'adapter_tokyocabinet_hdb' => {
|
1068
1246
|
:build => 'Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_hdb"), :type => :hdb)',
|
1069
|
-
:specs => ADAPTER_SPECS
|
1247
|
+
:specs => ADAPTER_SPECS.without_multiprocess
|
1070
1248
|
},
|
1071
1249
|
'adapter_yaml' => {
|
1072
1250
|
:build => 'Moneta::Adapters::YAML.new(:file => File.join(make_tempdir, "adapter_yaml"))',
|
@@ -1336,6 +1514,13 @@ SPECS['not_persist'] = %{it 'does not persist values' do
|
|
1336
1514
|
store['key'].should be_nil
|
1337
1515
|
end}
|
1338
1516
|
|
1517
|
+
SPECS['multiprocess'] = %{it 'supports access by multiple instances/processes' do
|
1518
|
+
store['key'] = 'val'
|
1519
|
+
store2 = new_store
|
1520
|
+
store2['key'].should == 'val'
|
1521
|
+
store2.close
|
1522
|
+
end}
|
1523
|
+
|
1339
1524
|
SPECS['expires'] = %{it 'supports expires on store and #[]' do
|
1340
1525
|
store.store('key1', 'val1', :expires => 2)
|
1341
1526
|
store['key1'].should == 'val1'
|
@@ -1774,11 +1959,15 @@ TESTS.each do |name, options|
|
|
1774
1959
|
opts = options.delete(:options)
|
1775
1960
|
opts = ', ' << opts if opts
|
1776
1961
|
|
1777
|
-
build ||= "Moneta.new(#{store.inspect}#{opts}, :logger => {:out =>
|
1962
|
+
build ||= "Moneta.new(#{store.inspect}#{opts}, :logger => {:out => log})"
|
1778
1963
|
|
1779
1964
|
code = %{#{header}require 'helper'
|
1780
1965
|
|
1781
1966
|
describe_moneta #{name.inspect} do
|
1967
|
+
def log
|
1968
|
+
@log ||= File.open(File.join(make_tempdir, '#{name}.log'), 'a')
|
1969
|
+
end
|
1970
|
+
|
1782
1971
|
#{preamble}def new_store
|
1783
1972
|
#{build.gsub("\n", "\n ")}
|
1784
1973
|
end
|