riddle 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -78,3 +78,4 @@ Thanks to the following people who have contributed to Riddle in some shape or f
78
78
  * Rob Anderton
79
79
  * Dylan Egan
80
80
  * Jerry Vos
81
+ * Piotr Sarnacki
data/lib/riddle/client.rb CHANGED
@@ -113,9 +113,18 @@ module Riddle
113
113
  :match_mode, :sort_mode, :sort_by, :weights, :id_range, :filters,
114
114
  :group_by, :group_function, :group_clause, :group_distinct, :cut_off,
115
115
  :retry_count, :retry_delay, :anchor, :index_weights, :rank_mode,
116
- :max_query_time, :field_weights, :timeout, :overrides, :select
116
+ :max_query_time, :field_weights, :timeout, :overrides, :select,
117
+ :connection
117
118
  attr_reader :queue
118
119
 
120
+ def self.connection=(value)
121
+ Thread.current[:riddle_connection] = value
122
+ end
123
+
124
+ def self.connection
125
+ Thread.current[:riddle_connection]
126
+ end
127
+
119
128
  # Can instantiate with a specific server and port - otherwise it assumes
120
129
  # defaults of localhost and 3312 respectively. All other settings can be
121
130
  # accessed and changed via the attribute accessors.
@@ -477,7 +486,7 @@ module Riddle
477
486
 
478
487
  def initialise_connection
479
488
  socket = initialise_socket
480
-
489
+
481
490
  # Checking version
482
491
  version = socket.recv(4).unpack('N*').first
483
492
  if version < 1
@@ -494,7 +503,13 @@ module Riddle
494
503
  def initialise_socket
495
504
  tries = 0
496
505
  begin
497
- socket = TCPSocket.new @server, @port
506
+ socket = if self.connection
507
+ self.connection.call(self)
508
+ elsif self.class.connection
509
+ self.class.connection.call(self)
510
+ else
511
+ TCPSocket.new @server, @port
512
+ end
498
513
  rescue Errno::ECONNREFUSED => e
499
514
  retry if (tries += 1) < 5
500
515
  raise Riddle::ConnectionError,
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -3951,3 +3951,234 @@
3951
3951
  [Mon Nov 16 15:05:10.592 2009] [40836] accepting connections
3952
3952
  [Mon Nov 16 15:05:11.641 2009] [40836] caught SIGTERM, shutting down
3953
3953
  [Mon Nov 16 15:05:11.651 2009] [40836] shutdown complete
