flying-sphinx 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,11 @@
1
+ 0.6.3 - 1st March 2012
2
+ * Slow down polling for direct indexing from every 1 second to every 3 seconds.
3
+ * Verbose logging now has timestamps.
4
+ * Allow direct database access when FLYING_SPHINX_INGRESS is set.
5
+ * Use dups of ENV variables so the values can be modified.
6
+ * Report if Sphinx wasn't able to start.
7
+ * Load Flying Sphinx when ENV['FLYING_SPHINX_IDENTIFIER'] exists, instead of for any Rails environment that isn't development or test.
8
+
1
9
  0.6.2 - 2nd January 2012
2
10
  * Pass Sphinx version through to Flying Sphinx servers.
3
11
 
@@ -66,13 +66,17 @@ class FlyingSphinx::API
66
66
 
67
67
  def log(method, path, data = {}, option = {}, &block)
68
68
  return block.call unless log?
69
-
70
- puts "API Request: #{method} '#{path}'; params: #{data.inspect}"
69
+
70
+ log_message "API Request: #{method} '#{path}'; params: #{data.inspect}"
71
71
  response = block.call
72
- puts "API Response: #{response.body.inspect}"
72
+ log_message "API Response: #{response.body.inspect}"
73
73
  return response
74
74
  end
75
-
75
+
76
+ def log_message(message)
77
+ puts "[#{Time.zone.now.to_s}] #{message}"
78
+ end
79
+
76
80
  def log?
77
81
  ENV['VERBOSE_LOGGING'] && ENV['VERBOSE_LOGGING'].length > 0
78
82
  end
@@ -37,11 +37,11 @@ class FlyingSphinx::Configuration
37
37
  end
38
38
 
39
39
  def start_sphinx
40
- api.post('start')
40
+ api.post('start').status == 200
41
41
  end
42
42
 
43
43
  def stop_sphinx
44
- api.post('stop')
44
+ api.post('stop').status == 200
45
45
  end
46
46
 
47
47
  def client_key
@@ -177,10 +177,10 @@ class FlyingSphinx::Configuration
177
177
  end
178
178
 
179
179
  def host_from_env
180
- ENV['FLYING_SPHINX_HOST']
180
+ ENV['FLYING_SPHINX_HOST'].dup
181
181
  end
182
182
 
183
183
  def port_from_env
184
- ENV['FLYING_SPHINX_PORT']
184
+ ENV['FLYING_SPHINX_PORT'].dup
185
185
  end
186
186
  end
@@ -108,7 +108,7 @@ class FlyingSphinx::IndexRequest
108
108
  def direct_index
109
109
  begin_request
110
110
  while !request_complete?
111
- sleep 1
111
+ sleep 3
112
112
  end
113
113
  end
114
114
 
@@ -1,9 +1,9 @@
1
1
  require 'action_controller/dispatcher'
2
2
 
3
- unless Rails.env.development? || Rails.env.test?
3
+ if ENV['FLYING_SPHINX_IDENTIFIER']
4
4
  ActionController::Dispatcher.to_prepare :flying_sphinx do
5
5
  config = FlyingSphinx::Configuration.new
6
-
6
+
7
7
  ThinkingSphinx::Configuration.instance.address = config.host
8
8
  ThinkingSphinx::Configuration.instance.port = config.port
9
9
  ThinkingSphinx::Configuration.instance.configuration.searchd.client_key =
@@ -2,17 +2,17 @@ class FlyingSphinx::Railtie < Rails::Railtie
2
2
  rake_tasks do
3
3
  load File.expand_path('../tasks.rb', __FILE__)
4
4
  end
5
-
5
+
6
6
  initializer "flying_sphinx.set_sphinx_host_and_port" do |app|
7
7
  config = FlyingSphinx::Configuration.new
8
-
8
+
9
9
  ThinkingSphinx::Configuration.instance.address = config.host
10
10
  ThinkingSphinx::Configuration.instance.port = config.port
11
11
  ThinkingSphinx::Configuration.instance.configuration.searchd.client_key =
12
12
  config.client_key
13
-
13
+
14
14
  if ENV['DATABASE_URL'] && ENV['DATABASE_URL'][/^mysql/].nil?
15
15
  ThinkingSphinx.database_adapter = FlyingSphinx::HerokuSharedAdapter
16
16
  end
17
- end unless Rails.env.development? || Rails.env.test?
17
+ end if ENV['FLYING_SPHINX_IDENTIFIER']
18
18
  end
@@ -5,28 +5,32 @@ namespace :fs do
5
5
  request = FlyingSphinx::IndexRequest.new
6
6
  request.update_and_index
7
7
  puts request.status_message
8
-
8
+
9
9
  end
