dnif 0.0.1.alpha.4 → 0.0.1.alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/dnif.gemspec +1 -1
- data/lib/dnif/configuration.rb +2 -4
- data/test/fixtures/templates/config.erb +1 -1
- data/test/unit/test_configuration.rb +3 -3
- metadata +2 -2
data/README.rdoc
CHANGED
data/dnif.gemspec
CHANGED
data/lib/dnif/configuration.rb
CHANGED
@@ -7,10 +7,8 @@ module Dnif
|
|
7
7
|
class Configuration
|
8
8
|
|
9
9
|
def self.generate(config_path)
|
10
|
-
|
11
|
-
|
12
|
-
template = Tilt.new(config_path)
|
13
|
-
output = template.render(self)
|
10
|
+
template = ERB.new(File.read(config_path))
|
11
|
+
output = template.result(binding)
|
14
12
|
|
15
13
|
# TODO turn "db/sphinx" and "config/sphinx" configurable
|
16
14
|
FileUtils.mkdir_p(File.join(Dnif.root_path, "db", "sphinx", Dnif.environment))
|
@@ -18,7 +18,7 @@ searchd {
|
|
18
18
|
source <%= name %>
|
19
19
|
{
|
20
20
|
type = xmlpipe2
|
21
|
-
xmlpipe_command = MODEL=<%= model %> rake dnif:xml --silent
|
21
|
+
xmlpipe_command = <%= (defined?(Rails) ? "RAILS_ENV" : "RACK_ENV") %>=<%= Dnif.environment %> MODEL=<%= model %> rake dnif:xml --silent
|
22
22
|
}
|
23
23
|
<% end %>
|
24
24
|
|
@@ -5,11 +5,11 @@ require 'erb'
|
|
5
5
|
class TestConfiguration < Test::Unit::TestCase
|
6
6
|
|
7
7
|
test "generate configuration from default template" do
|
8
|
-
|
8
|
+
File.expects(:read).with("config/path.erb").returns("configurations")
|
9
9
|
|
10
10
|
template = mock("Template")
|
11
|
-
template.expects(:
|
12
|
-
|
11
|
+
template.expects(:result).returns('output')
|
12
|
+
ERB.expects(:new).with("configurations").returns(template)
|
13
13
|
|
14
14
|
file = mock
|
15
15
|
file.expects(:puts).with('output')
|