Module: Capistrano::Postgresql::HelperMethods

Defined in:
lib/capistrano/postgresql/helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#database_yml_fileObject



18
19
20
# File 'lib/capistrano/postgresql/helper_methods.rb', line 18

def database_yml_file
  shared_path.join('config/database.yml')
end

#pg_template(template_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/capistrano/postgresql/helper_methods.rb', line 7

def pg_template(template_name)
  config_file = "#{fetch(:pg_templates_path)}/#{template_name}"
  # If there's no customized file in your rails app template directory,
  # proceed with the default.
  unless File.exists?(config_file)
    default_config_path = "../../generators/capistrano/postgresql/templates/#{template_name}"
    config_file = File.join(File.dirname(__FILE__), default_config_path)
  end
  StringIO.new ERB.new(File.read(config_file)).result(binding)
end