10
-
10
+
11
11
  task :start => :environment do
12
12
  puts "Starting Sphinx..."
13
- FlyingSphinx::Configuration.new.start_sphinx
14
- puts "Started Sphinx"
13
+
14
+ if FlyingSphinx::Configuration.new.start_sphinx
15
+ puts "Started Sphinx"
16
+ else
17
+ puts "Sphinx failed to start... have you indexed first?"
18
+ end
15
19
  end
16
-
20
+
17
21
  task :stop => :environment do
18
22
  puts "Stopping Sphinx..."
19
23
  FlyingSphinx::Configuration.new.stop_sphinx
20
24
  puts "Stopped Sphinx"
21
25
  end
22
-
26
+
23
27
  task :restart => [:environment, :stop, :start]
24
28
  task :rebuild => [:environment, :stop, :index, :start]
25
-
29
+
26
30
  task :index_log => :environment do
27
31
  FlyingSphinx::IndexRequest.output_last_index
28
32
  end
29
-
33
+
30
34
  task :actions => :environment do
31
35
  FlyingSphinx::Configuration.new.output_recent_actions
32
36
  end
@@ -7,11 +7,12 @@ class FlyingSphinx::Tunnel
7
7
  end
8
8
  end
9
9
  end
10
-
10
+
11
11
  def self.required?
12
+ ENV['FLYING_SPHINX_INGRESS'].blank? &&
12
13
  ThinkingSphinx.database_adapter == FlyingSphinx::HerokuSharedAdapter
13
14
  end
14
-
15
+
15
16
  def initialize(configuration)
16
17
  @configuration = configuration
17
18
  end
@@ -23,13 +24,13 @@ class FlyingSphinx::Tunnel
23
24
  )
24
25
 
25
26
  session.loop { !remote_exists?(session) }
26
-
27
+
27
28
  yield session
28
29
  rescue IOError
29
30
  # Server closed the connection on us. That's (hopefully) expected, nothing
30
31
  # to worry about.
31
32
  end
32
-
33
+
33
34
  private
34
35
 
35
36
  def db_host
@@ -1,3 +1,3 @@
1
1
  module FlyingSphinx
2
- Version = '0.6.2'
2
+ Version = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flying-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Allan
@@ -15,12 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-02 00:00:00 +11:00
19
- default_executable:
18
+ date: 2012-02-29 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: thinking-sphinx
23
- prerelease: false
21
+ type: :runtime
24
22
  requirement: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
26
24
  requirements:
@@ -30,11 +28,11 @@ dependencies:
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
33
- type: :runtime
34
31
  version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: riddle
37
32
  prerelease: false
33
+ name: thinking-sphinx
34
+ - !ruby/object:Gem::Dependency
35
+ type: :runtime
38
36
  requirement: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
40
38
  requirements:
@@ -46,11 +44,11 @@ dependencies:
46
44
  - 5
47
45
  - 0
48
46
  version: 1.5.0
49
- type: :runtime
50
47
  version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: net-ssh
53
48
  prerelease: false
49
+ name: riddle
50
+ - !ruby/object:Gem::Dependency
51
+ type: :runtime
54
52
  requirement: &id003 !ruby/object:Gem::Requirement
55
53
  none: false
56
54
  requirements:
@@ -62,11 +60,11 @@ dependencies:
62
60
  - 0
63
61
  - 23
64
62
  version: 2.0.23
65
- type: :runtime
66
63
  version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: multi_json
69
64
  prerelease: false
65
+ name: net-ssh
66
+ - !ruby/object:Gem::Dependency
67
+ type: :runtime
70
68
  requirement: &id004 !ruby/object:Gem::Requirement
71
69
  none: false
72
70
  requirements:
@@ -78,11 +76,11 @@ dependencies:
78
76
  - 0
79
77
  - 1
80
78
  version: 1.0.1
81
- type: :runtime
82
79
  version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: faraday_middleware
85
80
  prerelease: false
81
+ name: multi_json
82
+ - !ruby/object:Gem::Dependency
83
+ type: :runtime
86
84
  requirement: &id005 !ruby/object:Gem::Requirement
87
85
  none: false
88
86
  requirements:
@@ -94,11 +92,11 @@ dependencies:
94
92
  - 7
95
93
  - 0
96
94
  version: 0.7.0
97
- type: :runtime
98
95
  version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: rash
101
96
  prerelease: false
97
+ name: faraday_middleware
98
+ - !ruby/object:Gem::Dependency
99
+ type: :runtime
102
100
  requirement: &id006 !ruby/object:Gem::Requirement
103
101
  none: false
104
102
  requirements:
@@ -110,11 +108,11 @@ dependencies:
110
108
  - 3
