rufus-cloche 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,6 +1,9 @@
1
1
 
2
2
  = rufus-cloche CHANGELOG.txt
3
3
 
4
+ == rufus-cloche - 0.1.2 released 2009/12/09
5
+
6
+ - avoiding dir beginning with a '.' (dot)
4
7
 
5
8
  == rufus-cloche - 0.1.1 released 2009/11/16
6
9
 
data/TODO.txt CHANGED
@@ -10,3 +10,5 @@
10
10
 
11
11
  [ ] need for a purge mecha
12
12
 
13
+ [ ] work/msgs/.0/8811-2151883888-1260352977.0.json issue...
14
+
data/lib/rufus/cloche.rb CHANGED
@@ -57,7 +57,7 @@ module Rufus
57
57
  end
58
58
  end
59
59
 
60
- VERSION = '0.1.1'
60
+ VERSION = '0.1.2'
61
61
 
62
62
  attr_reader :dir
63
63
 
@@ -100,15 +100,15 @@ module Rufus
100
100
  FileUtils.mkdir_p(d) unless File.exist?(d)
101
101
  FileUtils.touch(fn) unless File.exist?(fn)
102
102
 
103
- lock(fn) do |f|
103
+ lock(fn) do |file|
104
104
 
105
- cur = do_get(f)
105
+ cur = do_get(file)
106
106
 
107
107
  return cur if cur && cur['_rev'] != doc['_rev']
108
108
 
109
109
  doc['_rev'] = doc['_rev'] + 1
110
110
 
111
- File.open(f, 'wb') { |io| io.write(Cloche.json_encode(doc)) }
111
+ File.open(file, 'wb') { |io| io.write(Cloche.json_encode(doc)) }
112
112
  end
113
113
 
114
114
  nil
@@ -204,10 +204,9 @@ module Rufus
204
204
 
205
205
  nkey = Cloche.neutralize(key)
206
206
 
207
- [
208
- File.join(dir_for(type), nkey[-2, 2] || nkey),
209
- "#{nkey}.json"
210
- ]
207
+ subdir = (nkey[-2, 2] || nkey).gsub(/\./, 'Z')
208
+
209
+ [ File.join(dir_for(type), subdir), "#{nkey}.json" ]
211
210
  end
212
211
 
213
212
  def file_for (type_or_doc, key)
data/test/test.rb CHANGED
@@ -141,6 +141,15 @@ class ClocheTest < Test::Unit::TestCase
141
141
  @c.get_many('person').collect { |e| e['_id'] })
142
142
  end
143
143
 
144
+ def test_dot_id
145
+
146
+ @c.put({ '_id' => 'something.0', 'type' => 'nothing', 'color' => 'blue' })
147
+
148
+ #puts `tree -a tcloche`
149
+
150
+ assert_equal 1, @c.get_many('nothing').size
151
+ end
152
+
144
153
  protected
145
154
 
146
155
  def fetch (type, key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-cloche
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-16 00:00:00 +09:00
12
+ date: 2009-12-09 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -34,7 +34,7 @@ files:
34
34
  - LICENSE.txt
35
35
  - TODO.txt
36
36
  - README.rdoc
37
- has_rdoc: true
37
+ has_rdoc: false
38
38
  homepage: http://github.com/jmettraux/rufus-cloche/
39
39
  licenses: []
40
40