soveran-drawer 0.0.7 → 0.0.8
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.
- data/README.markdown +36 -0
- data/lib/drawer.rb +1 -0
- data/test/drawer_test.rb +4 -4
- metadata +10 -15
- data/README.rdoc +0 -34
data/README.markdown
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Drawer
|
2
|
+
======
|
3
|
+
|
4
|
+
Ultra slim file-based cache.
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
require 'drawer'
|
10
|
+
|
11
|
+
cache = Drawer.new('db/development.drawer')
|
12
|
+
cache.get('foo') #=> nil
|
13
|
+
cache.set('foo', 123)
|
14
|
+
cache.get('foo') #=> 123
|
15
|
+
cache.flush_all
|
16
|
+
cache.get('foo') #=> nil
|
17
|
+
cache.set('bar', 456)
|
18
|
+
cache.set('baz', 789)
|
19
|
+
cache.get_multi('bar', 'baz') #=> [456, 789]
|
20
|
+
|
21
|
+
An optional second parameter is a class to be used as the persistence layer.
|
22
|
+
By default, DrawerStore is used, but it can be replaced by any class that
|
23
|
+
provides load and save methods. For example:
|
24
|
+
|
25
|
+
cache = Drawer.new(some_file, MyStoreClass)
|
26
|
+
|
27
|
+
Now, `MyStoreClass.load(some_file)` and `MyStoreClass.save(@cache, some_file)` will
|
28
|
+
be used for retrieving and saving the cached contents.
|
29
|
+
|
30
|
+
Installation
|
31
|
+
------------
|
32
|
+
|
33
|
+
$ sudo gem install drawer
|
34
|
+
|
35
|
+
Copyright (c) 2008 Michel Martens.
|
36
|
+
Released under the MIT license.
|
data/lib/drawer.rb
CHANGED
data/test/drawer_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'contest'
|
4
4
|
|
5
5
|
require File.join(File.dirname(__FILE__), '../lib/drawer')
|
6
6
|
|
@@ -27,8 +27,8 @@ class TestDrawer < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
should "successfully set a key" do
|
29
29
|
@drawer.set("foo", 123)
|
30
|
+
|
30
31
|
assert_equal 123, @drawer.get("foo")
|
31
|
-
|
32
32
|
assert_equal 124, @drawer.set("foo", 124)
|
33
33
|
end
|
34
34
|
|
@@ -67,7 +67,7 @@ class TestDrawer < Test::Unit::TestCase
|
|
67
67
|
Drawer.create(cache_file)
|
68
68
|
end
|
69
69
|
|
70
|
-
context "open" do
|
70
|
+
context "open an existent file" do
|
71
71
|
should "return an instance of Drawer" do
|
72
72
|
assert_kind_of Drawer, Drawer.open(cache_file)
|
73
73
|
end
|
@@ -88,7 +88,7 @@ class TestDrawer < Test::Unit::TestCase
|
|
88
88
|
Drawer.remove(cache_file)
|
89
89
|
end
|
90
90
|
|
91
|
-
context "open" do
|
91
|
+
context "open a not existent file" do
|
92
92
|
should "raise if the file doesn't exist" do
|
93
93
|
assert_raise Errno::ENOENT do
|
94
94
|
Drawer.open(cache_file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soveran-drawer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
@@ -9,23 +9,23 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: Ultra light file-based cache.
|
17
17
|
email: michel@soveran.com
|
18
18
|
executables:
|
19
19
|
- drawer
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
24
|
files:
|
25
25
|
- lib/drawer/console.rb
|
26
26
|
- lib/drawer/irb.rb
|
27
27
|
- lib/drawer.rb
|
28
|
-
- README.
|
28
|
+
- README.markdown
|
29
29
|
- LICENSE
|
30
30
|
- Rakefile
|
31
31
|
- example/db/development.yml
|
@@ -33,16 +33,11 @@ files:
|
|
33
33
|
- example/drawer_sample_gem.rb
|
34
34
|
- test/db/test.yml
|
35
35
|
- test/drawer_test.rb
|
36
|
-
has_rdoc:
|
36
|
+
has_rdoc: false
|
37
37
|
homepage: http://github.com/soveran/drawer
|
38
38
|
post_install_message:
|
39
|
-
rdoc_options:
|
40
|
-
|
41
|
-
- --inline-source
|
42
|
-
- --title
|
43
|
-
- drawer
|
44
|
-
- --main
|
45
|
-
- README.rdoc
|
39
|
+
rdoc_options: []
|
40
|
+
|
46
41
|
require_paths:
|
47
42
|
- lib
|
48
43
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -59,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
54
|
version:
|
60
55
|
requirements: []
|
61
56
|
|
62
|
-
rubyforge_project:
|
57
|
+
rubyforge_project: drawer
|
63
58
|
rubygems_version: 1.2.0
|
64
59
|
signing_key:
|
65
60
|
specification_version: 2
|
data/README.rdoc
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
= Drawer
|
2
|
-
|
3
|
-
Ultra slim file-based cache.
|
4
|
-
|
5
|
-
== Usage
|
6
|
-
|
7
|
-
require 'drawer'
|
8
|
-
|
9
|
-
cache = Drawer.new('db/development.drawer')
|
10
|
-
cache.get('foo') #=> nil
|
11
|
-
cache.set('foo', 123)
|
12
|
-
cache.get('foo') #=> 123
|
13
|
-
cache.flush_all
|
14
|
-
cache.get('foo') #=> nil
|
15
|
-
cache.set('bar', 456)
|
16
|
-
cache.set('baz', 789)
|
17
|
-
cache.get_multi('bar', 'baz') #=> [456, 789]
|
18
|
-
|
19
|
-
An optional second parameter is a class to be used as the persistence layer.
|
20
|
-
By default, DrawerStore is used, but it can be replaced by any class that
|
21
|
-
provides load and save methods. For example:
|
22
|
-
|
23
|
-
cache = Drawer.new(some_file, MyStoreClass)
|
24
|
-
|
25
|
-
Now, MyStoreClass.load(some_file) and MyStoreClass.save(@cache, some_file) will
|
26
|
-
be used for retrieving and saving the cached contents.
|
27
|
-
|
28
|
-
== Installation
|
29
|
-
|
30
|
-
$ gem sources -a http://gems.github.com (you only have to do this once)
|
31
|
-
$ sudo gem install soveran-drawer
|
32
|
-
|
33
|
-
Copyright (c) 2008 Michel Martens.
|
34
|
-
Released under the MIT license.
|