class Capistrano::DBSync::Executor::Base

Attributes

cap[R]
config[R]
db_config[R]
session_id[R]
side[R]

Public Class Methods

new(cap, config, side) click to toggle source

side must be :local or :remote

# File lib/capistrano/db_sync/executor/base.rb, line 6
def initialize(cap, config, side)
  @cap        = cap
  @config     = config
  @session_id = Time.now.strftime("%Y-%m-%d-%H%M%S")
  @side       = side
end

Public Instance Methods

cleanup?() click to toggle source
# File lib/capistrano/db_sync/executor/base.rb, line 21
def cleanup?
  config[side][:cleanup]
end
env() click to toggle source
# File lib/capistrano/db_sync/executor/base.rb, line 17
def env
  config[side][:env].to_s
end
working_dir() click to toggle source
# File lib/capistrano/db_sync/executor/base.rb, line 13
def working_dir
  File.join config[side][:working_dir]
end

Private Instance Methods

load_db_config!(config_file_contents) click to toggle source
# File lib/capistrano/db_sync/executor/base.rb, line 27
def load_db_config!(config_file_contents)
  yaml = YAML.load(ERB.new(config_file_contents).result)
  @db_config = yaml[env].tap { |db_config| Postgres.validate!(db_config) }
end