sunspot_mongo 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sunspot/mongo/railtie.rb +9 -0
- data/lib/sunspot/mongo/tasks.rb +20 -0
- data/lib/sunspot/mongo/version.rb +1 -1
- data/lib/sunspot_mongo.rb +1 -0
- metadata +16 -14
@@ -0,0 +1,20 @@
|
|
1
|
+
namespace :sunspot do
|
2
|
+
namespace :mongo do
|
3
|
+
desc "Reindex all models that include Sunspot::Mongo and are located in your application's models directory."
|
4
|
+
task :reindex, [:models] => :environment do |t, args|
|
5
|
+
sunspot_models = if args[:models]
|
6
|
+
args[:models].split('+').map{|m| m.constantize}
|
7
|
+
else
|
8
|
+
all_files = Dir.glob(Rails.root.join('app', 'models', '*.rb'))
|
9
|
+
all_models = all_files.map { |path| File.basename(path, '.rb').camelize.constantize }
|
10
|
+
all_models.select { |m| m.include?(Sunspot::Mongo) and m.searchable? }
|
11
|
+
end
|
12
|
+
|
13
|
+
sunspot_models.each do |model|
|
14
|
+
puts "reindexing #{model}"
|
15
|
+
model.all.each(&:index)
|
16
|
+
Sunspot.commit
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/sunspot_mongo.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot_mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08
|
12
|
+
date: 2011-10-08 00:00:00.000000000 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sunspot_rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70180241340920 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70180241340920
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: bson_ext
|
28
|
-
requirement: &
|
28
|
+
requirement: &70180241340400 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70180241340400
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: mongo_mapper
|
39
|
-
requirement: &
|
39
|
+
requirement: &70180241339920 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70180241339920
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: mongoid
|
50
|
-
requirement: &
|
50
|
+
requirement: &70180241339440 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70180241339440
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rails
|
61
|
-
requirement: &
|
61
|
+
requirement: &70180241338960 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70180241338960
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
|
-
requirement: &
|
72
|
+
requirement: &70180241338480 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70180241338480
|
81
81
|
description: Sunspot search for both MongoDB. Supports Mongo Mapper and Mongoid.
|
82
82
|
email:
|
83
83
|
- balexand@gmail.com
|
@@ -91,6 +91,8 @@ files:
|
|
91
91
|
- README.rdoc
|
92
92
|
- Rakefile
|
93
93
|
- lib/sunspot/mongo.rb
|
94
|
+
- lib/sunspot/mongo/railtie.rb
|
95
|
+
- lib/sunspot/mongo/tasks.rb
|
94
96
|
- lib/sunspot/mongo/version.rb
|
95
97
|
- lib/sunspot_mongo.rb
|
96
98
|
- spec/spec_helper.rb
|