ohm 2.0.0.rc2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +151 -132
- data/README.md +1 -1
- data/lib/ohm/lua/delete.lua +24 -24
- data/lib/ohm/lua/save.lua +46 -46
- data/ohm.gemspec +1 -1
- metadata +4 -5
- data/Rakefile +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6a988b7d453e4d23906662c7fd1d8d993634892
|
4
|
+
data.tar.gz: 4673e7432655aeb8b9061d184ff912cb35ac42d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b315cdda1f6011e68b2c1f194f229fc1b757d1cf8b40548df5852f8f5c96b8fe0a7dfb20c43ff8614f9bdd0905b367bab098e6ba209c389ce925859696b09dec
|
7
|
+
data.tar.gz: a64327f9085061116c85d50d63d3719d47b3521833bc72374fa3094444ca6b7d9f4ee1a747497b27b09d4c1bf02b9b6ac54075c0f5b230f3d6c6e4ae0a3cf233
|
data/CHANGELOG.md
CHANGED
@@ -1,80 +1,81 @@
|
|
1
|
+
## 2.0.0
|
2
|
+
|
1
3
|
- Lists now respond to range.
|
2
4
|
|
3
5
|
Example:
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
```ruby
|
8
|
+
class Comment < Ohm::Model
|
9
|
+
end
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
class Post < Ohm::Model
|
12
|
+
list :comments, :Comment
|
13
|
+
end
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
c1 = Comment.create
|
16
|
+
c2 = Comment.create
|
17
|
+
c3 = Comment.create
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
post = Post.create
|
20
|
+
post.comments.push(c1)
|
21
|
+
post.comments.push(c2)
|
22
|
+
post.comments.push(c3)
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
post.comments.range(0, 1) == [c1, c2]
|
25
|
+
# => true
|
26
|
+
```
|
23
27
|
|
24
|
-
- When a record is created, `#id` returns a string instead of
|
25
|
-
This ensures
|
28
|
+
- When a record is created, `#id` returns a string instead of an integer.
|
29
|
+
This ensures IDs are strings everywhere:
|
26
30
|
|
27
31
|
Example:
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
Meetup.create(name: "Ruby").id
|
32
|
-
# => 1
|
33
|
-
|
34
|
-
Meetup.find(name: "Ruby").id
|
35
|
-
# => "1"
|
33
|
+
```ruby
|
36
34
|
|
37
|
-
|
35
|
+
# Before
|
36
|
+
Meetup.create(name: "Ruby").id # => 1
|
37
|
+
Meetup.with(:name, "Ruby").id # => "1"
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
# Now
|
40
|
+
Meetup.create(name: "Ruby").id # => "1"
|
41
|
+
Meetup.with(:name, "Ruby").id # => "1"
|
42
|
+
```
|
41
43
|
|
42
|
-
|
43
|
-
# => "1"
|
44
|
-
|
45
|
-
- If an attribute is set to an empty string, Ohm won't delete the attribute.
|
44
|
+
- If an attribute is set to an empty string, Ohm won't delete it.
|
46
45
|
|
47
46
|
Example:
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
```ruby
|
49
|
+
# Before
|
50
|
+
event = Meetup.create(location: "")
|
51
|
+
Meetup[event.id].location # => nil
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
# Now
|
54
|
+
event = Meetup.create(location: "")
|
55
|
+
Meetup[event.id].location # => ""
|
56
|
+
```
|
58
57
|
|
59
58
|
- Include `Ohm::List#ids` in the public API. It returns an array with all
|
60
|
-
the ID's
|
59
|
+
the ID's in the list.
|
61
60
|
|
62
61
|
Example:
|
63
62
|
|
64
|
-
|
65
|
-
|
63
|
+
```ruby
|
64
|
+
class Comment < Ohm::Model
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
class Post < Ohm::Model
|
68
|
+
list :comments, :Comment
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
post = Post.create
|
72
|
+
post.comments.push(Comment.create)
|
73
|
+
post.comments.push(Comment.create)
|
74
|
+
post.comments.push(Comment.create)
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
post.comments.ids
|
77
|
+
# => ["1", "2", "3"]
|
78
|
+
```
|
78
79
|
|
79
80
|
- Include `Ohm::BasicSet#exists?` in the public API. This makes possible
|
80
81
|
to check if an id is included in a set. Check `Ohm::BasicSet#exists?`
|
@@ -82,123 +83,126 @@
|
|
82
83
|
|
83
84
|
Example:
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
class User < Ohm::Model
|
89
|
-
set :posts, :Post
|
90
|
-
end
|
86
|
+
```ruby
|
87
|
+
class Post < Ohm::Model
|
88
|
+
end
|
91
89
|
|
92
|
-
|
93
|
-
|
90
|
+
class User < Ohm::Model
|
91
|
+
set :posts, :Post
|
92
|
+
end
|
94
93
|
|
95
|
-
|
96
|
-
|
94
|
+
user = User.create
|
95
|
+
user.posts.add(post = Post.create)
|
97
96
|
|
97
|
+
user.posts.exists?(post.id) # => true
|
98
|
+
user.posts.exists?("nonexistent") # => false
|
99
|
+
```
|
98
100
|
|
99
101
|
- Change `Ohm::MultiSet#except` to union keys instead of intersect them
|
100
102
|
when passing an array.
|
101
103
|
|
102
104
|
Example:
|
103
105
|
|
104
|
-
|
105
|
-
|
106
|
-
|
106
|
+
```ruby
|
107
|
+
class User < Ohm::Model
|
108
|
+
attribute :name
|
109
|
+
end
|
107
110
|
|
108
|
-
|
109
|
-
|
111
|
+
john = User.create(name: "John")
|
112
|
+
jane = User.create(name: "Jane")
|
110
113
|
|
111
|
-
|
114
|
+
res = User.all.except(name: [john.name, jane.name])
|
112
115
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
# now
|
117
|
-
res.size # => 0
|
116
|
+
# Before
|
117
|
+
res.size # => 2
|
118
118
|
|
119
|
+
# Now
|
120
|
+
res.size # => 0
|
121
|
+
```
|
119
122
|
|
120
123
|
- Move ID generation to Lua. With this change, it's no longer possible
|
121
124
|
to generate custom ids. All ids are autoincremented.
|
122
125
|
|
123
|
-
|
124
126
|
- Add `Ohm::Model.track` method to allow track of custom keys. This key
|
125
127
|
is removed when the model is deleted.
|
126
128
|
|
127
129
|
Example:
|
128
130
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
foo = Foo.create
|
131
|
+
```ruby
|
132
|
+
class Foo < Ohm::Model
|
133
|
+
track :notes
|
134
|
+
end
|
134
135
|
|
135
|
-
|
136
|
-
Foo.redis.call("KEYS", "*").include?("Foo:1:notes")
|
137
|
-
# => true
|
136
|
+
foo = Foo.create
|
138
137
|
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
Foo.redis.call("SET", foo.key[:notes], "something")
|
139
|
+
Foo.redis.call("GET", "Foo:1:notes")
|
140
|
+
# => "something"
|
142
141
|
|
142
|
+
foo.delete
|
143
|
+
Foo.redis.call("GET", "Foo:1:notes")
|
144
|
+
# => nil
|
145
|
+
```
|
143
146
|
|
144
147
|
- `Ohm::Model#reference` accepts strings as model references.
|
145
148
|
|
146
149
|
Example:
|
147
150
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
+
```ruby
|
152
|
+
class Bar < Ohm::Model
|
153
|
+
reference :foo, "SomeNamespace::Foo"
|
154
|
+
end
|
151
155
|
|
152
|
-
|
156
|
+
Bar.create.foo.class # => SomeNamespace::Foo
|
157
|
+
```
|
153
158
|
|
154
|
-
|
155
|
-
- `Ohm::Model#save` sanitizes attributes before sending to Lua.
|
159
|
+
- `Ohm::Model#save` sanitizes attributes before sending them to Lua.
|
156
160
|
This complies with the original spec in Ohm v1 where a `to_s`
|
157
161
|
is done on each value.
|
158
162
|
|
159
163
|
Example:
|
160
164
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
post = Post.create(published: true)
|
166
|
-
post = Post[post.id]
|
165
|
+
```ruby
|
166
|
+
class Post < Ohm::Model
|
167
|
+
attribute :published
|
168
|
+
end
|
167
169
|
|
168
|
-
|
169
|
-
|
170
|
+
post = Post.create(published: true)
|
171
|
+
post = Post[post.id]
|
170
172
|
|
171
|
-
|
172
|
-
|
173
|
+
# Before
|
174
|
+
post.published # => "1"
|
173
175
|
|
176
|
+
# Now
|
177
|
+
post.published # => "true"
|
178
|
+
```
|
174
179
|
|
175
180
|
- `Ohm::Model#save` don't save values for attributes set to false.
|
176
181
|
|
177
182
|
Example:
|
178
183
|
|
179
|
-
|
180
|
-
|
181
|
-
|
184
|
+
```ruby
|
185
|
+
class Post < Ohm::Model
|
186
|
+
attribute :published
|
187
|
+
end
|
182
188
|
|
183
|
-
|
184
|
-
|
189
|
+
post = Post.create(published: false)
|
190
|
+
post = Post[post.id]
|
185
191
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
# now
|
190
|
-
post.published # => nil
|
192
|
+
# Before
|
193
|
+
post.published # => "0"
|
191
194
|
|
195
|
+
# Now
|
196
|
+
post.published # => nil
|
197
|
+
```
|
192
198
|
|
193
199
|
- `nest` dependency has been removed. Now, Ohm uses [nido][nido]
|
194
200
|
to generate the keys that hold the data.
|
195
201
|
|
196
|
-
|
197
202
|
- `scrivener` dependency has been removed. Ohm no longer supports model
|
198
203
|
validations and favors filter validation on the boundary layer. Check
|
199
204
|
[scrivener][scrivener] project for more information.
|
200
205
|
|
201
|
-
|
202
206
|
- `redis` dependency has been removed. Ohm 2 uses [redic][redic],
|
203
207
|
a lightweight Redis client. Redic uses the `hiredis` gem for the
|
204
208
|
connection and for parsing the replies. Now, it defaults to a
|
@@ -208,86 +212,101 @@
|
|
208
212
|
|
209
213
|
Example:
|
210
214
|
|
211
|
-
|
212
|
-
|
213
|
-
|
215
|
+
```ruby
|
216
|
+
Ohm.redis = Redic.new("redis://:<passwd>@<host>:<port>/<db>")
|
217
|
+
```
|
214
218
|
|
219
|
+
Check the Redic README for more details.
|
215
220
|
|
216
221
|
- `Ohm::Model#transaction` and `Ohm::Transaction` have been removed.
|
217
222
|
|
218
|
-
|
219
223
|
- Move `save` and `delete` operations to Lua scripts.
|
220
224
|
|
221
|
-
|
222
|
-
- Support for Ruby 1.8 and 1.9 has been removed.
|
225
|
+
- Support for Ruby 1.8 has been removed.
|
223
226
|
|
224
227
|
[nido]: https://github.com/soveran/nido
|
225
228
|
[scrivener]: https://github.com/soveran/scrivener
|
226
229
|
[redic]: https://github.com/amakawa/redic
|
227
230
|
|
228
|
-
1.3.2
|
229
|
-
-----
|
231
|
+
## 1.3.2
|
230
232
|
|
231
233
|
- Fetching a batch of objects is now done in batches of 1000 objects at
|
232
234
|
a time. If you are iterating over large collections, this change should
|
233
235
|
provide a significant performance boost both in used memory and total
|
234
236
|
execution time.
|
235
|
-
- MutableSet#<< is now an alias for #add.
|
236
237
|
|
237
|
-
|
238
|
-
-----
|
238
|
+
- `MutableSet#<<` is now an alias for `#add`.
|
239
239
|
|
240
|
-
|
240
|
+
## 1.3.1
|
241
241
|
|
242
|
+
- Improve memory consumption when indexing persisted attributes.
|
242
243
|
No migration is needed and old indices will be cleaned up as you save
|
243
244
|
instances.
|
244
245
|
|
245
|
-
1.3.0
|
246
|
-
-----
|
246
|
+
## 1.3.0
|
247
247
|
|
248
248
|
- Add Model.attributes.
|
249
249
|
|
250
|
-
1.2.0
|
251
|
-
-----
|
250
|
+
## 1.2.0
|
252
251
|
|
253
252
|
- Enumerable fix.
|
253
|
+
|
254
254
|
- Merge Ohm::PipelinedFetch into Ohm::Collection.
|
255
|
+
|
255
256
|
- Fix Set, MultiSet, and List enumerable behavior.
|
257
|
+
|
256
258
|
- Change dependencies to use latest cutest.
|
257
259
|
|
258
|
-
1.1.0
|
259
|
-
-----
|
260
|
+
## 1.1.0
|
260
261
|
|
261
262
|
- Compatible with redis-rb 3.
|
262
263
|
|
263
|
-
1.0.0
|
264
|
-
-----
|
264
|
+
## 1.0.0
|
265
265
|
|
266
266
|
- Fetching a batch of objects is now done through one pipeline, effectively
|
267
267
|
reducing the IO to just 2 operations (one for SMEMBERS / LRANGE, one for
|
268
268
|
the actual HGET of all the individual HASHes.)
|
269
|
+
|
269
270
|
- write_remote / read_remote have been replaced with set / get respectively.
|
271
|
+
|
270
272
|
- Ohm::Model.unique has been added.
|
273
|
+
|
271
274
|
- Ohm::Model::Set has been renamed to Ohm::Set
|
275
|
+
|
272
276
|
- Ohm::Model::List has been renamed to Ohm::List
|
277
|
+
|
273
278
|
- Ohm::Model::Collection is gone.
|
279
|
+
|
274
280
|
- Ohm::Validations is gone. Ohm now uses Scrivener::Validations.
|
281
|
+
|
275
282
|
- Ohm::Key is gone. Ohm now uses Nest directly.
|
283
|
+
|
276
284
|
- No more concept of volatile keys.
|
285
|
+
|
277
286
|
- Ohm::Model::Wrapper is gone.
|
287
|
+
|
278
288
|
- Use Symbols for constants instead of relying on Ohm::Model.const_missing.
|
279
|
-
|
289
|
+
|
290
|
+
- `#sort` / `#sort_by` now uses `limit` as it's used in redis-rb, e.g. you
|
280
291
|
have to pass in an array like so: sort(limit: [0, 1]).
|
292
|
+
|
281
293
|
- Set / List have been trimmed to contain only the minimum number
|
282
294
|
of necessary methods.
|
295
|
+
|
283
296
|
- You can no longer mutate a collection / set as before, e.g. doing
|
284
297
|
User.find(...).add(User[1]) will throw an error.
|
298
|
+
|
285
299
|
- The #union operation has been added. You can now chain it with your filters.
|
300
|
+
|
286
301
|
- Temporary keys when doing finds are now automatically cleaned up.
|
302
|
+
|
287
303
|
- Counters are now stored in their own key instead, i.e. in
|
288
304
|
User:<id>:counters.
|
305
|
+
|
289
306
|
- JSON support has to be explicitly required by doing `require
|
290
307
|
"ohm/json"`.
|
308
|
+
|
291
309
|
- All save / delete / update operations are now done using
|
292
310
|
transactions (see http://redis.io/topics/transactions).
|
311
|
+
|
293
312
|
- All indices are now stored without converting the values to base64.
|
data/README.md
CHANGED
data/lib/ohm/lua/delete.lua
CHANGED
@@ -24,44 +24,44 @@ local uniques = cmsgpack.unpack(ARGV[2])
|
|
24
24
|
local tracked = cmsgpack.unpack(ARGV[3])
|
25
25
|
|
26
26
|
local function remove_indices(model)
|
27
|
-
|
28
|
-
|
27
|
+
local memo = model.key .. ":_indices"
|
28
|
+
local existing = redis.call("SMEMBERS", memo)
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
for _, key in ipairs(existing) do
|
31
|
+
redis.call("SREM", key, model.id)
|
32
|
+
redis.call("SREM", memo, key)
|
33
|
+
end
|
34
34
|
end
|
35
35
|
|
36
36
|
local function remove_uniques(model, uniques)
|
37
|
-
|
37
|
+
local memo = model.key .. ":_uniques"
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
for field, _ in pairs(uniques) do
|
40
|
+
local key = model.name .. ":uniques:" .. field
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
redis.call("HDEL", key, redis.call("HGET", memo, key))
|
43
|
+
redis.call("HDEL", memo, key)
|
44
|
+
end
|
45
45
|
end
|
46
46
|
|
47
47
|
local function remove_tracked(model, tracked)
|
48
|
-
|
49
|
-
|
48
|
+
for _, tracked_key in ipairs(tracked) do
|
49
|
+
local key = model.key .. ":" .. tracked_key
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
redis.call("DEL", key)
|
52
|
+
end
|
53
53
|
end
|
54
54
|
|
55
55
|
local function delete(model)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
local keys = {
|
57
|
+
model.key .. ":counters",
|
58
|
+
model.key .. ":_indices",
|
59
|
+
model.key .. ":_uniques",
|
60
|
+
model.key
|
61
|
+
}
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
redis.call("SREM", model.name .. ":all", model.id)
|
64
|
+
redis.call("DEL", unpack(keys))
|
65
65
|
end
|
66
66
|
|
67
67
|
remove_indices(model)
|
data/lib/ohm/lua/save.lua
CHANGED
@@ -36,82 +36,82 @@ local indices = cmsgpack.unpack(ARGV[3])
|
|
36
36
|
local uniques = cmsgpack.unpack(ARGV[4])
|
37
37
|
|
38
38
|
local function save(model, attrs)
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
if model.id == nil then
|
40
|
+
model.id = redis.call("INCR", model.name .. ":id")
|
41
|
+
end
|
42
42
|
|
43
|
-
|
43
|
+
model.key = model.name .. ":" .. model.id
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
redis.call("SADD", model.name .. ":all", model.id)
|
46
|
+
redis.call("DEL", model.key)
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
if math.mod(#attrs, 2) == 1 then
|
49
|
+
error("Wrong number of attribute/value pairs")
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
if #attrs > 0 then
|
53
|
+
redis.call("HMSET", model.key, unpack(attrs))
|
54
|
+
end
|
55
55
|
end
|
56
56
|
|
57
57
|
local function index(model, indices)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
for field, enum in pairs(indices) do
|
59
|
+
for _, val in ipairs(enum) do
|
60
|
+
local key = model.name .. ":indices:" .. field .. ":" .. tostring(val)
|
61
|
+
|
62
|
+
redis.call("SADD", model.key .. ":_indices", key)
|
63
|
+
redis.call("SADD", key, model.id)
|
64
|
+
end
|
65
|
+
end
|
66
66
|
end
|
67
67
|
|
68
68
|
local function remove_indices(model)
|
69
|
-
|
70
|
-
|
69
|
+
local memo = model.key .. ":_indices"
|
70
|
+
local existing = redis.call("SMEMBERS", memo)
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
for _, key in ipairs(existing) do
|
73
|
+
redis.call("SREM", key, model.id)
|
74
|
+
redis.call("SREM", memo, key)
|
75
|
+
end
|
76
76
|
end
|
77
77
|
|
78
78
|
local function unique(model, uniques)
|
79
|
-
|
80
|
-
|
79
|
+
for field, value in pairs(uniques) do
|
80
|
+
local key = model.name .. ":uniques:" .. field
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
redis.call("HSET", model.key .. ":_uniques", key, value)
|
83
|
+
redis.call("HSET", key, value, model.id)
|
84
|
+
end
|
85
85
|
end
|
86
86
|
|
87
87
|
local function remove_uniques(model)
|
88
|
-
|
88
|
+
local memo = model.key .. ":_uniques"
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
for _, key in pairs(redis.call("HKEYS", memo)) do
|
91
|
+
redis.call("HDEL", key, redis.call("HGET", memo, key))
|
92
|
+
redis.call("HDEL", memo, key)
|
93
|
+
end
|
94
94
|
end
|
95
95
|
|
96
96
|
local function verify(model, uniques)
|
97
|
-
|
97
|
+
local duplicates = {}
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
for field, value in pairs(uniques) do
|
100
|
+
local key = model.name .. ":uniques:" .. field
|
101
|
+
local id = redis.call("HGET", key, tostring(value))
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
if id and id ~= tostring(model.id) then
|
104
|
+
duplicates[#duplicates + 1] = field
|
105
|
+
end
|
106
|
+
end
|
107
107
|
|
108
|
-
|
108
|
+
return duplicates, #duplicates ~= 0
|
109
109
|
end
|
110
110
|
|
111
111
|
local duplicates, err = verify(model, uniques)
|
112
112
|
|
113
113
|
if err then
|
114
|
-
|
114
|
+
error("UniqueIndexViolation: " .. duplicates[1])
|
115
115
|
end
|
116
116
|
|
117
117
|
save(model, attrs)
|
data/ohm.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ohm"
|
3
|
-
s.version = "2.0.0
|
3
|
+
s.version = "2.0.0"
|
4
4
|
s.summary = %{Object-hash mapping library for Redis.}
|
5
5
|
s.description = %Q{Ohm is a library that allows to store an object in Redis, a persistent key-value database. It has very good performance.}
|
6
6
|
s.authors = ["Michel Martens", "Damian Janowski", "Cyril David"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: redic
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- CHANGELOG.md
|
84
84
|
- LICENSE
|
85
85
|
- README.md
|
86
|
-
- Rakefile
|
87
86
|
- benchmarks/common.rb
|
88
87
|
- benchmarks/create.rb
|
89
88
|
- benchmarks/delete.rb
|
@@ -136,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
135
|
version: '0'
|
137
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
137
|
requirements:
|
139
|
-
- - '
|
138
|
+
- - '>='
|
140
139
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
140
|
+
version: '0'
|
142
141
|
requirements: []
|
143
142
|
rubyforge_project: ohm
|
144
143
|
rubygems_version: 2.0.3
|
data/Rakefile
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
REDIS_DIR = File.expand_path(File.join("..", "test"), __FILE__)
|
2
|
-
REDIS_CNF = File.join(REDIS_DIR, "test.conf")
|
3
|
-
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
|
4
|
-
|
5
|
-
task :default => :run
|
6
|
-
|
7
|
-
desc "Run tests and manage server start/stop"
|
8
|
-
task :run => [:start, :test, :stop]
|
9
|
-
|
10
|
-
desc "Start the Redis server"
|
11
|
-
task :start do
|
12
|
-
unless File.exists?(REDIS_PID)
|
13
|
-
system "redis-server #{REDIS_CNF}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Stop the Redis server"
|
18
|
-
task :stop do
|
19
|
-
if File.exists?(REDIS_PID)
|
20
|
-
system "kill #{File.read(REDIS_PID)}"
|
21
|
-
File.delete(REDIS_PID)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
task :test do
|
26
|
-
require File.expand_path("./test/helper", File.dirname(__FILE__))
|
27
|
-
|
28
|
-
Cutest.run(Dir["test/*.rb"])
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "Generate documentation"
|
32
|
-
task :doc => :yard
|
33
|
-
|
34
|
-
desc "Generated YARD documentation"
|
35
|
-
task :yard do
|
36
|
-
require "yard"
|
37
|
-
|
38
|
-
opts = []
|
39
|
-
opts.push("--protected")
|
40
|
-
opts.push("--no-private")
|
41
|
-
opts.push("--private")
|
42
|
-
opts.push("--title", "Ohm — Object-hash mapping library for Redis")
|
43
|
-
|
44
|
-
YARD::CLI::Yardoc.run(*opts)
|
45
|
-
|
46
|
-
Dir["doc/**/*.html"].each do |file|
|
47
|
-
contents = File.read(file)
|
48
|
-
|
49
|
-
contents.sub! %r{</body>}, <<-EOS
|
50
|
-
<script type="text/javascript">
|
51
|
-
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
52
|
-
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
53
|
-
</script>
|
54
|
-
<script type="text/javascript">
|
55
|
-
try {
|
56
|
-
var pageTracker = _gat._getTracker("UA-11356145-1");
|
57
|
-
pageTracker._trackPageview();
|
58
|
-
} catch(err) {}</script>
|
59
|
-
</body>
|
60
|
-
EOS
|
61
|
-
|
62
|
-
File.open(file, "w") { |f| f.write(contents) }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "Deploy documentation"
|
67
|
-
task :deploy do
|
68
|
-
system "rsync --del -avz doc/* ohm.keyvalue.org:deploys/ohm.keyvalue.org/"
|
69
|
-
end
|