muck-profiles 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -79,6 +79,7 @@ Your user model will now appear to have a 'photo' which is delegated to the prof
79
79
  Create an initializer to configure muck profiles:
80
80
 
81
81
  MuckProfiles.configure do |config|
82
+ config.enable_sunspot = false # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
82
83
  config.enable_solr = true # This enables or disables acts as solr for profiles.
83
84
  config.enable_guess_location = true # If true the profile system will attempt to determine the user's location via IP and populated with the location, lat and lon fields.
84
85
  end
@@ -87,10 +88,11 @@ Create an initializer to configure muck profiles:
87
88
  Muck Profiles works with solr to allow searching users.
88
89
 
89
90
 
90
- If you enable acts as solr you'll also want to specify a default policy in your configuration. This policy is used to determine which fields are public and private.
91
+ If you enable acts_as_solr or sunspot you'll also want to specify a default policy in your configuration. This policy is used to determine which fields are public and private.
91
92
  The default policy looks like this:
92
93
 
93
94
  MuckProfiles.configure do |config|
95
+ config.enable_sunspot = false # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
94
96
  config.enable_solr = true # This enables or disables acts as solr for profiles.
95
97
  config.enable_geokit = true # Turn geokit functionality on/off.
96
98
  config.enable_guess_location = true # If true the profile system will attempt to determine the user's location via IP and populated with the location, lat and lon fields.
@@ -105,6 +107,7 @@ If you add attributes to the profile as show below then you will want to specify
105
107
  possible to add new privacy levels simply by adding new values to the hash. For example:
106
108
 
107
109
  MuckProfiles.configure do |config|
110
+ config.enable_sunspot = false # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
108
111
  config.enable_solr = true # This enables or disables acts as solr for profiles.
109
112
  config.enable_guess_location = true # If true the profile system will attempt to determine the user's location via IP and populated with the location, lat and lon fields.
