sunspot_neo4j 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +22 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +42 -0
  7. data/Rakefile +51 -0
  8. data/VERSION +1 -0
  9. data/lib/sunspot_neo4j.rb +3 -0
  10. data/lib/sunspot_neo4j/neo4j_adapter.rb +48 -0
  11. data/spec/dummy/Gemfile +34 -0
  12. data/spec/dummy/README.rdoc +28 -0
  13. data/spec/dummy/Rakefile +6 -0
  14. data/spec/dummy/app/assets/images/.keep +0 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  19. data/spec/dummy/app/mailers/.keep +0 -0
  20. data/spec/dummy/app/models/.keep +0 -0
  21. data/spec/dummy/app/models/concerns/.keep +0 -0
  22. data/spec/dummy/app/models/recipe.rb +9 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +13 -0
  24. data/spec/dummy/bin/bundle +3 -0
  25. data/spec/dummy/bin/rails +4 -0
  26. data/spec/dummy/bin/rake +4 -0
  27. data/spec/dummy/bin/setup +29 -0
  28. data/spec/dummy/config.ru +4 -0
  29. data/spec/dummy/config/application.rb +32 -0
  30. data/spec/dummy/config/boot.rb +3 -0
  31. data/spec/dummy/config/environment.rb +5 -0
  32. data/spec/dummy/config/environments/development.rb +38 -0
  33. data/spec/dummy/config/environments/production.rb +76 -0
  34. data/spec/dummy/config/environments/test.rb +42 -0
  35. data/spec/dummy/config/initializers/assets.rb +11 -0
  36. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  37. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  38. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/spec/dummy/config/initializers/inflections.rb +16 -0
  40. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  41. data/spec/dummy/config/initializers/session_store.rb +3 -0
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
  43. data/spec/dummy/config/locales/en.yml +23 -0
  44. data/spec/dummy/config/routes.rb +56 -0
  45. data/spec/dummy/config/secrets.yml +22 -0
  46. data/spec/dummy/config/sunspot.yml +11 -0
  47. data/spec/dummy/db/seeds.rb +7 -0
  48. data/spec/dummy/lib/assets/.keep +0 -0
  49. data/spec/dummy/lib/tasks/.keep +0 -0
  50. data/spec/dummy/log/.keep +0 -0
  51. data/spec/dummy/log/sunspot-solr-test.log +365 -0
  52. data/spec/dummy/log/test.log +54 -0
  53. data/spec/dummy/public/404.html +67 -0
  54. data/spec/dummy/public/422.html +67 -0
  55. data/spec/dummy/public/500.html +66 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/dummy/public/robots.txt +5 -0
  58. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
  59. data/spec/neo4j_adapter_spec.rb +44 -0
  60. data/spec/spec_helper.rb +104 -0
  61. data/sunspot_neo4j.gemspec +133 -0
  62. metadata +273 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afd355752a2d17ee6010887152cf68527abc748a
4
+ data.tar.gz: c5bbdda9548de35147c8a154aa51ea081c57afe8
5
+ SHA512:
6
+ metadata.gz: 58becc6f1b2eadf085c4a929ea30c08a2783d9b219e6f250f252f9f3d515a3d233a86e675f251333cfefe10444d7da7e934b03378bee12bdadcab84032ea5480
7
+ data.tar.gz: c869e575550dfd15ddfc67ac0deab42b7f6cfad162cdc3117777336dfd90fe8e89561632a578f4a2e92071df703a7d5a2e94ce5a28ffad9affff282011719570
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'neo4j', '~> 4.1.1'
7
+ gem "sunspot", ">= 1.1.0"
8
+ gem "sunspot_rails", ">= 1.1.0"
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "rdoc", "~> 3.12"
14
+ gem "bundler", "~> 1.0"
15
+ gem "jeweler", "~> 2.0.1"
16
+ gem "simplecov", ">= 0"
17
+ gem "rspec"
18
+ gem 'rspec-rails'
19
+ gem "sunspot_solr", '>= 1.1.0'
20
+ gem "sunspot_test"
21
+ gem 'neo4j_test_server', '1.1.1'
22
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Andy Schrage
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.
@@ -0,0 +1,42 @@
1
+ sunspot_neo4j
2
+ ====
3
+
4
+ A Sunspot wrapper for Neo4j.
5
+
6
+ Install
7
+ ----
8
+
9
+ gem install sunspot_neo4j
10
+
11
+ Examples
12
+ ----
13
+
14
+ class Post
15
+ include Neo4j::ActiveNode
16
+ field :title
17
+
18
+ include Sunspot::Neo4j
19
+ searchable do
20
+ text :title
21
+ end
22
+ end
23
+
24
+ For Rails
25
+ ----
26
+
27
+ ### as gem:
28
+
29
+ add a gem to Gemfile as following,
30
+
31
+ gem 'sunspot_neo4j'
32
+
33
+ Links
34
+ ----
35
+
36
+ * [sunspot](http://github.com/outoftime/sunspot)
37
+ * [sunspot_rails](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/)
38
+
39
+ Copyright
40
+ ----
41
+
42
+ Copyright (c) 2015 Andy Schrage. See LICENSE for details.
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "sunspot_neo4j"
18
+ gem.homepage = "http://github.com/Swimminschrage/sunspot_neo4j"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{A Sunspot wrapper for Neo4j}
21
+ gem.description = %Q{A Sunspot wrapper for Neo4j that is like sunspot_rails.}
22
+ gem.email = "Swimminschrage@gmail.com"
23
+ gem.authors = ["Andy Schrage"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test' << "lib/sunspot_neo4j"
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['test'].execute
39
+ end
40
+
41
+ task :default => :test
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "sunspot_neo4j #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,3 @@
1
+ require 'sunspot'
2
+ require 'sunspot/rails'
3
+ require_relative 'sunspot_neo4j/neo4j_adapter'
@@ -0,0 +1,48 @@
1
+ require 'sunspot'
2
+ require 'sunspot/rails'
3
+
4
+ # == Examples:
5
+ #
6
+ # class Post
7
+ # include Neo4j::ActiveNode
8
+ # field :title
9
+ #
10
+ # include Sunspot::Neo4j
11
+ # searchable do
12
+ # text :title
13
+ # end
14
+ # end
15
+ #
16
+ module Sunspot
17
+ module Neo4j
18
+ def self.included(base)
19
+ base.class_eval do
20
+ extend Sunspot::Rails::Searchable::ActsAsMethods
21
+ Sunspot::Adapters::DataAccessor.register(DataAccessor, base)
22
+ Sunspot::Adapters::InstanceAdapter.register(InstanceAdapter, base)
23
+ end
24
+ end
25
+
26
+ class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
27
+ def id
28
+ @instance.id
29
+ end
30
+ end
31
+
32
+ class DataAccessor < Sunspot::Adapters::DataAccessor
33
+ def load(id)
34
+ criteria(id).first
35
+ end
36
+
37
+ def load_all(ids)
38
+ criteria(ids)
39
+ end
40
+
41
+ private
42
+
43
+ def criteria(id)
44
+ @clazz.find(id)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,34 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '4.2.1'
6
+ # Use SCSS for stylesheets
7
+ gem 'sass-rails', '~> 5.0'
8
+ # Use Uglifier as compressor for JavaScript assets
9
+ gem 'uglifier', '>= 1.3.0'
10
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
11
+ gem 'jbuilder', '~> 2.0'
12
+ # bundle exec rake doc:rails generates the API under doc/api.
13
+ gem 'sdoc', '~> 0.4.0', group: :doc
14
+
15
+ # Use ActiveModel has_secure_password
16
+ # gem 'bcrypt', '~> 3.1.7'
17
+
18
+ # Use Unicorn as the app server
19
+ # gem 'unicorn'
20
+
21
+ # Use Capistrano for deployment
22
+ # gem 'capistrano-rails', group: :development
23
+
24
+ group :development, :test do
25
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
26
+ gem 'byebug'
27
+
28
+ # Access an IRB console on exception pages or by using <%= console %> in views
29
+ gem 'web-console', '~> 2.0'
30
+
31
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
32
+ gem 'spring'
33
+ end
34
+
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,9 @@
1
+ class Recipe
2
+ include Neo4j::ActiveNode
3
+ property :name, type: String
4
+
5
+ include Sunspot::Neo4j
6
+ searchable do
7
+ text :name
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ require "active_job/railtie"
7
+ # require "active_record/railtie"
8
+ require "action_controller/railtie"
9
+ require "action_mailer/railtie"
10
+ require "action_view/railtie"
11
+ require "sprockets/railtie"
12
+ # require "rails/test_unit/railtie"
13
+
14
+ # Require the gems listed in Gemfile, including any gems
15
+ # you've limited to :test, :development, or :production.
16
+ Bundler.require(*Rails.groups)
17
+
18
+ module Dummy
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.