sunspot_with_activeuuid 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sunspot_with_activeuuid.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Daniel Blanco
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # SunspotWithActiveuuid
2
+
3
+ Extends sunspot to be compatible with activeuuid. Activeuuid gem uses UUID objects
4
+ as primary keys for models, what this gem does is making sure that sunspot is aware of it.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'sunspot_with_activeuuid'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install sunspot_with_activeuuid
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ module Sunspot
2
+ module Rails
3
+ module Adapters
4
+ class ActiveRecordDataAccessor < Sunspot::Adapters::DataAccessor
5
+ def load(id)
6
+ @clazz.first(options_for_find.merge(
7
+ :conditions => { @clazz.primary_key => id.to_uuid }
8
+ ))
9
+ end
10
+ def load_all(ids)
11
+ @clazz.all(options_for_find.merge(
12
+ :conditions => { @clazz.primary_key => ids.map { |id| id.to_uuid }}
13
+ ))
14
+ end
15
+ end
16
+ end
17
+ module Searchable
18
+ module ClassMethods
19
+ def solr_execute_search_ids(options = {})
20
+ search = yield
21
+ search.raw_results.map { |raw_result| raw_result.primary_key.to_uuid }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module SunspotWithActiveuuid
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "sunspot_with_activeuuid/version"
2
+
3
+ module SunspotWithActiveuuid
4
+ require 'sunspot_with_activeuuid/rails'
5
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/sunspot_with_activeuuid/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Daniel Blanco"]
6
+ gem.email = ["daniel.blancorojas@gmail.com"]
7
+ gem.description = %q{UUID ids for sunspot}
8
+ gem.summary = %q{Extends sunspot to be compatible with activeuuid}
9
+ gem.homepage = "https://github.com/DanielBlanco/sunspot_with_activeuuid"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "sunspot_with_activeuuid"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SunspotWithActiveuuid::VERSION
17
+
18
+ gem.add_development_dependency "rspec"
19
+
20
+ gem.add_dependency "activeuuid"
21
+ gem.add_dependency "uuid_helper"
22
+ end
@@ -0,0 +1,8 @@
1
+ {
2
+ "folders":
3
+ [
4
+ {
5
+ "path": "/home/daniel/Projects/sunspot_with_activeuuid"
6
+ }
7
+ ]
8
+ }