dm-redis-adapter 0.2.2 → 0.2.3
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/Rakefile +14 -0
- data/lib/dm-redis-adapter/adapter.rb +3 -4
- data/spec/dm_redis_validations_spec.rb +15 -1
- metadata +18 -5
data/Rakefile
CHANGED
@@ -32,6 +32,20 @@ begin
|
|
32
32
|
gemspec.files = %w(MIT-LICENSE README.textile Rakefile) + Dir.glob("{lib,spec}/**/*")
|
33
33
|
gemspec.has_rdoc = false
|
34
34
|
gemspec.extra_rdoc_files = ["MIT-LICENSE"]
|
35
|
+
gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
|
36
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
37
|
+
|
38
|
+
(!!) U P G R A D I N G (!!)
|
39
|
+
|
40
|
+
WAAAAAAAAAAAAAAAAAAAAAAAAIT!
|
41
|
+
|
42
|
+
Versions of dm-redis-adapter prior to v0.1
|
43
|
+
use a different method of storing properties
|
44
|
+
which means that this version of dm-redis-adapter
|
45
|
+
won't read them properly.
|
46
|
+
|
47
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
48
|
+
POST_INSTALL_MESSAGE
|
35
49
|
end
|
36
50
|
rescue LoadError
|
37
51
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
@@ -36,7 +36,7 @@ module DataMapper
|
|
36
36
|
# @api semipublic
|
37
37
|
def read(query)
|
38
38
|
records = records_for(query).each do |record|
|
39
|
-
record_data = @redis.hgetall(
|
39
|
+
record_data = @redis.hgetall("#{query.model.to_s.downcase}:#{record[redis_key_for(query.model)]}")
|
40
40
|
|
41
41
|
query.fields.each do |property|
|
42
42
|
next if query.model.key.include?(property)
|
@@ -51,8 +51,7 @@ module DataMapper
|
|
51
51
|
record[name] = [Integer, Date].include?(property.primitive) ? property.typecast( value ) : value
|
52
52
|
end
|
53
53
|
end
|
54
|
-
records = query.
|
55
|
-
records = query.sort_records(records)
|
54
|
+
records = query.filter_records(records)
|
56
55
|
records
|
57
56
|
end
|
58
57
|
|
@@ -154,7 +153,7 @@ module DataMapper
|
|
154
153
|
end
|
155
154
|
end
|
156
155
|
find_matches(query, o).each do |k|
|
157
|
-
keys << {"#{redis_key_for(query.model)}" => k, "#{o.subject.name}" => o.value}
|
156
|
+
keys << {"#{redis_key_for(query.model)}" => k.to_i, "#{o.subject.name}" => o.value}
|
158
157
|
end
|
159
158
|
end
|
160
159
|
|
@@ -106,7 +106,21 @@ describe DataMapper::Adapters::RedisAdapter do
|
|
106
106
|
Blackguard.first(:nickname => "James 'cannon-fingers' Doolittle").should == james
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
it "should not mark the first pirate as destroyed" do
|
110
|
+
class Blackguard
|
111
|
+
include DataMapper::Resource
|
112
|
+
|
113
|
+
property :id, Serial
|
114
|
+
property :nickname, String, :index => true
|
115
|
+
end
|
116
|
+
|
117
|
+
petey = Blackguard.create(:nickname => "Petey 'one-eye' McGraw")
|
118
|
+
james = Blackguard.create(:nickname => "James 'cannon-fingers' Doolittle")
|
119
|
+
Blackguard.get(petey.id).should_not be_destroyed
|
120
|
+
#Blackguard.first(:nickname => "James 'cannon-fingers' Doolittle").should_not be_destroyed
|
121
|
+
end
|
122
|
+
|
123
|
+
after(:each) do
|
110
124
|
redis = Redis.new(:db => 15)
|
111
125
|
redis.flushdb
|
112
126
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-redis-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dan Herrera
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-13 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -88,7 +88,20 @@ has_rdoc: true
|
|
88
88
|
homepage: http://github.com/whoahbot/dm-redis-adapter
|
89
89
|
licenses: []
|
90
90
|
|
91
|
-
post_install_message:
|
91
|
+
post_install_message: |
|
92
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
93
|
+
|
94
|
+
(!!) U P G R A D I N G (!!)
|
95
|
+
|
96
|
+
WAAAAAAAAAAAAAAAAAAAAAAAAIT!
|
97
|
+
|
98
|
+
Versions of dm-redis-adapter prior to v0.1
|
99
|
+
use a different method of storing properties
|
100
|
+
which means that this version of dm-redis-adapter
|
101
|
+
won't read them properly.
|
102
|
+
|
103
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
104
|
+
|
92
105
|
rdoc_options:
|
93
106
|
- --charset=UTF-8
|
94
107
|
require_paths:
|