Module: ActiveGroonga::Railties::Configurable

Defined in:
lib/active_groonga/railties/configurable.rb

Instance Method Summary collapse

Instance Method Details

#groonga_configurationsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/active_groonga/railties/configurable.rb', line 21

def groonga_configurations
  groonga_yml = paths["config/groonga"].first
  unless File.exist?(groonga_yml)
    groonga_yml_example = "#{groonga_yml}.example"
    if File.exist?(groonga_yml_example)
      FileUtils.cp(groonga_yml_example, groonga_yml)
    else
      File.open(groonga_yml, "w") do |yml|
        yml.puts("development:\n  database: db/groonga/development/db\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  database: db/groonga/test/db\n\nproduction:\n  database: db/groonga/production/db\n        EOC\n      end\n    end\n  end\n  YAML.load(ERB.new(IO.read(groonga_yml)).result)\nend\n")