lib/capistrano/sync.rb
def remote_database_config(db)
    remote_config = capture("cat #{current_path}/config/database.yml")
    remote_env = capture("cat #{current_path}/.env")

    database = nil
    EnvLoader.new(remote_env).with_loaded_env do
      database = YAML::load(ERB.new(remote_config).result)
    end

    return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
  end
#
# Reads the database credentials from the remote config/database.yml file
# +db+ the name of the environment to get the credentials for
# Returns username, password, database
#
Reads the database credentials from the remote config/database.yml file
+db+ the name of the environment to get the credentials for
Returns username, password, database
Reads the database credentials from the remote config / database . yml file + db + the name of the environment to get the credentials for Returns username password database
def remote_database_config(db)
    remote_config = capture("cat #{current_path}/config/database.yml")
    remote_env = capture("cat #{current_path}/.env")
    database = nil
    EnvLoader.new(remote_env).with_loaded_env do
      database = YAML::load(ERB.new(remote_config).result)
    end
    return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
  end
def remote_database_config ( db ) remote_config = capture ( "cat #{current_path}/config/database.yml" ) remote_env = capture ( "cat #{current_path}/.env" ) database = nil EnvLoader . new ( remote_env ) . with_loaded_env do database = YAML :: load ( ERB . new ( remote_config ) . result ) end return database [ "#{db}" ] [ 'username' ] , database [ "#{db}" ] [ 'password' ] , database [ "#{db}" ] [ 'database' ] , database [ "#{db}" ] [ 'host' ] end
Reads the database credentials from the remote config/database.yml file
+db+ the name of the environment to get the credentials for
Returns username, password, database
Reads the database credentials from the remote config / database . yml file + db + the name of the environment to get the credentials for Returns username password database
db