mongoid_indexing 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -1
- data/Gemfile.lock +93 -28
- data/README.md +6 -0
- data/VERSION +1 -1
- data/lib/mongoid/indexing.rb +14 -4
- data/mongoid_indexing.gemspec +73 -0
- data/spec/mongoid_indexing_spec.rb +5 -3
- data/spec/spec_helper.rb +0 -2
- metadata +39 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,46 +1,109 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
4
|
+
actionmailer (3.2.12)
|
5
|
+
actionpack (= 3.2.12)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.12)
|
8
|
+
activemodel (= 3.2.12)
|
9
|
+
activesupport (= 3.2.12)
|
6
10
|
builder (~> 3.0.0)
|
7
|
-
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.5)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.2.1)
|
17
|
+
activemodel (3.2.12)
|
18
|
+
activesupport (= 3.2.12)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.12)
|
21
|
+
activemodel (= 3.2.12)
|
22
|
+
activesupport (= 3.2.12)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.12)
|
26
|
+
activemodel (= 3.2.12)
|
27
|
+
activesupport (= 3.2.12)
|
28
|
+
activesupport (3.2.12)
|
8
29
|
i18n (~> 0.6)
|
9
30
|
multi_json (~> 1.0)
|
10
|
-
|
11
|
-
|
31
|
+
arel (3.0.2)
|
32
|
+
builder (3.0.4)
|
33
|
+
diff-lcs (1.2.1)
|
34
|
+
erubis (2.7.0)
|
12
35
|
git (1.2.5)
|
13
|
-
|
36
|
+
hike (1.2.1)
|
37
|
+
i18n (0.6.4)
|
14
38
|
jeweler (1.8.4)
|
15
39
|
bundler (~> 1.0)
|
16
40
|
git (>= 1.2.5)
|
17
41
|
rake
|
18
42
|
rdoc
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
43
|
+
journey (1.0.4)
|
44
|
+
json (1.7.7)
|
45
|
+
mail (2.4.4)
|
46
|
+
i18n (>= 0.4.0)
|
47
|
+
mime-types (~> 1.16)
|
48
|
+
treetop (~> 1.4.8)
|
49
|
+
mime-types (1.21)
|
50
|
+
mongoid (3.1.2)
|
51
|
+
activemodel (~> 3.2)
|
52
|
+
moped (~> 1.4.2)
|
23
53
|
origin (~> 1.0)
|
24
54
|
tzinfo (~> 0.3.22)
|
25
|
-
moped (1.
|
26
|
-
multi_json (1.
|
27
|
-
origin (1.0.
|
28
|
-
|
29
|
-
|
55
|
+
moped (1.4.3)
|
56
|
+
multi_json (1.6.1)
|
57
|
+
origin (1.0.11)
|
58
|
+
polyglot (0.3.3)
|
59
|
+
rack (1.4.5)
|
60
|
+
rack-cache (1.2)
|
61
|
+
rack (>= 0.4)
|
62
|
+
rack-ssl (1.3.3)
|
63
|
+
rack
|
64
|
+
rack-test (0.6.2)
|
65
|
+
rack (>= 1.0)
|
66
|
+
rails (3.2.12)
|
67
|
+
actionmailer (= 3.2.12)
|
68
|
+
actionpack (= 3.2.12)
|
69
|
+
activerecord (= 3.2.12)
|
70
|
+
activeresource (= 3.2.12)
|
71
|
+
activesupport (= 3.2.12)
|
72
|
+
bundler (~> 1.0)
|
73
|
+
railties (= 3.2.12)
|
74
|
+
railties (3.2.12)
|
75
|
+
actionpack (= 3.2.12)
|
76
|
+
activesupport (= 3.2.12)
|
77
|
+
rack-ssl (~> 1.3.2)
|
78
|
+
rake (>= 0.8.7)
|
79
|
+
rdoc (~> 3.4)
|
80
|
+
thor (>= 0.14.6, < 2.0)
|
81
|
+
rake (10.0.3)
|
82
|
+
rdoc (3.12.2)
|
30
83
|
json (~> 1.4)
|
31
|
-
rspec (2.
|
32
|
-
rspec-core (~> 2.
|
33
|
-
rspec-expectations (~> 2.
|
34
|
-
rspec-mocks (~> 2.
|
35
|
-
rspec-core (2.
|
36
|
-
rspec-expectations (2.
|
37
|
-
diff-lcs (
|
38
|
-
rspec-mocks (2.
|
39
|
-
simplecov (0.
|
84
|
+
rspec (2.13.0)
|
85
|
+
rspec-core (~> 2.13.0)
|
86
|
+
rspec-expectations (~> 2.13.0)
|
87
|
+
rspec-mocks (~> 2.13.0)
|
88
|
+
rspec-core (2.13.0)
|
89
|
+
rspec-expectations (2.13.0)
|
90
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
91
|
+
rspec-mocks (2.13.0)
|
92
|
+
simplecov (0.7.1)
|
93
|
+
multi_json (~> 1.0)
|
94
|
+
simplecov-html (~> 0.7.1)
|
95
|
+
simplecov-html (0.7.1)
|
96
|
+
sprockets (2.2.2)
|
97
|
+
hike (~> 1.2)
|
40
98
|
multi_json (~> 1.0)
|
41
|
-
|
42
|
-
|
43
|
-
|
99
|
+
rack (~> 1.0)
|
100
|
+
tilt (~> 1.1, != 1.3.0)
|
101
|
+
thor (0.17.0)
|
102
|
+
tilt (1.3.4)
|
103
|
+
treetop (1.4.12)
|
104
|
+
polyglot
|
105
|
+
polyglot (>= 0.3.1)
|
106
|
+
tzinfo (0.3.36)
|
44
107
|
|
45
108
|
PLATFORMS
|
46
109
|
ruby
|
@@ -48,7 +111,9 @@ PLATFORMS
|
|
48
111
|
DEPENDENCIES
|
49
112
|
bundler (>= 1.0.0)
|
50
113
|
jeweler (>= 1.8.4)
|
51
|
-
mongoid
|
114
|
+
mongoid (>= 3)
|
115
|
+
moped (>= 1.4)
|
116
|
+
rails (>= 3.1)
|
52
117
|
rdoc (>= 3.12)
|
53
118
|
rspec (>= 2.8.0)
|
54
119
|
simplecov (>= 0.5)
|
data/README.md
CHANGED
@@ -14,6 +14,12 @@ Programmatic access to index creation and removal is useful in project where you
|
|
14
14
|
|
15
15
|
Scenario: Using Mongoid Geospatial to create geo positions for properties. For geo searches to work, you need to create 2d indexes!
|
16
16
|
|
17
|
+
Updated to work with:
|
18
|
+
|
19
|
+
https://github.com/mongoid/mongoid/blob/master/lib/rails/mongoid.rb
|
20
|
+
|
21
|
+
(Since March 2013)
|
22
|
+
|
17
23
|
```ruby
|
18
24
|
# RANDOM PROPERTIES
|
19
25
|
describe Property do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/mongoid/indexing.rb
CHANGED
@@ -21,8 +21,10 @@ module Mongoid
|
|
21
21
|
raise ArgumentError, "No model paths for creating mongoid indexes" if models_paths.blank?
|
22
22
|
message "CREATE INDEXES: #{models_paths}"
|
23
23
|
|
24
|
+
load_models_from_paths models_paths
|
25
|
+
|
24
26
|
models_paths.each do |path|
|
25
|
-
::Rails::Mongoid.create_indexes
|
27
|
+
::Rails::Mongoid.create_indexes
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
@@ -32,16 +34,24 @@ module Mongoid
|
|
32
34
|
raise ArgumentError, "No model paths for creating mongoid indexes" if models_paths.blank?
|
33
35
|
message "REMOVING INDEXES: #{models_paths}"
|
34
36
|
|
37
|
+
load_models_from_paths models_paths
|
38
|
+
|
35
39
|
models_paths.each do |path|
|
36
|
-
::Rails::Mongoid.remove_indexes
|
40
|
+
::Rails::Mongoid.remove_indexes
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_models_from_paths *models_paths
|
45
|
+
[models_paths].flatten.compact.each do |path|
|
46
|
+
require "#{path}/**/*.rb" unless path.blank?
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
50
|
def rails_models_paths
|
41
|
-
engines_models_paths = Rails.application.railties.engines.map do |engine|
|
51
|
+
engines_models_paths = ::Rails.application.railties.engines.map do |engine|
|
42
52
|
engine.paths["app/models"].expanded
|
43
53
|
end
|
44
|
-
root_models_paths = Rails.application.paths["app/models"]
|
54
|
+
root_models_paths = ::Rails.application.paths["app/models"]
|
45
55
|
engines_models_paths.push(root_models_paths).flatten
|
46
56
|
end
|
47
57
|
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "mongoid_indexing"
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kristian Mandrup"]
|
12
|
+
s.date = "2013-03-04"
|
13
|
+
s.description = "Mongoid index creation and removal the nice and easy way :)"
|
14
|
+
s.email = "kmandrup@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/mongoid/indexing.rb",
|
29
|
+
"lib/mongoid_indexing.rb",
|
30
|
+
"mongoid_indexing.gemspec",
|
31
|
+
"spec/mongoid_indexing_spec.rb",
|
32
|
+
"spec/spec_helper.rb"
|
33
|
+
]
|
34
|
+
s.homepage = "http://github.com/kristianmandrup/mongoid_indexing"
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = "1.8.25"
|
38
|
+
s.summary = "Programmatic index creation and removal for Mongoid"
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
s.add_runtime_dependency(%q<mongoid>, [">= 3"])
|
45
|
+
s.add_runtime_dependency(%q<moped>, [">= 1.4"])
|
46
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.1"])
|
47
|
+
s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
|
48
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
49
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
51
|
+
s.add_development_dependency(%q<simplecov>, [">= 0.5"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<mongoid>, [">= 3"])
|
54
|
+
s.add_dependency(%q<moped>, [">= 1.4"])
|
55
|
+
s.add_dependency(%q<rails>, [">= 3.1"])
|
56
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
57
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
58
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
60
|
+
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<mongoid>, [">= 3"])
|
64
|
+
s.add_dependency(%q<moped>, [">= 1.4"])
|
65
|
+
s.add_dependency(%q<rails>, [">= 3.1"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
67
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
68
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
70
|
+
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_indexing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,39 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: moped
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.4'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.4'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.1'
|
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: '3.1'
|
30
62
|
- !ruby/object:Gem::Dependency
|
31
63
|
name: rspec
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +157,7 @@ files:
|
|
125
157
|
- VERSION
|
126
158
|
- lib/mongoid/indexing.rb
|
127
159
|
- lib/mongoid_indexing.rb
|
160
|
+
- mongoid_indexing.gemspec
|
128
161
|
- spec/mongoid_indexing_spec.rb
|
129
162
|
- spec/spec_helper.rb
|
130
163
|
homepage: http://github.com/kristianmandrup/mongoid_indexing
|
@@ -142,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
175
|
version: '0'
|
143
176
|
segments:
|
144
177
|
- 0
|
145
|
-
hash: -
|
178
|
+
hash: -439931800579237307
|
146
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
180
|
none: false
|
148
181
|
requirements:
|
@@ -151,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
184
|
version: '0'
|
152
185
|
requirements: []
|
153
186
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.8.
|
187
|
+
rubygems_version: 1.8.25
|
155
188
|
signing_key:
|
156
189
|
specification_version: 3
|
157
190
|
summary: Programmatic index creation and removal for Mongoid
|