111
109
  - 0
112
110
  version: 0.3.0
113
- type: :runtime
114
111
  version_requirements: *id006
115
- - !ruby/object:Gem::Dependency
116
- name: rake
117
112
  prerelease: false
113
+ name: rash
114
+ - !ruby/object:Gem::Dependency
115
+ type: :development
118
116
  requirement: &id007 !ruby/object:Gem::Requirement
119
117
  none: false
120
118
  requirements:
@@ -126,11 +124,11 @@ dependencies:
126
124
  - 8
127
125
  - 7
128
126
  version: 0.8.7
129
- type: :development
130
127
  version_requirements: *id007
131
- - !ruby/object:Gem::Dependency
132
- name: yajl-ruby
133
128
  prerelease: false
129
+ name: rake
130
+ - !ruby/object:Gem::Dependency
131
+ type: :development
134
132
  requirement: &id008 !ruby/object:Gem::Requirement
135
133
  none: false
136
134
  requirements:
@@ -142,11 +140,11 @@ dependencies:
142
140
  - 8
143
141
  - 2
144
142
  version: 0.8.2
145
- type: :development
146
143
  version_requirements: *id008
147
- - !ruby/object:Gem::Dependency
148
- name: rspec
149
144
  prerelease: false
145
+ name: yajl-ruby
146
+ - !ruby/object:Gem::Dependency
147
+ type: :development
150
148
  requirement: &id009 !ruby/object:Gem::Requirement
151
149
  none: false
152
150
  requirements:
@@ -158,11 +156,11 @@ dependencies:
158
156
  - 5
159
157
  - 0
160
158
  version: 2.5.0
161
- type: :development
162
159
  version_requirements: *id009
163
- - !ruby/object:Gem::Dependency
164
- name: rcov
165
160
  prerelease: false
161
+ name: rspec
162
+ - !ruby/object:Gem::Dependency
163
+ type: :development
166
164
  requirement: &id010 !ruby/object:Gem::Requirement
167
165
  none: false
168
166
  requirements:
@@ -174,11 +172,11 @@ dependencies:
174
172
  - 9
175
173
  - 9
176
174
  version: 0.9.9
177
- type: :development
178
175
  version_requirements: *id010
179
- - !ruby/object:Gem::Dependency
180
- name: fakeweb
181
176
  prerelease: false
177
+ name: rcov
178
+ - !ruby/object:Gem::Dependency
179
+ type: :development
182
180
  requirement: &id011 !ruby/object:Gem::Requirement
183
181
  none: false
184
182
  requirements:
@@ -190,11 +188,11 @@ dependencies:
190
188
  - 3
191
189
  - 0
192
190
  version: 1.3.0
193
- type: :development
194
191
  version_requirements: *id011
195
- - !ruby/object:Gem::Dependency
196
- name: fakeweb-matcher
197
192
  prerelease: false
193
+ name: fakeweb
194
+ - !ruby/object:Gem::Dependency
195
+ type: :development
198
196
  requirement: &id012 !ruby/object:Gem::Requirement
199
197
  none: false
200
198
  requirements:
@@ -206,11 +204,11 @@ dependencies:
206
204
  - 2
207
205
  - 2
208
206
  version: 1.2.2
209
- type: :development
210
207
  version_requirements: *id012
211
- - !ruby/object:Gem::Dependency
212
- name: delayed_job
213
208
  prerelease: false
209
+ name: fakeweb-matcher
210
+ - !ruby/object:Gem::Dependency
211
+ type: :development
214
212
  requirement: &id013 !ruby/object:Gem::Requirement
215
213
  none: false
216
214
  requirements:
@@ -222,8 +220,9 @@ dependencies:
222
220
  - 1
223
221
  - 4
224
222
  version: 2.1.4
225
- type: :development
226
223
  version_requirements: *id013
224
+ prerelease: false
225
+ name: delayed_job
227
226
  description: Hooks Thinking Sphinx into the Flying Sphinx service
228
227
  email: pat@freelancing-gods.com
229
228
  executables: []
@@ -261,7 +260,6 @@ files:
261
260
  - spec/specs/delayed_delta_spec.rb
262
261
  - spec/specs/flag_as_deleted_job_spec.rb
263
262
  - spec/specs/index_request_spec.rb
264
- has_rdoc: true
265
263
  homepage: https://flying-sphinx.com
266
264
  licenses: []
267
265
 
@@ -295,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
293
  requirements: []
296
294
 
297
295
  rubyforge_project:
298
- rubygems_version: 1.4.2
296
+ rubygems_version: 1.8.16
299
297
  signing_key:
300
298
  specification_version: 3
301
299
  summary: Sphinx in the Cloud