Module: Capistrano::Postgresql::HelperMethods

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

Instance Method Summary collapse

Instance Method Details

#archetype_database_yml_fileObject

location of archetypical database.yml file created on primary db role when user and database are first created



25
26
27
# File 'lib/capistrano/postgresql/helper_methods.rb', line 25

def archetype_database_yml_file
  deploy_path.join("db/database.yml")
end

#database_yml_fileObject

location of database.yml file on clients



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

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