spud_search 0.1.5 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.markdown +21 -0
- data/Rakefile +28 -0
- data/app/views/search/_index.html.erb +3 -3
- data/config/routes.rb +1 -2
- data/lib/spud_search.rb +1 -0
- data/lib/spud_search/engine.rb +1 -1
- data/lib/spud_search/searchable.rb +24 -20
- data/lib/spud_search/version.rb +5 -0
- metadata +178 -22
- data/app/assets/javascripts/search.js +0 -2
- data/app/assets/javascripts/spud/admin/users.js +0 -2
- data/app/assets/javascripts/spud/user_sessions.js +0 -2
- data/app/assets/stylesheets/search.css +0 -4
- data/app/helpers/search_helper.rb +0 -2
- data/app/helpers/spud/admin/users_helper.rb +0 -2
- data/app/helpers/spud/user_sessions_helper.rb +0 -2
- data/config/application.rb +0 -50
- data/config/boot.rb +0 -6
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
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.markdown
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Insert Readme Information Here
|
2
|
+
|
3
|
+
Testing
|
4
|
+
-----------------
|
5
|
+
|
6
|
+
Spud uses RSpec for testing. Get the tests running with a few short commands:
|
7
|
+
|
8
|
+
1. Create and migrate the databases:
|
9
|
+
|
10
|
+
rake db:create
|
11
|
+
rake db:migrate
|
12
|
+
|
13
|
+
2. Load the schema in to the test database:
|
14
|
+
|
15
|
+
rake app:db:test:prepare
|
16
|
+
|
17
|
+
3. Run the tests with RSpec
|
18
|
+
|
19
|
+
rspec spec
|
20
|
+
|
21
|
+
After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'SpudSearch'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rake'
|
@@ -10,13 +10,13 @@
|
|
10
10
|
<h4><%=link_to result.title,news_post_path(result.url_name)%></h4>
|
11
11
|
<%else%>
|
12
12
|
<h4><%=link_to result.title,blog_post_path(result.url_name)%></h4>
|
13
|
-
<%end%>
|
13
|
+
<%end%>
|
14
14
|
<p><%=truncate(strip_tags(result.content),:length => 200, :separator => ' ')%></p>
|
15
15
|
<%elsif result.class.name == 'SpudPage'%>
|
16
16
|
<h4><%=link_to result.name,page_path(:id => result.url_name)%></h4>
|
17
|
-
|
17
|
+
|
18
18
|
<p><%=truncate(strip_tags(result.meta_description),:length => 200, :separator => ' ')%></p>
|
19
|
-
|
19
|
+
|
20
20
|
<%end%>
|
21
21
|
</div>
|
22
22
|
<%end%>
|
data/config/routes.rb
CHANGED
data/lib/spud_search.rb
CHANGED
data/lib/spud_search/engine.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
|
-
module Spud
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
1
|
+
module Spud
|
2
|
+
module Search
|
3
|
+
module Searchable
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
extend ClassMethods
|
7
|
+
end
|
8
|
+
module ClassMethods
|
9
|
+
def spud_searchable
|
10
|
+
if self.name == 'SpudPage'
|
11
|
+
self.instance_eval do
|
12
|
+
acts_as_indexed :fields => [:name,:meta_keywords,:meta_description], :if => Proc.new { |page| page.published == true && page.visibility == 0 }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if self.name == 'SpudPost'
|
16
|
+
self.instance_eval do
|
17
|
+
acts_as_indexed :fields => [:title,:content], :if => Proc.new { |post| post.published_at <= Time.now.utc && post.visible == true }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,43 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.3
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: spud_core
|
16
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
17
33
|
none: false
|
18
34
|
requirements:
|
19
35
|
- - ! '>='
|
20
36
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
37
|
+
version: 0.9.10
|
22
38
|
type: :runtime
|
23
39
|
prerelease: false
|
24
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.10
|
25
46
|
- !ruby/object:Gem::Dependency
|
26
47
|
name: acts_as_indexed
|
27
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
28
49
|
none: false
|
29
50
|
requirements:
|
30
51
|
- - ! '>='
|
@@ -32,31 +53,160 @@ dependencies:
|
|
32
53
|
version: 0.7.7
|
33
54
|
type: :runtime
|
34
55
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
|
37
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.7
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mysql2
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.3.11
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.3.11
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - '='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.8.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.8.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec-rails
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - '='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.8.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - '='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.8.1
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: shoulda
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.0.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 3.0.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: factory_girl
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - '='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.5.0
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - '='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 2.5.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: mocha
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - '='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.10.3
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - '='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.10.3
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: database_cleaner
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - '='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 0.7.1
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.7.1
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: simplecov
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ~>
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.6.4
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ~>
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 0.6.4
|
190
|
+
description: Spud Search is a base search interface for use on spud core
|
191
|
+
email:
|
192
|
+
- destes@redwindsw.com
|
38
193
|
executables: []
|
39
194
|
extensions: []
|
40
195
|
extra_rdoc_files: []
|
41
196
|
files:
|
42
|
-
- app/assets/javascripts/search.js
|
43
|
-
- app/assets/javascripts/spud/admin/users.js
|
44
|
-
- app/assets/javascripts/spud/user_sessions.js
|
45
|
-
- app/assets/stylesheets/search.css
|
46
197
|
- app/controllers/search_controller.rb
|
47
|
-
- app/helpers/search_helper.rb
|
48
|
-
- app/helpers/spud/admin/users_helper.rb
|
49
|
-
- app/helpers/spud/user_sessions_helper.rb
|
50
198
|
- app/views/search/_index.html.erb
|
51
199
|
- app/views/search/index.html.erb
|
52
|
-
- config/application.rb
|
53
|
-
- config/boot.rb
|
54
200
|
- config/routes.rb
|
55
|
-
- lib/spud_search.rb
|
56
201
|
- lib/spud_search/configuration.rb
|
57
202
|
- lib/spud_search/engine.rb
|
58
203
|
- lib/spud_search/searchable.rb
|
59
|
-
|
204
|
+
- lib/spud_search/version.rb
|
205
|
+
- lib/spud_search.rb
|
206
|
+
- MIT-LICENSE
|
207
|
+
- Rakefile
|
208
|
+
- README.markdown
|
209
|
+
homepage: http://github.com/spud-rails/spud_search
|
60
210
|
licenses: []
|
61
211
|
post_install_message:
|
62
212
|
rdoc_options: []
|
@@ -68,16 +218,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
218
|
- - ! '>='
|
69
219
|
- !ruby/object:Gem::Version
|
70
220
|
version: '0'
|
221
|
+
segments:
|
222
|
+
- 0
|
223
|
+
hash: -3307846028351899547
|
71
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
225
|
none: false
|
73
226
|
requirements:
|
74
227
|
- - ! '>='
|
75
228
|
- !ruby/object:Gem::Version
|
76
229
|
version: '0'
|
230
|
+
segments:
|
231
|
+
- 0
|
232
|
+
hash: -3307846028351899547
|
77
233
|
requirements: []
|
78
234
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
235
|
+
rubygems_version: 1.8.24
|
80
236
|
signing_key:
|
81
237
|
specification_version: 3
|
82
|
-
summary:
|
238
|
+
summary: Acts as indexed adapter for spud core for quick searches of pages and blogs
|
83
239
|
test_files: []
|
data/config/application.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
if defined?(Bundler)
|
6
|
-
# If you precompile assets before deploying to production, use this line
|
7
|
-
Bundler.require *Rails.groups(:assets => %w(development test))
|
8
|
-
# If you want your assets lazily compiled in production, use this line
|
9
|
-
# Bundler.require(:default, :assets, Rails.env)
|
10
|
-
end
|
11
|
-
|
12
|
-
module Spud
|
13
|
-
module Search
|
14
|
-
class Application < Rails::Application
|
15
|
-
# Settings in config/environments/* take precedence over those specified here.
|
16
|
-
# Application configuration should go into files in config/initializers
|
17
|
-
# -- all .rb files in that directory are automatically loaded.
|
18
|
-
|
19
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
20
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
21
|
-
|
22
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
23
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
24
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
25
|
-
|
26
|
-
# Activate observers that should always be running.
|
27
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
28
|
-
|
29
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
30
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
31
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
32
|
-
|
33
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
34
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
35
|
-
# config.i18n.default_locale = :de
|
36
|
-
|
37
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
38
|
-
config.encoding = "utf-8"
|
39
|
-
|
40
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
41
|
-
config.filter_parameters += [:password]
|
42
|
-
|
43
|
-
# Enable the asset pipeline
|
44
|
-
config.assets.enabled = true
|
45
|
-
|
46
|
-
# Version of your assets, change this if you want to expire all your assets
|
47
|
-
config.assets.version = '1.0'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|