3954
+ [Mon Nov 16 21:38:36.121 2009] [47463] accepting connections
3955
+ [Mon Nov 16 21:38:37.515 2009] [47463] caught SIGTERM, shutting down
3956
+ [Mon Nov 16 21:38:37.516 2009] [47463] shutdown complete
3957
+ [Mon Nov 16 21:38:37.592 2009] [47481] accepting connections
3958
+ [Mon Nov 16 21:38:38.650 2009] [47481] caught SIGTERM, shutting down
3959
+ [Mon Nov 16 21:38:38.663 2009] [47481] shutdown complete
3960
+ [Mon Nov 16 21:38:38.735 2009] [47501] accepting connections
3961
+ [Mon Nov 16 21:38:39.793 2009] [47501] caught SIGTERM, shutting down
3962
+ [Mon Nov 16 21:38:39.806 2009] [47501] shutdown complete
3963
+ [Mon Nov 16 21:38:39.878 2009] [47520] accepting connections
3964
+ [Mon Nov 16 21:38:40.930 2009] [47520] caught SIGTERM, shutting down
3965
+ [Mon Nov 16 21:38:40.941 2009] [47520] shutdown complete
3966
+ [Mon Nov 16 21:38:41.016 2009] [47536] accepting connections
3967
+ [Mon Nov 16 21:38:42.120 2009] [47536] caught SIGTERM, shutting down
3968
+ [Mon Nov 16 21:38:42.131 2009] [47536] shutdown complete
3969
+ [Mon Nov 16 21:38:42.201 2009] [47561] accepting connections
3970
+ [Mon Nov 16 21:38:43.262 2009] [47561] caught SIGTERM, shutting down
3971
+ [Mon Nov 16 21:38:43.335 2009] [47561] shutdown complete
3972
+ [Mon Nov 16 21:38:43.406 2009] [47582] accepting connections
3973
+ [Mon Nov 16 21:38:45.514 2009] [47582] caught SIGTERM, shutting down
3974
+ [Mon Nov 16 21:38:45.524 2009] [47582] shutdown complete
3975
+ [Mon Nov 16 21:38:45.601 2009] [47597] accepting connections
3976
+ [Mon Nov 16 21:38:46.655 2009] [47597] caught SIGTERM, shutting down
3977
+ [Mon Nov 16 21:38:46.666 2009] [47597] shutdown complete
3978
+ [Mon Nov 16 21:38:46.750 2009] [47612] accepting connections
3979
+ [Mon Nov 16 21:38:47.803 2009] [47612] caught SIGTERM, shutting down
3980
+ [Mon Nov 16 21:38:47.814 2009] [47612] shutdown complete
3981
+ [Mon Nov 16 21:38:47.896 2009] [47627] accepting connections
3982
+ [Mon Nov 16 21:38:48.950 2009] [47627] caught SIGTERM, shutting down
3983
+ [Mon Nov 16 21:38:48.960 2009] [47627] shutdown complete
3984
+ [Mon Nov 16 21:38:49.038 2009] [47642] accepting connections
3985
+ [Mon Nov 16 21:38:50.093 2009] [47642] caught SIGTERM, shutting down
3986
+ [Mon Nov 16 21:38:50.103 2009] [47642] shutdown complete
3987
+ [Mon Nov 16 21:38:50.181 2009] [47657] accepting connections
3988
+ [Mon Nov 16 21:38:51.229 2009] [47657] caught SIGTERM, shutting down
3989
+ [Mon Nov 16 21:38:51.241 2009] [47657] shutdown complete
3990
+ [Mon Nov 16 21:38:51.318 2009] [47672] accepting connections
3991
+ [Mon Nov 16 21:38:52.372 2009] [47672] caught SIGTERM, shutting down
3992
+ [Mon Nov 16 21:38:52.383 2009] [47672] shutdown complete
3993
+ [Mon Nov 16 21:38:52.464 2009] [47687] accepting connections
3994
+ [Mon Nov 16 21:38:53.522 2009] [47687] caught SIGTERM, shutting down
3995
+ [Mon Nov 16 21:38:53.533 2009] [47687] shutdown complete
3996
+ [Mon Nov 16 21:38:53.612 2009] [47702] accepting connections
3997
+ [Mon Nov 16 21:38:54.666 2009] [47702] caught SIGTERM, shutting down
3998
+ [Mon Nov 16 21:38:54.676 2009] [47702] shutdown complete
3999
+ [Mon Nov 16 21:38:54.762 2009] [47717] accepting connections
4000
+ [Mon Nov 16 21:38:55.812 2009] [47717] caught SIGTERM, shutting down
4001
+ [Mon Nov 16 21:38:55.823 2009] [47717] shutdown complete
4002
+ [Mon Nov 16 21:38:55.897 2009] [47732] accepting connections
4003
+ [Mon Nov 16 21:38:56.945 2009] [47732] caught SIGTERM, shutting down
4004
+ [Mon Nov 16 21:38:56.955 2009] [47732] shutdown complete
4005
+ [Mon Nov 16 21:38:57.030 2009] [47747] accepting connections
4006
+ [Mon Nov 16 21:38:58.078 2009] [47747] caught SIGTERM, shutting down
4007
+ [Mon Nov 16 21:38:58.093 2009] [47747] shutdown complete
4008
+ [Mon Nov 16 21:38:58.174 2009] [47762] accepting connections
4009
+ [Mon Nov 16 21:38:59.228 2009] [47762] caught SIGTERM, shutting down
4010
+ [Mon Nov 16 21:38:59.238 2009] [47762] shutdown complete
4011
+ [Mon Nov 16 21:42:45.518 2009] [47821] accepting connections
4012
+ [Mon Nov 16 21:42:46.638 2009] [47821] caught SIGTERM, shutting down
4013
+ [Mon Nov 16 21:42:46.648 2009] [47821] shutdown complete
4014
+ [Mon Nov 16 21:46:15.680 2009] [47865] accepting connections
4015
+ [Mon Nov 16 21:46:16.738 2009] [47865] caught SIGTERM, shutting down
4016
+ [Mon Nov 16 21:46:16.748 2009] [47865] shutdown complete
4017
+ [Mon Nov 16 21:46:16.818 2009] [47881] accepting connections
4018
+ [Mon Nov 16 21:46:17.880 2009] [47881] caught SIGTERM, shutting down
4019
+ [Mon Nov 16 21:46:17.891 2009] [47881] shutdown complete
4020
+ [Mon Nov 16 21:46:58.292 2009] [47910] accepting connections
4021
+ [Mon Nov 16 21:46:59.452 2009] [47910] caught SIGTERM, shutting down
4022
+ [Mon Nov 16 21:46:59.453 2009] [47910] shutdown complete
4023
+ [Mon Nov 16 21:46:59.532 2009] [47925] accepting connections
4024
+ [Mon Nov 16 21:47:00.598 2009] [47925] caught SIGTERM, shutting down
4025
+ [Mon Nov 16 21:47:00.599 2009] [47925] shutdown complete
4026
+ [Mon Nov 16 21:48:20.813 2009] [47949] accepting connections
4027
+ [Mon Nov 16 21:48:21.909 2009] [47949] caught SIGTERM, shutting down
4028
+ [Mon Nov 16 21:48:21.919 2009] [47949] shutdown complete
4029
+ [Mon Nov 16 21:48:21.989 2009] [47964] accepting connections
4030
+ [Mon Nov 16 21:48:23.071 2009] [47964] caught SIGTERM, shutting down
4031
+ [Mon Nov 16 21:48:23.162 2009] [47964] shutdown complete
4032
+ [Mon Nov 16 21:49:35.935 2009] [47987] accepting connections
4033
+ [Mon Nov 16 21:49:37.029 2009] [47987] caught SIGTERM, shutting down
4034
+ [Mon Nov 16 21:49:37.039 2009] [47987] shutdown complete
4035
+ [Mon Nov 16 21:49:37.108 2009] [48002] accepting connections
4036
+ [Mon Nov 16 21:49:38.173 2009] [48002] caught SIGTERM, shutting down
4037
+ [Mon Nov 16 21:49:38.183 2009] [48002] shutdown complete
4038
+ [Mon Nov 16 21:50:14.502 2009] [48026] accepting connections
4039
+ [Mon Nov 16 21:50:15.622 2009] [48026] caught SIGTERM, shutting down
4040
+ [Mon Nov 16 21:50:15.623 2009] [48026] shutdown complete
4041
+ [Mon Nov 16 21:50:15.702 2009] [48041] accepting connections
4042
+ [Mon Nov 16 21:50:16.769 2009] [48041] caught SIGTERM, shutting down
4043
+ [Mon Nov 16 21:50:16.780 2009] [48041] shutdown complete
4044
+ [Mon Nov 16 21:51:38.164 2009] [48067] accepting connections
4045
+ [Mon Nov 16 21:51:39.257 2009] [48067] caught SIGTERM, shutting down
4046
+ [Mon Nov 16 21:51:39.267 2009] [48067] shutdown complete
4047
+ [Mon Nov 16 21:51:39.337 2009] [48082] accepting connections
4048
+ [Mon Nov 16 21:51:40.402 2009] [48082] caught SIGTERM, shutting down
4049
+ [Mon Nov 16 21:51:40.403 2009] [48082] shutdown complete
4050
+ [Mon Nov 16 21:52:26.724 2009] [48111] accepting connections
4051
+ [Mon Nov 16 21:52:27.858 2009] [48111] caught SIGTERM, shutting down
4052
+ [Mon Nov 16 21:52:27.860 2009] [48111] shutdown complete
4053
+ [Mon Nov 16 21:52:27.937 2009] [48127] accepting connections
4054
+ [Mon Nov 16 21:52:29.003 2009] [48127] caught SIGTERM, shutting down
4055
+ [Mon Nov 16 21:52:29.014 2009] [48127] shutdown complete
4056
+ [Mon Nov 16 21:52:58.991 2009] [48153] accepting connections
4057
+ [Mon Nov 16 21:53:00.050 2009] [48153] caught SIGTERM, shutting down
4058
+ [Mon Nov 16 21:53:00.060 2009] [48153] shutdown complete
4059
+ [Mon Nov 16 21:53:00.133 2009] [48169] accepting connections
4060
+ [Mon Nov 16 21:53:01.193 2009] [48169] caught SIGTERM, shutting down
4061
+ [Mon Nov 16 21:53:01.194 2009] [48169] shutdown complete
4062
+ [Mon Nov 16 21:57:01.795 2009] [48222] accepting connections
4063
+ [Mon Nov 16 21:57:02.941 2009] [48222] caught SIGTERM, shutting down
4064
+ [Mon Nov 16 21:57:03.006 2009] [48222] shutdown complete
4065
+ [Mon Nov 16 21:57:03.030 2009] [48238] accepting connections
4066
+ [Mon Nov 16 21:57:04.085 2009] [48238] caught SIGTERM, shutting down
4067
+ [Mon Nov 16 21:57:04.096 2009] [48238] shutdown complete
4068
+ [Mon Nov 16 21:57:04.182 2009] [48255] accepting connections
4069
+ [Mon Nov 16 21:57:05.238 2009] [48255] caught SIGTERM, shutting down
4070
+ [Mon Nov 16 21:57:05.249 2009] [48255] shutdown complete
4071
+ [Mon Nov 16 21:57:05.332 2009] [48275] accepting connections
4072
+ [Mon Nov 16 21:57:06.389 2009] [48275] caught SIGTERM, shutting down
4073
+ [Mon Nov 16 21:57:06.399 2009] [48275] shutdown complete
4074
+ [Mon Nov 16 21:57:06.480 2009] [48294] accepting connections
4075
+ [Mon Nov 16 21:57:07.537 2009] [48294] caught SIGTERM, shutting down
4076
+ [Mon Nov 16 21:57:07.538 2009] [48294] shutdown complete
4077
+ [Mon Nov 16 21:57:07.623 2009] [48310] accepting connections
4078
+ [Mon Nov 16 21:57:08.723 2009] [48310] caught SIGTERM, shutting down
4079
+ [Mon Nov 16 21:57:08.737 2009] [48310] shutdown complete
4080
+ [Mon Nov 16 21:57:08.808 2009] [48335] accepting connections
4081
+ [Mon Nov 16 21:57:09.875 2009] [48335] caught SIGTERM, shutting down
4082
+ [Mon Nov 16 21:57:09.888 2009] [48335] shutdown complete
4083
+ [Mon Nov 16 21:57:09.960 2009] [48356] accepting connections
4084
+ [Mon Nov 16 21:57:12.065 2009] [48356] caught SIGTERM, shutting down
4085
+ [Mon Nov 16 21:57:12.075 2009] [48356] shutdown complete
4086
+ [Mon Nov 16 21:57:12.152 2009] [48371] accepting connections
4087
+ [Mon Nov 16 21:57:13.201 2009] [48371] caught SIGTERM, shutting down
4088
+ [Mon Nov 16 21:57:13.202 2009] [48371] shutdown complete
4089
+ [Mon Nov 16 21:57:13.283 2009] [48386] accepting connections
4090
+ [Mon Nov 16 21:57:14.336 2009] [48386] caught SIGTERM, shutting down
4091
+ [Mon Nov 16 21:57:14.351 2009] [48386] shutdown complete
4092
+ [Mon Nov 16 21:57:14.420 2009] [48401] accepting connections
4093
+ [Mon Nov 16 21:57:15.476 2009] [48401] caught SIGTERM, shutting down
4094
+ [Mon Nov 16 21:57:15.488 2009] [48401] shutdown complete
4095
+ [Mon Nov 16 21:57:15.568 2009] [48416] accepting connections
4096
+ [Mon Nov 16 21:57:16.612 2009] [48416] caught SIGTERM, shutting down
4097
+ [Mon Nov 16 21:57:16.622 2009] [48416] shutdown complete
4098
+ [Mon Nov 16 21:57:16.705 2009] [48431] accepting connections
4099
+ [Mon Nov 16 21:57:17.757 2009] [48431] caught SIGTERM, shutting down
4100
+ [Mon Nov 16 21:57:17.767 2009] [48431] shutdown complete
4101
+ [Mon Nov 16 21:57:17.843 2009] [48446] accepting connections
4102
+ [Mon Nov 16 21:57:18.897 2009] [48446] caught SIGTERM, shutting down
4103
+ [Mon Nov 16 21:57:18.913 2009] [48446] shutdown complete
4104
+ [Mon Nov 16 21:57:19.989 2009] [48464] accepting connections
4105
+ [Mon Nov 16 21:57:21.017 2009] [48464] caught SIGTERM, shutting down
4106
+ [Mon Nov 16 21:57:21.027 2009] [48464] shutdown complete
4107
+ [Mon Nov 16 21:57:21.097 2009] [48480] accepting connections
4108
+ [Mon Nov 16 21:57:22.147 2009] [48480] caught SIGTERM, shutting down
4109
+ [Mon Nov 16 21:57:22.157 2009] [48480] shutdown complete
4110
+ [Mon Nov 16 21:57:22.232 2009] [48495] accepting connections
4111
+ [Mon Nov 16 21:57:23.289 2009] [48495] caught SIGTERM, shutting down
4112
+ [Mon Nov 16 21:57:23.292 2009] [48495] shutdown complete
4113
+ [Mon Nov 16 21:57:23.382 2009] [48510] accepting connections
4114
+ [Mon Nov 16 21:57:24.434 2009] [48510] caught SIGTERM, shutting down
4115
+ [Mon Nov 16 21:57:24.435 2009] [48510] shutdown complete
4116
+ [Mon Nov 16 21:57:24.520 2009] [48525] accepting connections
4117
+ [Mon Nov 16 21:57:25.571 2009] [48525] caught SIGTERM, shutting down
4118
+ [Mon Nov 16 21:57:25.581 2009] [48525] shutdown complete
4119
+ [Mon Nov 16 21:57:25.659 2009] [48540] accepting connections
4120
+ [Mon Nov 16 21:57:26.712 2009] [48540] caught SIGTERM, shutting down
4121
+ [Mon Nov 16 21:57:26.728 2009] [48540] shutdown complete
4122
+ [Mon Nov 16 22:00:05.972 2009] [48701] accepting connections
4123
+ [Mon Nov 16 22:00:07.069 2009] [48701] caught SIGTERM, shutting down
4124
+ [Mon Nov 16 22:00:07.070 2009] [48701] shutdown complete
4125
+ [Mon Nov 16 22:00:07.153 2009] [48717] accepting connections
4126
+ [Mon Nov 16 22:00:08.214 2009] [48717] caught SIGTERM, shutting down
4127
+ [Mon Nov 16 22:00:08.227 2009] [48717] shutdown complete
4128
+ [Mon Nov 16 22:00:08.299 2009] [48734] accepting connections
4129
+ [Mon Nov 16 22:00:09.355 2009] [48734] caught SIGTERM, shutting down
4130
+ [Mon Nov 16 22:00:09.380 2009] [48734] shutdown complete
4131
+ [Mon Nov 16 22:00:09.782 2009] [48756] accepting connections
4132
+ [Mon Nov 16 22:00:10.840 2009] [48756] caught SIGTERM, shutting down
4133
+ [Mon Nov 16 22:00:10.850 2009] [48756] shutdown complete
4134
+ [Mon Nov 16 22:00:10.937 2009] [48775] accepting connections
4135
+ [Mon Nov 16 22:00:11.987 2009] [48775] caught SIGTERM, shutting down
4136
+ [Mon Nov 16 22:00:11.998 2009] [48775] shutdown complete
4137
+ [Mon Nov 16 22:00:12.074 2009] [48791] accepting connections
4138
+ [Mon Nov 16 22:00:13.182 2009] [48791] caught SIGTERM, shutting down
4139
+ [Mon Nov 16 22:00:13.192 2009] [48791] shutdown complete
4140
+ [Mon Nov 16 22:00:13.267 2009] [48816] accepting connections
4141
+ [Mon Nov 16 22:00:14.320 2009] [48816] caught SIGTERM, shutting down
4142
+ [Mon Nov 16 22:00:14.331 2009] [48816] shutdown complete
4143
+ [Mon Nov 16 22:00:14.411 2009] [48833] accepting connections
4144
+ [Mon Nov 16 22:00:15.521 2009] [48833] caught SIGTERM, shutting down
4145
+ [Mon Nov 16 22:00:15.534 2009] [48833] shutdown complete
4146
+ [Mon Nov 16 22:00:15.668 2009] [48854] accepting connections
4147
+ [Mon Nov 16 22:00:17.790 2009] [48854] caught SIGTERM, shutting down
4148
+ [Mon Nov 16 22:00:17.800 2009] [48854] shutdown complete
4149
+ [Mon Nov 16 22:00:17.876 2009] [48869] accepting connections
4150
+ [Mon Nov 16 22:00:18.930 2009] [48869] caught SIGTERM, shutting down
4151
+ [Mon Nov 16 22:00:18.953 2009] [48869] shutdown complete
4152
+ [Mon Nov 16 22:00:19.026 2009] [48885] accepting connections
4153
+ [Mon Nov 16 22:00:20.079 2009] [48885] caught SIGTERM, shutting down
4154
+ [Mon Nov 16 22:00:20.089 2009] [48885] shutdown complete
4155
+ [Mon Nov 16 22:00:20.178 2009] [48900] accepting connections
4156
+ [Mon Nov 16 22:00:21.231 2009] [48900] caught SIGTERM, shutting down
4157
+ [Mon Nov 16 22:00:21.242 2009] [48900] shutdown complete
4158
+ [Mon Nov 16 22:00:21.319 2009] [48915] accepting connections
4159
+ [Mon Nov 16 22:00:22.371 2009] [48915] caught SIGTERM, shutting down
4160
+ [Mon Nov 16 22:00:22.386 2009] [48915] shutdown complete
4161
+ [Mon Nov 16 22:00:22.510 2009] [48930] accepting connections
4162
+ [Mon Nov 16 22:00:23.573 2009] [48930] caught SIGTERM, shutting down
4163
+ [Mon Nov 16 22:00:23.587 2009] [48930] shutdown complete
4164
+ [Mon Nov 16 22:00:23.689 2009] [48945] accepting connections
4165
+ [Mon Nov 16 22:00:24.744 2009] [48945] caught SIGTERM, shutting down
4166
+ [Mon Nov 16 22:00:24.754 2009] [48945] shutdown complete
4167
+ [Mon Nov 16 22:00:24.831 2009] [48960] accepting connections
4168
+ [Mon Nov 16 22:00:25.882 2009] [48960] caught SIGTERM, shutting down
4169
+ [Mon Nov 16 22:00:25.894 2009] [48960] shutdown complete
4170
+ [Mon Nov 16 22:00:25.970 2009] [48975] accepting connections
4171
+ [Mon Nov 16 22:00:27.021 2009] [48975] caught SIGTERM, shutting down
4172
+ [Mon Nov 16 22:00:27.030 2009] [48975] shutdown complete
4173
+ [Mon Nov 16 22:00:27.119 2009] [48990] accepting connections
4174
+ [Mon Nov 16 22:00:28.170 2009] [48990] caught SIGTERM, shutting down
4175
+ [Mon Nov 16 22:00:28.171 2009] [48990] shutdown complete
4176
+ [Mon Nov 16 22:00:28.256 2009] [49005] accepting connections
4177
+ [Mon Nov 16 22:00:29.307 2009] [49005] caught SIGTERM, shutting down
4178
+ [Mon Nov 16 22:00:29.317 2009] [49005] shutdown complete
4179
+ [Mon Nov 16 22:00:29.407 2009] [49020] accepting connections
4180
+ [Mon Nov 16 22:00:30.460 2009] [49020] caught SIGTERM, shutting down
4181
+ [Mon Nov 16 22:00:30.471 2009] [49020] shutdown complete
4182
+ [Mon Nov 16 22:00:30.552 2009] [49035] accepting connections
4183
+ [Mon Nov 16 22:00:31.599 2009] [49035] caught SIGTERM, shutting down
4184
+ [Mon Nov 16 22:00:31.609 2009] [49035] shutdown complete
@@ -1090,3 +1090,73 @@
1090
1090
  [Mon Nov 16 15:04:55.379 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1091
1091
  [Mon Nov 16 15:04:55.382 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1092
1092
  [Mon Nov 16 15:04:55.387 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1093
+ [Mon Nov 16 21:38:37.386 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1094
+ [Mon Nov 16 21:38:37.463 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1095
+ [Mon Nov 16 21:38:37.469 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1096
+ [Mon Nov 16 21:38:42.041 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1097
+ [Mon Nov 16 21:38:42.045 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1098
+ [Mon Nov 16 21:38:42.045 2009] 0.000 sec [all/0/rel 201 (0,20)] [*] jones
1099
+ [Mon Nov 16 21:38:42.051 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1100
+ [Mon Nov 16 21:38:42.060 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1101
+ [Mon Nov 16 21:38:42.066 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1102
+ [Mon Nov 16 21:38:42.069 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1103
+ [Mon Nov 16 21:38:42.073 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1104
+ [Mon Nov 16 21:38:42.076 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1105
+ [Mon Nov 16 21:38:42.080 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1106
+ [Mon Nov 16 21:38:42.092 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] smith victoria
1107
+ [Mon Nov 16 21:38:43.225 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1108
+ [Mon Nov 16 21:38:43.230 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1109
+ [Mon Nov 16 21:38:43.233 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1110
+ [Mon Nov 16 21:38:43.237 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1111
+ [Mon Nov 16 21:42:46.554 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1112
+ [Mon Nov 16 21:42:46.571 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1113
+ [Mon Nov 16 21:42:46.588 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1114
+ [Mon Nov 16 21:46:16.708 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1115
+ [Mon Nov 16 21:46:17.845 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1116
+ [Mon Nov 16 21:46:17.851 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1117
+ [Mon Nov 16 21:50:16.727 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1118
+ [Mon Nov 16 21:50:16.738 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1119
+ [Mon Nov 16 21:51:40.359 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1120
+ [Mon Nov 16 21:51:40.370 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1121
+ [Mon Nov 16 21:52:27.750 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1122
+ [Mon Nov 16 21:52:28.961 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1123
+ [Mon Nov 16 21:52:28.972 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1124
+ [Mon Nov 16 21:53:00.017 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1125
+ [Mon Nov 16 21:53:01.159 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1126
+ [Mon Nov 16 21:53:01.165 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1127
+ [Mon Nov 16 21:57:02.913 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1128
+ [Mon Nov 16 21:57:04.057 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1129
+ [Mon Nov 16 21:57:04.062 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1130
+ [Mon Nov 16 21:57:08.649 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1131
+ [Mon Nov 16 21:57:08.653 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1132
+ [Mon Nov 16 21:57:08.653 2009] 0.000 sec [all/0/rel 201 (0,20)] [*] jones
1133
+ [Mon Nov 16 21:57:08.658 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1134
+ [Mon Nov 16 21:57:08.668 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1135
+ [Mon Nov 16 21:57:08.675 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1136
+ [Mon Nov 16 21:57:08.678 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1137
+ [Mon Nov 16 21:57:08.682 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1138
+ [Mon Nov 16 21:57:08.685 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1139
+ [Mon Nov 16 21:57:08.690 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1140
+ [Mon Nov 16 21:57:08.696 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] smith victoria
1141
+ [Mon Nov 16 21:57:09.836 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1142
+ [Mon Nov 16 21:57:09.842 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1143
+ [Mon Nov 16 21:57:09.845 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1144
+ [Mon Nov 16 21:57:09.849 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
1145
+ [Mon Nov 16 22:00:07.039 2009] 0.002 sec [all/0/rel 65 (0,20)] [*] smith
1146
+ [Mon Nov 16 22:00:08.183 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1147
+ [Mon Nov 16 22:00:08.188 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1148
+ [Mon Nov 16 22:00:13.099 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1149
+ [Mon Nov 16 22:00:13.105 2009] 0.000 sec x2 [all/0/rel 65 (0,20)] [*] smith
1150
+ [Mon Nov 16 22:00:13.105 2009] 0.000 sec x2 [all/0/rel 201 (0,20)] [*] jones
1151
+ [Mon Nov 16 22:00:13.110 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1152
+ [Mon Nov 16 22:00:13.120 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1153
+ [Mon Nov 16 22:00:13.126 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1154
+ [Mon Nov 16 22:00:13.131 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1155
+ [Mon Nov 16 22:00:13.135 2009] 0.000 sec [all/0/rel 65 (0,20)] [*] smith
1156
+ [Mon Nov 16 22:00:13.141 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1157
+ [Mon Nov 16 22:00:13.148 2009] 0.001 sec [all/0/rel 65 (0,20)] [*] smith
1158
+ [Mon Nov 16 22:00:13.152 2009] 0.000 sec [all/0/rel 1 (0,20)] [*] smith victoria
1159
+ [Mon Nov 16 22:00:15.434 2009] 0.001 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1160
+ [Mon Nov 16 22:00:15.481 2009] 0.001 sec [all/0/rel 1 (0,20)] [*] Ellie K Ford
1161
+ [Mon Nov 16 22:00:15.484 2009] 0.001 sec [all/0/rel 64 (0,20)] [*] Steele
1162
+ [Mon Nov 16 22:00:15.489 2009] 0.000 sec [all/0/rel 64 (0,20)] [*] Steele
@@ -0,0 +1,58 @@
1
+ require 'spec/spec_helper'
2
+
3
+ class RiddleSpecConnectionProcError < StandardError; end
4
+
5
+ describe "Sphinx Client" do
6
+ before :each do
7
+ @client = Riddle::Client.new("localhost", 3313)
8
+ end
9
+
10
+ after :each do
11
+ Riddle::Client.connection = nil
12
+ end
13
+
14
+ describe '.connection' do
15
+ it "should use the given block" do
16
+ Riddle::Client.connection = lambda { |client|
17
+ TCPsocket.new(client.server, client.port)
18
+ }
19
+ @client.query("smith").should be_kind_of(Hash)
20
+ end
21
+
22
+ it "should fail with errors from the given block" do
23
+ Riddle::Client.connection = lambda { |client|
24
+ raise RiddleSpecConnectionProcError
25
+ }
26
+ lambda { @client.query("smith") }.
27
+ should raise_error(RiddleSpecConnectionProcError)
28
+ end
29
+ end
30
+
31
+ describe '#connection' do
32
+ it "use the given block" do
33
+ @client.connection = lambda { |client|
34
+ TCPsocket.new(client.server, client.port)
35
+ }
36
+ @client.query("smith").should be_kind_of(Hash)
37
+ end
38
+
39
+ it "should fail with errors from the given block" do
40
+ @client.connection = lambda { |client|
41
+ raise RiddleSpecConnectionProcError
42
+ }
43
+ lambda { @client.query("smith") }.
44
+ should raise_error(RiddleSpecConnectionProcError)
45
+ end
46
+
47
+ it "should prioritise instance over class connection" do
48
+ Riddle::Client.connection = lambda { |client|
49
+ raise RiddleSpecConnectionProcError
50
+ }
51
+ @client.connection = lambda { |client|
52
+ TCPsocket.new(client.server, client.port)
53
+ }
54
+
55
+ lambda { @client.query("smith") }.should_not raise_error
56
+ end
57
+ end
58
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
@@ -138,6 +138,7 @@ test_files:
138
138
  - spec/fixtures/sql/conf.yml
139
139
  - spec/fixtures/sql/data.sql
140
140
  - spec/fixtures/sql/structure.sql
141
+ - spec/functional/connection_spec.rb
141
142
  - spec/functional/excerpt_spec.rb
142
143
  - spec/functional/keywords_spec.rb
143
144
  - spec/functional/persistance_spec.rb