chef-solr 0.8.8 → 0.8.10

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.10
data/lib/chef/solr.rb CHANGED
@@ -35,7 +35,7 @@ require 'uri'
35
35
  class Chef
36
36
  class Solr
37
37
 
38
- VERSION = "0.8.8"
38
+ VERSION = "0.8.9"
39
39
 
40
40
  include Chef::Mixin::XMLEscape
41
41
 
@@ -163,6 +163,16 @@ class Chef
163
163
  if Chef::Config[:daemonize]
164
164
  Chef::Daemon.daemonize("chef-solr")
165
165
  end
166
+
167
+ # Need to redirect stdout and stderr so Java process inherits them.
168
+ # If -L wasn't specified, Chef::Config[:log_location] will be an IO
169
+ # object, otherwise it will be a String.
170
+ if Chef::Config[:log_location].kind_of?(String)
171
+ logfile = File.new(Chef::Config[:log_location], "w")
172
+ STDOUT.reopen(logfile)
173
+ STDERR.reopen(logfile)
174
+ end
175
+
166
176
  Dir.chdir(Chef::Config[:solr_jetty_path]) do
167
177
  command = "java -Xmx#{Chef::Config[:solr_heap_size]} -Xms#{Chef::Config[:solr_heap_size]}"
168
178
  command << " -Dsolr.data.dir=#{Chef::Config[:solr_data_path]}"
@@ -112,7 +112,11 @@ class Chef
112
112
  if value.kind_of?(Array)
113
113
  fields[key] = Array.new
114
114
  value.each do |v|
115
- fields[key] << v.to_s
115
+ if v.kind_of?(Hash)
116
+ flatten_and_expand(v, fields, key)
117
+ else
118
+ fields[key] << v.to_s
119
+ end
116
120
  end
117
121
  else
118
122
  fields[key] = value.to_s
@@ -125,8 +129,11 @@ class Chef
125
129
  check_value(value)
126
130
  if value.kind_of?(Array)
127
131
  value.each do |v|
128
- check_value(v)
129
- fields[key] << v.to_s unless fields[key].include?(v.to_s)
132
+ if v.kind_of?(Hash)
133
+ flatten_and_expand(v, fields, key)
134
+ else
135
+ fields[key] << v.to_s unless fields[key].include?(v.to_s)
136
+ end
130
137
  end
131
138
  else
132
139
  fields[key] << value.to_s unless fields[key].include?(value.to_s)
@@ -112,6 +112,26 @@ describe Chef::Solr::Index do
112
112
  end
113
113
  end
114
114
 
115
+ it "should call itself recursively for hashes nested in arrays" do
116
+ @index.flatten_and_expand({ :one => [ { :two => "three" }, { :four => { :five => "six" } } ] }, @fields)
117
+ {
118
+ "one_X_five" => "six",
119
+ "one_four" => "five",
120
+ "one_X" => [ "three", "five" ],
121
+ "two" => "three",
122
+ "one_four_X" => "six",
123
+ "X_four" => "five",
124
+ "X_four_five" => "six",
125
+ "one" => [ "two", "four" ],
126
+ "one_four_five" => "six",
127
+ "five" => "six",
128
+ "X_two" => "three",
129
+ "one_two" => "three"
130
+ }.each do |k, v|
131
+ @fields[k].should == v
132
+ end
133
+ end
134
+
115
135
  end
116
136
 
117
137
  describe "set_field_value" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 8
9
- version: 0.8.8
8
+ - 10
9
+ version: 0.8.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-17 00:00:00 -07:00
17
+ date: 2010-04-01 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -55,8 +55,8 @@ dependencies:
55
55
  segments:
56
56
  - 0
57
57
  - 8
58
- - 8
59
- version: 0.8.8
58
+ - 10
59
+ version: 0.8.10
60
60
  type: :runtime
61
61
  version_requirements: *id003
62
62
  description: