spina-search 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bce511ce5bedde6a9d564866bf47345b63750894
4
+ data.tar.gz: 229a5e76e0a1845f534ba444af16e8105c6175e7
5
+ SHA512:
6
+ metadata.gz: 54c61df8f4a6d9c2000c3e128362018e4f671e159eea4ec4c4938a0f48b7dd89ac88102c7b2b8fa6a9c0bb54e2228b4541ff0d8afa9da035f3aa2d3c9f878324
7
+ data.tar.gz: 602df485db9a89da25a2e37b6e817dc7095263294e7d22cf833b6069339c5e474b1a31073a568f28ce7dfeace7af492647ee739a59a9c17b348318a04a8045e3
@@ -0,0 +1,8 @@
1
+ module Spina
2
+ class SearchController < ApplicationController
3
+ def query
4
+ query = params[:q]
5
+ render json: Page.active.where(view_template: 'documentation').where('title LIKE ?', "%#{query}%").to_json
6
+ end
7
+ end
8
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Spina::Engine.routes.draw do
2
+ get '/search', to: 'search#query', format: :json, as: :search
3
+ end
data/lib/search.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'search/engine'
2
+
3
+ module Search
4
+ end
@@ -0,0 +1,10 @@
1
+ module Spina
2
+ module Search
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :name, :description, :plugin_type
6
+
7
+ self.name = 'Search'
8
+ self.description = 'Search for Spina'
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module Spina
2
+ module Search
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Spina
5
+
6
+ def self.require_decorators
7
+ [Engine.root].flatten.map { |p| Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]}.flatten.uniq.each do |decorator|
8
+ Rails.configuration.cache_classes ? require(decorator) : load(decorator)
9
+ end
10
+ end
11
+ config.to_prepare &method(:require_decorators).to_proc
12
+
13
+ initializer "register plugin" do
14
+ plugin = ::Spina::Plugin.new
15
+ plugin.name = "Search"
16
+ plugin.config = Search.config
17
+ ::Spina.register_plugin(plugin)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Spina
2
+ module Search
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Spina
2
+ module Search
3
+ require 'spina/search/configuration'
4
+ require 'spina/search/engine'
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spina-search
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Bram Jetten
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ description: Search pages using Spina Search
28
+ email:
29
+ - bram@denkgroot.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - app/controllers/spina/search_controller.rb
35
+ - config/routes.rb
36
+ - lib/search.rb
37
+ - lib/spina/search.rb
38
+ - lib/spina/search/configuration.rb
39
+ - lib/spina/search/engine.rb
40
+ - lib/spina/search/version.rb
41
+ homepage: http://www.denkgroot.com
42
+ licenses: []
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 2.4.5
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Search plugin for Spina
64
+ test_files: []