sunspot_mongo_mapper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Brandon Keepers
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # sunspot_mongo_mapper
2
+
3
+ A Sunspot wrapper for MongoMapper.
4
+
5
+ ## Install
6
+
7
+ Add the gem to your Gemfile
8
+
9
+ ```ruby
10
+ gem 'sunspot_mongo_mapper'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ruby
16
+ class Post
17
+ include MongoMapper::Document
18
+
19
+ key :title
20
+
21
+ searchable do
22
+ text :title
23
+ end
24
+ end
25
+ ```
26
+
27
+ ## Links
28
+
29
+ * [sunspot](http://github.com/sunspot/sunspot)
30
+
31
+ ## Credits
32
+
33
+ This gem was adapted from [sunspot_mongoid](https://github.com/jugyo/sunspot_mongoid)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
@@ -0,0 +1,31 @@
1
+ require 'sunspot'
2
+ require 'mongo_mapper'
3
+ require 'sunspot/rails'
4
+
5
+ module Sunspot
6
+ module MongoMapper
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ extend Sunspot::Rails::Searchable::ActsAsMethods
11
+ Sunspot::Adapters::DataAccessor.register DataAccessor, self
12
+ Sunspot::Adapters::InstanceAdapter.register InstanceAdapter, self
13
+ end
14
+
15
+ class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
16
+ def id
17
+ @instance.id
18
+ end
19
+ end
20
+
21
+ class DataAccessor < Sunspot::Adapters::DataAccessor
22
+ def load(id)
23
+ @clazz.first(:id => id)
24
+ end
25
+
26
+ def load_all(ids)
27
+ @clazz.all(:id.in => ids)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ require 'sunspot/mongo_mapper'
2
+
3
+ MongoMapper::Document.plugin Sunspot::MongoMapper
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'sunspot_mongo_mapper'
5
+ s.version = '0.1.0'
6
+ s.authors = ['Brandon Keepers']
7
+ s.email = ['brandon@opensoul.org']
8
+ s.homepage = "https://github.com/bkeepers/sunspot_mongo_mapper"
9
+ s.summary = %q{A Sunspot wrapper for MongoMapper.}
10
+ s.description = %q{A Sunspot wrapper for MongoMapper.}
11
+
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.require_paths = ["lib"]
16
+
17
+ s.add_runtime_dependency 'mongo_mapper'
18
+ s.add_runtime_dependency 'sunspot', '~> 1.1'
19
+ s.add_runtime_dependency 'sunspot_rails', '~> 1.1'
20
+ s.add_development_dependency 'rspec', '~> 2.0'
21
+ s.add_development_dependency 'rake'
22
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sunspot_mongo_mapper
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Brandon Keepers
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-17 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: mongo_mapper
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: sunspot
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 13
44
+ segments:
45
+ - 1
46
+ - 1
47
+ version: "1.1"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: sunspot_rails
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 13
59
+ segments:
60
+ - 1
61
+ - 1
62
+ version: "1.1"
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rspec
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 2
76
+ - 0
77
+ version: "2.0"
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ type: :development
93
+ version_requirements: *id005
94
+ description: A Sunspot wrapper for MongoMapper.
95
+ email:
96
+ - brandon@opensoul.org
97
+ executables: []
98
+
99
+ extensions: []
100
+
101
+ extra_rdoc_files: []
102
+
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - LICENSE
107
+ - README.md
108
+ - Rakefile
109
+ - lib/sunspot/mongo_mapper.rb
110
+ - lib/sunspot_mongo_mapper.rb
111
+ - sunspot_mongo_mapper.gemspec
112
+ has_rdoc: true
113
+ homepage: https://github.com/bkeepers/sunspot_mongo_mapper
114
+ licenses: []
115
+
116
+ post_install_message:
117
+ rdoc_options: []
118
+
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ hash: 3
136
+ segments:
137
+ - 0
138
+ version: "0"
139
+ requirements: []
140
+
141
+ rubyforge_project:
142
+ rubygems_version: 1.6.1
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: A Sunspot wrapper for MongoMapper.
146
+ test_files: []
147
+