DrMark-thinking-sphinx 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/thinking_sphinx.rb
CHANGED
@@ -83,6 +83,17 @@ module ThinkingSphinx
|
|
83
83
|
include ThinkingSphinx::ActiveRecord::AttributeUpdates
|
84
84
|
|
85
85
|
index
|
86
|
+
|
87
|
+
# We want to make sure that if the database doesn't exist, then Thinking
|
88
|
+
# Sphinx doesn't mind when running non-TS tasks (like db:create, db:drop
|
89
|
+
# and db:migrate). It's a bit hacky, but I can't think of a better way.
|
90
|
+
rescue StandardError => err
|
91
|
+
case err.class.name
|
92
|
+
when "Mysql::Error", "Java::JavaSql::SQLException", "ActiveRecord::StatementInvalid"
|
93
|
+
return
|
94
|
+
else
|
95
|
+
raise err
|
96
|
+
end
|
86
97
|
end
|
87
98
|
alias_method :sphinx_index, :define_index
|
88
99
|
|
@@ -30,19 +30,6 @@ module ThinkingSphinx
|
|
30
30
|
@sources = []
|
31
31
|
@options = {}
|
32
32
|
@delta_object = nil
|
33
|
-
|
34
|
-
# add_internal_attributes_and_facets
|
35
|
-
|
36
|
-
# We want to make sure that if the database doesn't exist, then Thinking
|
37
|
-
# Sphinx doesn't mind when running non-TS tasks (like db:create, db:drop
|
38
|
-
# and db:migrate). It's a bit hacky, but I can't think of a better way.
|
39
|
-
rescue StandardError => err
|
40
|
-
case err.class.name
|
41
|
-
when "Mysql::Error", "Java::JavaSql::SQLException", "ActiveRecord::StatementInvalid"
|
42
|
-
return
|
43
|
-
else
|
44
|
-
raise err
|
45
|
-
end
|
46
33
|
end
|
47
34
|
|
48
35
|
def fields
|
@@ -14,7 +14,7 @@ module ThinkingSphinx
|
|
14
14
|
#
|
15
15
|
class Builder
|
16
16
|
instance_methods.grep(/^[^_]/).each { |method|
|
17
|
-
next if method == "instance_eval"
|
17
|
+
next if method.to_s == "instance_eval"
|
18
18
|
define_method(method) {
|
19
19
|
caller.grep(/irb.completion/).empty? ? method_missing(method) : super
|
20
20
|
}
|
@@ -92,6 +92,22 @@ describe "ThinkingSphinx::ActiveRecord" do
|
|
92
92
|
it "should return the new index" do
|
93
93
|
TestModule::TestModel.define_index.should == @index
|
94
94
|
end
|
95
|
+
|
96
|
+
it "should die quietly if there is a database error" do
|
97
|
+
ThinkingSphinx::Index::Builder.stub_method_to_raise(:generate => Mysql::Error)
|
98
|
+
|
99
|
+
lambda {
|
100
|
+
TestModule::TestModel.define_index
|
101
|
+
}.should_not raise_error
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should die noisily if there is a non-database error" do
|
105
|
+
ThinkingSphinx::Index::Builder.stub_method_to_raise(:generate => StandardError)
|
106
|
+
|
107
|
+
lambda {
|
108
|
+
TestModule::TestModel.define_index
|
109
|
+
}.should raise_error
|
110
|
+
end
|
95
111
|
end
|
96
112
|
|
97
113
|
describe "index methods" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: DrMark-thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|