110
113
  config.policy => { :public => [:login, :first_name, :last_name, :about],
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.1
1
+ 3.0.2
@@ -14,9 +14,21 @@ class Muck::ProfilesController < ApplicationController
14
14
  @query = params[:q]
15
15
  @page = (params[:page] || 1).to_i
16
16
  @rows = (params[:rows] || 10).to_i
17
- results = Profile.find_by_solr(@query, :limit => @rows, :offset => @rows*(@page-1), :core => 'en')
18
- @hit_count = results.total
19
- @users = results.results.paginate(:page => @page, :per_page => @rows, :total_entries => @hit_count)
17
+ if MuckProfile.configuration.enable_solr
18
+ results = Profile.find_by_solr(@query, :limit => @rows, :offset => @rows*(@page-1), :core => 'en')
19
+ @hit_count = results.total
20
+ @users = results.results.paginate(:page => @page, :per_page => @rows, :total_entries => @hit_count)
21
+ elsif MuckProfile.configuration.enable_sunspot
22
+ results = Sunspot.search Profile do
23
+ keywords @query
24
+ paginate :page => @page, :per_page => @per_page
25
+ end
26
+ @hit_count = results.total
27
+ @users = results.results.paginate(:page => @page, :per_page => @rows, :total_entries => @hit_count)
28
+ else
29
+ raise translate('muck.profiles.search_not_enabled')
30
+ end
31
+
20
32
  respond_to do |format|
21
33
  format.html { render :template => 'profiles/index' }
22
34
  end
@@ -25,4 +25,5 @@ en:
25
25
  country_help: "Enter your current current."
26
26
  language_help: "Enter your primary language"
27
27
  location_suggestion: "We think you're in %{location}."
28
- click_to_set: "Click to set this as your location."
28
+ click_to_set: "Click to set this as your location."
29
+ search_not_enabled: "Search not enabled for profiles. Set either enable_solr or enable_sunspot to true in your profile configuration."
@@ -13,13 +13,14 @@ module MuckProfiles
13
13
  end
14
14
 
15
15
  class Configuration
16
-
16
+ attr_accessor :enable_sunspot # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
17
17
  attr_accessor :enable_solr # This enables or disables acts as solr for profiles.
18
18
  attr_accessor :enable_geokit # Turn geokit functionality on/off
19
19
  attr_accessor :enable_guess_location # If true the profile system will attempt to determine the user's location via IP and populated with the location, lat and lon fields.
20
20
  attr_accessor :policy
21
21
 
22
22
  def initialize
23
+ self.enable_sunspot = false
23
24
  self.enable_solr = true
24
25
  self.enable_guess_location = true
25
26
  self.policy = { :public => [:login, :first_name, :last_name, :about],
@@ -32,13 +32,13 @@ module MuckProfiles
32
32
 
33
33
  acts_as_mappable if MuckProfiles.configuration.enable_geokit
34
34
 
35
- if MuckProfiles.configuration.enable_solr
35
+ if MuckProfiles.configuration.enable_solr || MuckProfiles.configuration.enable_sunspot
36
36
  fields = []
37
37
  MuckProfiles.configuration.policy.keys.each do |key|
38
38
  field_name = "#{key}_fields"
39
39
  fields << {field_name.to_sym, :text}
40
40
  # Setup a method for each key in the policy that can generate a string of all the fields
41
- # associated with that key. acts_as_solr will call this method.
41
+ # associated with that key. acts_as_solr or sunspot will call this method.
42
42
  instance_eval do
43
43
  define_method field_name do
44
44
  MuckProfiles.configuration.policy[key].collect{ |attribute| self.send(attribute) }.join(' ')
@@ -48,8 +48,17 @@ module MuckProfiles
48
48
  write_inheritable_array(:solr_fields, fields)
49
49
  write_inheritable_hash(:default_policy, MuckProfiles.configuration.policy)
50
50
 
51
- require 'acts_as_solr'
52
- acts_as_solr( {:fields => fields}, {:multi_core => true, :default_core => 'en'})
51
+ if MuckProfiles.configuration.enable_solr
52
+ require 'acts_as_solr'
53
+ acts_as_solr( {:fields => fields}, {:multi_core => true, :default_core => 'en'})
54
+ elsif MuckProfiles.configuration.enable_sunspot
55
+ require 'sunspot'
56
+ searchable do
57
+ fields.each do |field|
58
+ text field
59
+ end
60
+ end
61
+ end
53
62
  end
54
63
 
55
64
  attr_protected :created_at, :updated_at, :photo_file_name, :photo_content_type, :photo_file_size
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-profiles}
8
- s.version = "3.0.1"
8
+ s.version = "3.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
12
- s.date = %q{2010-10-18}
12
+ s.date = %q{2010-10-27}
13
13
  s.description = %q{Profile engine for the muck system.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "3.0.0" #, :path => "~/projects/other_apps/rails"
3
+ gem "rails", "3.0.1" #, :path => "~/projects/other_apps/rails"
4
4
  gem "mysql"
5
5
 
6
6
  # gem "authlogic"
@@ -14,7 +14,7 @@ PATH
14
14
  PATH
15
15
  remote: /Users/jbasdf/projects/muck-activities
16
16
  specs:
17
- muck-activities (3.0.0)
17
+ muck-activities (3.0.1)
18
18
  muck-comments
19
19
  muck-engine
20
20
  muck-users
@@ -22,7 +22,7 @@ PATH
22
22
  PATH
23
23
  remote: /Users/jbasdf/projects/muck-comments
24
24
  specs:
25
- muck-comments (3.0.1)
25
+ muck-comments (3.0.2)
26
26
  muck-engine
27
27
  muck-users
28
28
  nested_set
@@ -31,7 +31,7 @@ PATH
31
31
  PATH
32
32
  remote: /Users/jbasdf/projects/muck-contents
33
33
  specs:
34
- muck-contents (3.0.0)
34
+ muck-contents (3.0.1)
35
35
  acts-as-taggable-on
36
36
  awesome_nested_set
37
37
  babelphish
@@ -46,7 +46,7 @@ PATH
46
46
  PATH
47
47
  remote: /Users/jbasdf/projects/muck-engine
48
48
  specs:
49
- muck-engine (3.0.1)
49
+ muck-engine (3.0.6)
50
50
  overlord
51
51
  validation_reflection
52
52
  will_paginate (~> 3.0.beta)
@@ -54,7 +54,7 @@ PATH
54
54
  PATH
55
55
  remote: /Users/jbasdf/projects/muck-profiles
56
56
  specs:
57
- muck-profiles (3.0.0)
57
+ muck-profiles (3.0.1)
58
58
  geokit
59
59
  muck-comments
60
60
  muck-contents
@@ -70,7 +70,7 @@ PATH
70
70
  PATH
71
71
  remote: /Users/jbasdf/projects/muck-shares
72
72
  specs:
73
- muck-shares (3.0.0)
73
+ muck-shares (3.0.1)
74
74
  muck-activities
75
75
  muck-comments
76
76
  muck-engine
@@ -79,11 +79,11 @@ PATH
79
79
  PATH
80
80
  remote: /Users/jbasdf/projects/muck-users
81
81
  specs:
82
- muck-users (3.0.0)
82
+ muck-users (3.0.5)
83
83
  authlogic
84
84
  bcrypt-ruby
85
85
  friendly_id
86
- muck-engine
86
+ muck-engine (>= 3.0.3)
87
87
 
88
88
  PATH
89
89
  remote: /Users/jbasdf/projects/other_apps/shoulda
@@ -94,12 +94,12 @@ GEM
94
94
  remote: http://rubygems.org/
95
95
  specs:
96
96
  abstract (1.0.0)
97
- actionmailer (3.0.0)
98
- actionpack (= 3.0.0)
97
+ actionmailer (3.0.1)
98
+ actionpack (= 3.0.1)
99
99
  mail (~> 2.2.5)
100
- actionpack (3.0.0)
101
- activemodel (= 3.0.0)
102
- activesupport (= 3.0.0)
100
+ actionpack (3.0.1)
101
+ activemodel (= 3.0.1)
102
+ activesupport (= 3.0.1)
103
103
  builder (~> 2.1.2)
104
104
  erubis (~> 2.6.6)
105
105
  i18n (~> 0.4.1)
@@ -107,19 +107,19 @@ GEM
107
107
  rack-mount (~> 0.6.12)
108
108
  rack-test (~> 0.5.4)
109
109
  tzinfo (~> 0.3.23)
110
- activemodel (3.0.0)
111
- activesupport (= 3.0.0)
110
+ activemodel (3.0.1)
111
+ activesupport (= 3.0.1)
112
112
  builder (~> 2.1.2)
113
113
  i18n (~> 0.4.1)
114
- activerecord (3.0.0)
115
- activemodel (= 3.0.0)
116
- activesupport (= 3.0.0)
114
+ activerecord (3.0.1)
115
+ activemodel (= 3.0.1)
116
+ activesupport (= 3.0.1)
117
117
  arel (~> 1.0.0)
118
118
  tzinfo (~> 0.3.23)
119
- activeresource (3.0.0)
120
- activemodel (= 3.0.0)
121
- activesupport (= 3.0.0)
122
- activesupport (3.0.0)
119
+ activeresource (3.0.1)
120
+ activemodel (= 3.0.1)
121
+ activesupport (= 3.0.1)
122
+ activesupport (3.0.1)
123
123
  acts-as-taggable-on (2.0.6)
124
124
  arel (1.0.1)
125
125
  activesupport (~> 3.0.0)
@@ -135,28 +135,31 @@ GEM
135
135
  babosa (0.2.0)
136
136
  bcrypt-ruby (2.1.2)
137
137
  builder (2.1.2)
138
- capybara (0.3.9)
138
+ capybara (0.4.0)
139
+ celerity (>= 0.7.9)
139
140
  culerity (>= 0.2.4)
140
141
  mime-types (>= 1.16)
141
142
  nokogiri (>= 1.3.3)
142
143
  rack (>= 1.0.0)
143
144
  rack-test (>= 0.5.4)
144
- selenium-webdriver (>= 0.0.3)
145
- childprocess (0.0.7)
145
+ selenium-webdriver (>= 0.0.27)
146
+ xpath (~> 0.1.2)
147
+ celerity (0.8.2)
148
+ childprocess (0.1.3)
146
149
  ffi (~> 0.6.3)
147
150
  columnize (0.3.1)
148
151
  configuration (1.1.0)
149
152
  crack (0.1.8)
150
- cucumber (0.9.2)
153
+ cucumber (0.9.3)
151
154
  builder (~> 2.1.2)
152
155
  diff-lcs (~> 1.1.2)
153
- gherkin (~> 2.2.5)
156
+ gherkin (~> 2.2.9)
154
157
  json (~> 1.4.6)
155
158
  term-ansicolor (~> 1.0.5)
156
159
  cucumber-rails (0.3.2)
157
160
  cucumber (>= 0.8.0)
158
161
  culerity (0.2.12)
159
- database_cleaner (0.5.2)
162
+ database_cleaner (0.6.0)
160
163
  diff-lcs (1.1.2)
161
164
  disguise (3.0.2)
162
165
  erubis (2.6.6)
@@ -167,32 +170,34 @@ GEM
167
170
  friendly_id (3.1.7)
168
171
  babosa (~> 0.2.0)
169
172
  geokit (1.5.0)
170
- gherkin (2.2.8)
173
+ gherkin (2.2.9)
171
174
  json (~> 1.4.6)
172
175
  term-ansicolor (~> 1.0.5)
173
176
  httparty (0.6.1)
174
177
  crack (= 0.1.8)
175
- i18n (0.4.1)
178
+ i18n (0.4.2)
176
179
  json (1.4.6)
177
180
  json_pure (1.4.6)
178
181
  launchy (0.3.7)
179
182
  configuration (>= 0.0.5)
180
183
  rake (>= 0.8.1)
181
184
  linecache (0.43)
182
- mail (2.2.7)
185
+ mail (2.2.9)
183
186
  activesupport (>= 2.3.6)
184
- mime-types
185
- treetop (>= 1.4.5)
187
+ i18n (~> 0.4.1)
188
+ mime-types (~> 1.16)
189
+ treetop (~> 1.4.8)
186
190
  mime-types (1.16)
187
- muck-raker (0.3.18)
191
+ muck-raker (3.0.0)
188
192
  mysql (2.8.1)
189
193
  nested_set (1.5.2)
190
194
  activerecord (>= 3.0.0)
191
195
  railties (>= 3.0.0)
192
196
  nokogiri (1.4.3.1)
193
- overlord (3.0.1)
197
+ overlord (3.0.2)
194
198
  httparty
195
- paperclip (2.3.4)
199
+ json
200
+ paperclip (2.3.5)
196
201
  activerecord
197
202
  activesupport
198
203
  polyglot (0.3.1)
@@ -201,33 +206,33 @@ GEM
201
206
  rack (>= 1.0.0)
202
207
  rack-test (0.5.6)
203
208
  rack (>= 1.0)
204
- rails (3.0.0)
205
- actionmailer (= 3.0.0)
206
- actionpack (= 3.0.0)
207
- activerecord (= 3.0.0)
208
- activeresource (= 3.0.0)
209
- activesupport (= 3.0.0)
209
+ rails (3.0.1)
210
+ actionmailer (= 3.0.1)
211
+ actionpack (= 3.0.1)
212
+ activerecord (= 3.0.1)
213
+ activeresource (= 3.0.1)
214
+ activesupport (= 3.0.1)
210
215
  bundler (~> 1.0.0)
211
- railties (= 3.0.0)
212
- railties (3.0.0)
213
- actionpack (= 3.0.0)
214
- activesupport (= 3.0.0)
216
+ railties (= 3.0.1)
217
+ railties (3.0.1)
218
+ actionpack (= 3.0.1)
219
+ activesupport (= 3.0.1)
215
220
  rake (>= 0.8.4)
216
221
  thor (~> 0.14.0)
217
222
  rake (0.8.7)
218
223
  rcov (0.9.9)
219
- rspec (2.0.0)
220
- rspec-core (= 2.0.0)
221
- rspec-expectations (= 2.0.0)
222
- rspec-mocks (= 2.0.0)
223
- rspec-core (2.0.0)
224
- rspec-expectations (2.0.0)
224
+ rspec (2.0.1)
225
+ rspec-core (~> 2.0.1)
226
+ rspec-expectations (~> 2.0.1)
227
+ rspec-mocks (~> 2.0.1)
228
+ rspec-core (2.0.1)
229
+ rspec-expectations (2.0.1)
225
230
  diff-lcs (>= 1.1.2)
226
- rspec-mocks (2.0.0)
227
- rspec-core (= 2.0.0)
228
- rspec-expectations (= 2.0.0)
229
- rspec-rails (2.0.0)
230
- rspec (= 2.0.0)
231
+ rspec-mocks (2.0.1)
232
+ rspec-core (~> 2.0.1)
233
+ rspec-expectations (~> 2.0.1)
234
+ rspec-rails (2.0.1)
235
+ rspec (~> 2.0.0)
231
236
  ruby-debug (0.10.3)
232
237
  columnize (>= 0.1)
233
238
  ruby-debug-base (~> 0.10.3.0)
@@ -256,6 +261,8 @@ GEM
256
261
  validation_reflection (1.0.0)
257
262
  will_paginate (3.0.pre2)
258
263
  xml-simple (1.0.12)
264
+ xpath (0.1.2)
265
+ nokogiri (~> 1.3)
259
266
  ya2yaml (0.30)
260
267
 
261
268
  PLATFORMS
@@ -282,7 +289,7 @@ DEPENDENCIES
282
289
  muck-users!
283
290
  mysql
284
291
  overlord
285
- rails (= 3.0.0)
292
+ rails (= 3.0.1)
286
293
  rcov
287
294
  rspec (>= 2.0.0)
288
295
  rspec-rails (>= 2.0.0)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-profiles
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 1
10
- version: 3.0.1
9
+ - 2
10
+ version: 3.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Ball
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-18 00:00:00 -06:00
19
+ date: 2010-10-27 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency