jnunemaker-mongomapper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History +4 -0
- data/Rakefile +3 -4
- data/VERSION +1 -1
- data/lib/mongomapper/document.rb +0 -6
- data/lib/mongomapper/embedded_document.rb +2 -3
- data/lib/mongomapper.rb +2 -2
- data/mongomapper.gemspec +91 -0
- data/test/test_document.rb +8 -8
- data/test/test_helper.rb +1 -3
- data/test/{test_mongo_mapper.rb → test_mongomapper.rb} +0 -0
- metadata +11 -20
data/History
CHANGED
data/Rakefile
CHANGED
@@ -12,12 +12,11 @@ begin
|
|
12
12
|
gem.rubyforge_project = "mongomapper"
|
13
13
|
|
14
14
|
gem.add_dependency('activesupport')
|
15
|
-
gem.add_dependency('mongodb-mongo')
|
16
|
-
gem.add_dependency('jnunemaker-validatable')
|
15
|
+
gem.add_dependency('mongodb-mongo', '0.9')
|
16
|
+
gem.add_dependency('jnunemaker-validatable', '1.7.0')
|
17
17
|
|
18
|
-
gem.add_development_dependency('mocha')
|
18
|
+
gem.add_development_dependency('mocha', '0.9.4')
|
19
19
|
gem.add_development_dependency('jnunemaker-matchy', '0.4.0')
|
20
|
-
gem.add_development_dependency('thoughtbot-quietbacktrace')
|
21
20
|
end
|
22
21
|
|
23
22
|
Jeweler::RubyforgeTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/mongomapper/document.rb
CHANGED
@@ -47,12 +47,6 @@ module MongoMapper
|
|
47
47
|
# TODO: remove the rescuing when ruby driver works correctly
|
48
48
|
def count(conditions={})
|
49
49
|
collection.count(conditions)
|
50
|
-
rescue => exception
|
51
|
-
if exception.message =~ /Error with count command/
|
52
|
-
0
|
53
|
-
else
|
54
|
-
raise exception
|
55
|
-
end
|
56
50
|
end
|
57
51
|
|
58
52
|
def create(*docs)
|
@@ -64,12 +64,11 @@ module MongoMapper
|
|
64
64
|
key
|
65
65
|
end
|
66
66
|
|
67
|
-
# TODO: remove to_s when ruby driver supports symbols (I sent patch)
|
68
67
|
def ensure_index(name_or_array, options={})
|
69
68
|
keys_to_index = if name_or_array.is_a?(Array)
|
70
|
-
name_or_array.map { |pair| [pair[0]
|
69
|
+
name_or_array.map { |pair| [pair[0], pair[1]] }
|
71
70
|
else
|
72
|
-
name_or_array
|
71
|
+
name_or_array
|
73
72
|
end
|
74
73
|
|
75
74
|
collection.create_index(keys_to_index, options.delete(:unique))
|
data/lib/mongomapper.rb
CHANGED
data/mongomapper.gemspec
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{mongomapper}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["John Nunemaker"]
|
9
|
+
s.date = %q{2009-06-28}
|
10
|
+
s.email = %q{nunemaker@gmail.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".gitignore",
|
17
|
+
"History",
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/mongomapper.rb",
|
23
|
+
"lib/mongomapper/document.rb",
|
24
|
+
"lib/mongomapper/embedded_document.rb",
|
25
|
+
"lib/mongomapper/finder_options.rb",
|
26
|
+
"lib/mongomapper/key.rb",
|
27
|
+
"lib/mongomapper/rails_compatibility.rb",
|
28
|
+
"lib/mongomapper/save_with_validation.rb",
|
29
|
+
"lib/mongomapper/serialization.rb",
|
30
|
+
"lib/mongomapper/serializers/json_serializer.rb",
|
31
|
+
"mongomapper.gemspec",
|
32
|
+
"test/serializers/test_json_serializer.rb",
|
33
|
+
"test/test_associations.rb",
|
34
|
+
"test/test_callbacks.rb",
|
35
|
+
"test/test_document.rb",
|
36
|
+
"test/test_embedded_document.rb",
|
37
|
+
"test/test_finder_options.rb",
|
38
|
+
"test/test_helper.rb",
|
39
|
+
"test/test_key.rb",
|
40
|
+
"test/test_mongomapper.rb",
|
41
|
+
"test/test_rails_compatibility.rb",
|
42
|
+
"test/test_serializations.rb",
|
43
|
+
"test/test_validations.rb"
|
44
|
+
]
|
45
|
+
s.has_rdoc = true
|
46
|
+
s.homepage = %q{http://github.com/jnunemaker/mongomapper}
|
47
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
48
|
+
s.require_paths = ["lib"]
|
49
|
+
s.rubyforge_project = %q{mongomapper}
|
50
|
+
s.rubygems_version = %q{1.3.1}
|
51
|
+
s.summary = %q{Awesome gem for modeling your domain and storing it in mongo}
|
52
|
+
s.test_files = [
|
53
|
+
"test/serializers/test_json_serializer.rb",
|
54
|
+
"test/test_associations.rb",
|
55
|
+
"test/test_callbacks.rb",
|
56
|
+
"test/test_document.rb",
|
57
|
+
"test/test_embedded_document.rb",
|
58
|
+
"test/test_finder_options.rb",
|
59
|
+
"test/test_helper.rb",
|
60
|
+
"test/test_key.rb",
|
61
|
+
"test/test_mongomapper.rb",
|
62
|
+
"test/test_rails_compatibility.rb",
|
63
|
+
"test/test_serializations.rb",
|
64
|
+
"test/test_validations.rb"
|
65
|
+
]
|
66
|
+
|
67
|
+
if s.respond_to? :specification_version then
|
68
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
|
+
s.specification_version = 2
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
72
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
73
|
+
s.add_runtime_dependency(%q<mongodb-mongo>, ["= 0.9"])
|
74
|
+
s.add_runtime_dependency(%q<jnunemaker-validatable>, ["= 1.7.0"])
|
75
|
+
s.add_development_dependency(%q<mocha>, ["= 0.9.4"])
|
76
|
+
s.add_development_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
77
|
+
else
|
78
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
79
|
+
s.add_dependency(%q<mongodb-mongo>, ["= 0.9"])
|
80
|
+
s.add_dependency(%q<jnunemaker-validatable>, ["= 1.7.0"])
|
81
|
+
s.add_dependency(%q<mocha>, ["= 0.9.4"])
|
82
|
+
s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
83
|
+
end
|
84
|
+
else
|
85
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
86
|
+
s.add_dependency(%q<mongodb-mongo>, ["= 0.9"])
|
87
|
+
s.add_dependency(%q<jnunemaker-validatable>, ["= 1.7.0"])
|
88
|
+
s.add_dependency(%q<mocha>, ["= 0.9.4"])
|
89
|
+
s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
90
|
+
end
|
91
|
+
end
|
data/test/test_document.rb
CHANGED
@@ -478,13 +478,13 @@ class DocumentTest < Test::Unit::TestCase
|
|
478
478
|
@document.ensure_index :fname
|
479
479
|
}.should change { @document.collection.index_information.size }.by(1)
|
480
480
|
|
481
|
-
index = @document.collection.index_information
|
481
|
+
index = @document.collection.index_information['fname_1']
|
482
482
|
index.should_not be_nil
|
483
|
-
index
|
483
|
+
index.should include(['fname', 1])
|
484
484
|
end
|
485
485
|
|
486
486
|
should "allow creating unique index for a key" do
|
487
|
-
@document.collection.expects(:create_index).with(
|
487
|
+
@document.collection.expects(:create_index).with(:fname, true)
|
488
488
|
@document.ensure_index :fname, :unique => true
|
489
489
|
end
|
490
490
|
|
@@ -493,9 +493,10 @@ class DocumentTest < Test::Unit::TestCase
|
|
493
493
|
@document.ensure_index [[:fname, 1], [:lname, -1]]
|
494
494
|
}.should change { @document.collection.index_information.size }.by(1)
|
495
495
|
|
496
|
-
index = @document.collection.index_information
|
496
|
+
index = @document.collection.index_information['lname_-1_fname_1']
|
497
497
|
index.should_not be_nil
|
498
|
-
index
|
498
|
+
index.should include(['fname', 1])
|
499
|
+
index.should include(['lname', -1])
|
499
500
|
end
|
500
501
|
|
501
502
|
should "work with :index shortcut when defining key" do
|
@@ -503,12 +504,11 @@ class DocumentTest < Test::Unit::TestCase
|
|
503
504
|
@document.key :father, String, :index => true
|
504
505
|
}.should change { @document.collection.index_information.size }.by(1)
|
505
506
|
|
506
|
-
index = @document.collection.index_information
|
507
|
+
index = @document.collection.index_information['father_1']
|
507
508
|
index.should_not be_nil
|
508
|
-
index
|
509
|
+
index.should include(['father', 1])
|
509
510
|
end
|
510
511
|
end
|
511
|
-
|
512
512
|
end # Database operations
|
513
513
|
|
514
514
|
context "An instance of a document" do
|
data/test/test_helper.rb
CHANGED
@@ -3,13 +3,11 @@ require 'rubygems'
|
|
3
3
|
require 'test/unit'
|
4
4
|
require 'shoulda'
|
5
5
|
|
6
|
+
gem 'mocha', '0.9.4'
|
6
7
|
gem 'jnunemaker-matchy', '0.4.0'
|
7
|
-
gem 'mocha'
|
8
|
-
gem 'thoughtbot-quietbacktrace'
|
9
8
|
|
10
9
|
require 'matchy'
|
11
10
|
require 'mocha'
|
12
|
-
require 'quietbacktrace'
|
13
11
|
|
14
12
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
13
|
dir = (Pathname(__FILE__).dirname + '..' + 'lib').expand_path
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jnunemaker-mongomapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -28,9 +28,9 @@ dependencies:
|
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: "0"
|
33
|
+
version: "0.9"
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: jnunemaker-validatable
|
@@ -38,9 +38,9 @@ dependencies:
|
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - "="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 1.7.0
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: mocha
|
@@ -48,9 +48,9 @@ dependencies:
|
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 0.9.4
|
54
54
|
version:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jnunemaker-matchy
|
@@ -62,16 +62,6 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 0.4.0
|
64
64
|
version:
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: thoughtbot-quietbacktrace
|
67
|
-
type: :development
|
68
|
-
version_requirement:
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: "0"
|
74
|
-
version:
|
75
65
|
description:
|
76
66
|
email: nunemaker@gmail.com
|
77
67
|
executables: []
|
@@ -97,6 +87,7 @@ files:
|
|
97
87
|
- lib/mongomapper/save_with_validation.rb
|
98
88
|
- lib/mongomapper/serialization.rb
|
99
89
|
- lib/mongomapper/serializers/json_serializer.rb
|
90
|
+
- mongomapper.gemspec
|
100
91
|
- test/serializers/test_json_serializer.rb
|
101
92
|
- test/test_associations.rb
|
102
93
|
- test/test_callbacks.rb
|
@@ -105,7 +96,7 @@ files:
|
|
105
96
|
- test/test_finder_options.rb
|
106
97
|
- test/test_helper.rb
|
107
98
|
- test/test_key.rb
|
108
|
-
- test/
|
99
|
+
- test/test_mongomapper.rb
|
109
100
|
- test/test_rails_compatibility.rb
|
110
101
|
- test/test_serializations.rb
|
111
102
|
- test/test_validations.rb
|
@@ -144,7 +135,7 @@ test_files:
|
|
144
135
|
- test/test_finder_options.rb
|
145
136
|
- test/test_helper.rb
|
146
137
|
- test/test_key.rb
|
147
|
-
- test/
|
138
|
+
- test/test_mongomapper.rb
|
148
139
|
- test/test_rails_compatibility.rb
|
149
140
|
- test/test_serializations.rb
|
150
141
|
- test/test_validations.rb
|