dm-redis-adapter 0.6.4 → 0.7.0

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/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source :gemcutter
2
+
3
+ gem "dm-core", ">= 1.2.0"
4
+ gem "dm-validations", ">= 1.2.0"
5
+ gem "dm-types", ">= 1.2.0"
6
+ gem "redis", ">= 2.2"
7
+ gem "jeweler", ">= 1.4.0"
8
+ gem "rspec", "~> 1.3.0"
9
+ gem "rake", ">= 0.8.7"
10
+ gem "hiredis", "~> 0.3.0"
11
+ gem "ruby-debug19"
12
+ # gem "data_objects", ">= 0.10.1"
13
+ # gem "do_postgres", ">= 0.10.1"
data/README.textile CHANGED
@@ -18,7 +18,7 @@ h1. Changelog
18
18
  * v0.6.4 Adding the Gemfile so that rake commands work (thanks @kellydunn!)
19
19
  * v0.6.3 Fixes a problem with non-index, non-key queries (thanks @thecurator!)
20
20
  * v0.6.2 Fixes a problem with 'destroyed' objects (thanks @snovotny!)
21
- * v0.6.1 Fixes a problem with deleting an object and not having it deleted from an assosciation (thanks @sheur!)
21
+ * v0.6.1 Fixes a problem with deleting an object and not having it deleted from an assosciation (thanks @sheuer!)
22
22
  * v0.6.0 Refactor and change to the way that model names are stored in redis
23
23
  * v0.5.3 Support for inheritance via sfeu and ujifgc, this version *breaks compatibility* with previous versions of the gem
24
24
  * v0.4.0 Support for dm-core v1.1.0
@@ -110,6 +110,6 @@ h1. Badass contributors
110
110
  * <a href="http://github.com/arbarlow">Alex Barlow (arbarlow)</a> Fixes for ruby 1.9.2
111
111
  * <a href="http://github.com/jof">Jonathan Lassoff (jof)</a> Fixes to support textual keys
112
112
  * <a href="http://github.com/sfeu">Sebastian Feuerstack (sfeu)</a> Fixes to support inheritance
113
- * <a href="http://github.com/sheur">Stephen Heuer (@sheur)</a> Fixes to deleted assosciations
114
- * <a href="http://github.com/sheur">Steve Novotny (@snovotny)</a> Fixing a bug with 'destroyed' objects
115
- * <a href="http://github.com/sheur">Andrew Janssen (@thecurator)</a> Fixing a bug with non-index, non-key queries
113
+ * <a href="http://github.com/sheuer">Stephen Heuer (@sheuer)</a> Fixes to deleted assosciations
114
+ * <a href="http://github.com/snovotny">Steve Novotny (@snovotny)</a> Fixing a bug with 'destroyed' objects
115
+ * <a href="http://github.com/thecurator">Andrew Janssen (@thecurator)</a> Fixing a bug with non-index, non-key queries
@@ -297,7 +297,7 @@ module DataMapper
297
297
  # Array of id's of all members for an indexed field
298
298
  # @api private
299
299
  def find_indexed_matches(subject, value)
300
- @redis.smembers("#{subject.model.storage_name}:#{subject.name}:#{encode(value)}").map {|id| id.to_i}
300
+ @redis.smembers("#{subject.model.storage_name}:#{subject.name}:#{encode(value)}").map {|id| id =~ /^\d+$/ ? id.to_i : id}
301
301
  end
302
302
 
303
303
  ##
@@ -26,4 +26,29 @@ describe DataMapper::Adapters::RedisAdapter do
26
26
  Foo.first.hostname.should == "hostname1"
27
27
  end
28
28
  end
29
+
30
+ describe "textual keys" do
31
+ it "should find associated objects using textual key" do
32
+ class Cart
33
+ include DataMapper::Resource
34
+ property :id, String, :key => true, :unique_index => true
35
+ has n, :items
36
+ end
37
+
38
+ class Item
39
+ include DataMapper::Resource
40
+ property :id, String, :key => true, :unique_index => true
41
+ property :description, String
42
+ belongs_to :cart
43
+ end
44
+ DataMapper.finalize
45
+
46
+ cart = Cart.create(:id => "6e0fbb69-4e29-4719-a067-a850b5685317")
47
+ item = cart.items.create(:id => "246ffaed-f060-4a0c-83ef-39008899c0db", :description => "test item")
48
+
49
+ Cart.get("6e0fbb69-4e29-4719-a067-a850b5685317").items.should == [item]
50
+ end
51
+ end
52
+
53
+
29
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-redis-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
12
+ date: 2012-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dm-core
16
- requirement: &70266298866800 !ruby/object:Gem::Requirement
16
+ requirement: &70229511188280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70266298866800
24
+ version_requirements: *70229511188280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: dm-types
27
- requirement: &70266298866260 !ruby/object:Gem::Requirement
27
+ requirement: &70229511202200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70266298866260
35
+ version_requirements: *70229511202200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hiredis
38
- requirement: &70266298865700 !ruby/object:Gem::Requirement
38
+ requirement: &70229511201220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.3.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70266298865700
46
+ version_requirements: *70229511201220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: redis
49
- requirement: &70266298865020 !ruby/object:Gem::Requirement
49
+ requirement: &70229511199040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '2.2'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70266298865020
57
+ version_requirements: *70229511199040
58
58
  description: DataMapper adapter for the Redis key-value database
59
59
  email: whoahbot@gmail.com
60
60
  executables:
@@ -85,6 +85,7 @@ files:
85
85
  - spec/self_referential_spec.rb
86
86
  - spec/spec_helper.rb
87
87
  - spec/textual_keys_spec.rb
88
+ - Gemfile
88
89
  - !binary |-
89
90
  YmluL2F1dG9zcGVj
90
91
  - !binary |-
@@ -118,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  segments:
120
121
  - 0
121
- hash: 1402633761293895702
122
+ hash: 141054625361991744
122
123
  required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  none: false
124
125
  requirements: