drawer 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'fileutils'
2
3
 
3
4
  class DrawerStore
4
5
  def self.load(file)
data/test/drawer_test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
- require 'shoulda'
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: drawer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-05 00:00:00 -02:00
12
+ date: 2009-06-17 00:00:00 -03: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
@@ -25,7 +25,7 @@ files:
25
25
  - lib/drawer/console.rb
26
26
  - lib/drawer/irb.rb
27
27
  - lib/drawer.rb
28
- - README.rdoc
28
+ - README.markdown
29
29
  - LICENSE
30
30
  - Rakefile
31
31
  - example/db/development.yml
@@ -33,8 +33,10 @@ files:
33
33
  - example/drawer_sample_gem.rb
34
34
  - test/db/test.yml
35
35
  - test/drawer_test.rb
36
- has_rdoc: false
36
+ has_rdoc: true
37
37
  homepage: http://github.com/soveran/drawer
38
+ licenses: []
39
+
38
40
  post_install_message:
39
41
  rdoc_options: []
40
42
 
@@ -54,10 +56,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
56
  version:
55
57
  requirements: []
56
58
 
57
- rubyforge_project:
58
- rubygems_version: 1.3.1
59
+ rubyforge_project: drawer
60
+ rubygems_version: 1.3.4
59
61
  signing_key:
60
- specification_version: 2
62
+ specification_version: 3
61
63
  summary: Ultra light file-based cache.
62
64
  test_files: []
63
65
 
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.