toystore-mongo 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile +1 -1
- data/lib/toy/mongo.rb +2 -3
- data/lib/toy/mongo/querying.rb +0 -16
- data/lib/toy/mongo/version.rb +1 -1
- data/spec/toy/mongo/querying_spec.rb +0 -18
- data/toystore-mongo.gemspec +1 -1
- metadata +62 -72
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,9 +4,9 @@ gemspec
|
|
4
4
|
gem 'rake', '~> 0.9.0'
|
5
5
|
|
6
6
|
# keep mongo and bson ext at same version
|
7
|
-
gem 'adapter-mongo', '~> 0.5.5'
|
8
7
|
gem 'mongo', '~> 1.6.0'
|
9
8
|
gem 'bson_ext', '~> 1.6.0', :require => false
|
9
|
+
gem 'adapter-mongo', :path => '/Users/jnunemaker/projects/adapter-mongo'
|
10
10
|
|
11
11
|
group(:guard) do
|
12
12
|
gem 'guard', '~> 1.0.0'
|
data/lib/toy/mongo.rb
CHANGED
@@ -9,13 +9,12 @@ require 'adapter/mongo'
|
|
9
9
|
module Toy
|
10
10
|
module Mongo
|
11
11
|
extend ActiveSupport::Concern
|
12
|
+
include Toy::Store
|
13
|
+
include Querying
|
12
14
|
|
13
15
|
class Error < StandardError; end
|
14
16
|
|
15
17
|
included do
|
16
|
-
include Toy::Store
|
17
|
-
include Querying
|
18
|
-
|
19
18
|
key Toy::Identity::ObjectIdKeyFactory.new
|
20
19
|
end
|
21
20
|
end
|
data/lib/toy/mongo/querying.rb
CHANGED
@@ -25,22 +25,6 @@ module Toy
|
|
25
25
|
super Plucky.to_object_id(id)
|
26
26
|
end
|
27
27
|
|
28
|
-
# Mongo does not guarantee sort order when using $in.
|
29
|
-
# So we manually sort in ruby for now. Not stoked about
|
30
|
-
# this, but it gets the job done.
|
31
|
-
def get_multi(*ids)
|
32
|
-
ids = ids.flatten
|
33
|
-
all(:_id => {'$in' => ids}).sort do |a, b|
|
34
|
-
index_a = ids.index(a.id)
|
35
|
-
index_b = ids.index(b.id)
|
36
|
-
if index_a.nil? || index_b.nil?
|
37
|
-
1
|
38
|
-
else
|
39
|
-
index_a <=> index_b
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
28
|
def query
|
45
29
|
Plucky::Query.new(adapter.client, :transformer => transformer).object_ids(object_id_attributes)
|
46
30
|
end
|
data/lib/toy/mongo/version.rb
CHANGED
@@ -40,22 +40,4 @@ describe Toy::Mongo::Querying do
|
|
40
40
|
User.get('1234').should be_nil
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
describe "#get_multi" do
|
45
|
-
before(:each) do
|
46
|
-
@user1 = User.create
|
47
|
-
@user2 = User.create
|
48
|
-
@users = User.get_multi(@user2.id, @user1.id)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "returns multiple documents in correct order" do
|
52
|
-
@users.should == [@user2, @user1]
|
53
|
-
end
|
54
|
-
|
55
|
-
it "performs one query" do
|
56
|
-
User.should_not_receive(:get)
|
57
|
-
User.should_receive(:all).once.and_return([])
|
58
|
-
User.get_multi(@user1.id, @user2.id)
|
59
|
-
end
|
60
|
-
end
|
61
43
|
end
|
data/toystore-mongo.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency 'plucky', '~> 0.5'
|
16
16
|
s.add_dependency 'toystore', '~> 0.10'
|
17
|
-
s.add_dependency 'adapter-mongo', '~> 0.
|
17
|
+
s.add_dependency 'adapter-mongo', '~> 0.7.0'
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n") - ['specs.watchr']
|
20
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,78 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: toystore-mongo
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 11
|
9
|
-
- 0
|
10
|
-
version: 0.11.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- John Nunemaker
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: plucky
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 5
|
32
|
-
version: "0.5"
|
33
|
-
version_requirements: *id001
|
34
|
-
name: plucky
|
35
|
-
- !ruby/object:Gem::Dependency
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.5'
|
36
22
|
type: :runtime
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
26
|
+
requirements:
|
41
27
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 0
|
46
|
-
- 10
|
47
|
-
version: "0.10"
|
48
|
-
version_requirements: *id002
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.5'
|
30
|
+
- !ruby/object:Gem::Dependency
|
49
31
|
name: toystore
|
50
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.10'
|
51
38
|
type: :runtime
|
52
39
|
prerelease: false
|
53
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
41
|
none: false
|
55
|
-
requirements:
|
42
|
+
requirements:
|
56
43
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
- 0
|
61
|
-
- 5
|
62
|
-
- 5
|
63
|
-
version: 0.5.5
|
64
|
-
version_requirements: *id003
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.10'
|
46
|
+
- !ruby/object:Gem::Dependency
|
65
47
|
name: adapter-mongo
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.7.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.0
|
66
62
|
description: Mongo integration for Toystore
|
67
|
-
email:
|
63
|
+
email:
|
68
64
|
- nunemaker@gmail.com
|
69
65
|
executables: []
|
70
|
-
|
71
66
|
extensions: []
|
72
|
-
|
73
67
|
extra_rdoc_files: []
|
74
|
-
|
75
|
-
files:
|
68
|
+
files:
|
76
69
|
- .gitignore
|
77
70
|
- .travis.yml
|
78
71
|
- Gemfile
|
@@ -98,40 +91,37 @@ files:
|
|
98
91
|
- spec/toy/mongo/querying_spec.rb
|
99
92
|
- spec/toy/mongo_spec.rb
|
100
93
|
- toystore-mongo.gemspec
|
101
|
-
homepage:
|
94
|
+
homepage: ''
|
102
95
|
licenses: []
|
103
|
-
|
104
96
|
post_install_message:
|
105
97
|
rdoc_options: []
|
106
|
-
|
107
|
-
require_paths:
|
98
|
+
require_paths:
|
108
99
|
- lib
|
109
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
101
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
segments:
|
116
107
|
- 0
|
117
|
-
|
118
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
hash: 3552750684028256836
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
110
|
none: false
|
120
|
-
requirements:
|
121
|
-
- -
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
|
124
|
-
segments:
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
segments:
|
125
116
|
- 0
|
126
|
-
|
117
|
+
hash: 3552750684028256836
|
127
118
|
requirements: []
|
128
|
-
|
129
119
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.8.
|
120
|
+
rubygems_version: 1.8.23
|
131
121
|
signing_key:
|
132
122
|
specification_version: 3
|
133
123
|
summary: Mongo integration for Toystore
|
134
|
-
test_files:
|
124
|
+
test_files:
|
135
125
|
- spec/helper.rb
|
136
126
|
- spec/spec.opts
|
137
127
|
- spec/support/callbacks_helper.rb
|