Method: Masamune::Actions::Postgres#postgres

Defined in:
lib/masamune/actions/postgres.rb

#postgres(opts = {}, &block) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/masamune/actions/postgres.rb', line 33

def postgres(opts = {}, &block)
  opts = opts.to_hash.symbolize_keys
  opts[:block] = block.to_proc if block_given?

  command = Masamune::Commands::Postgres.new(environment, opts)
  command = Masamune::Commands::RetryWithBackoff.new(command, configuration.commands.postgres.slice(:max_retries, :backoff).merge(opts))
  command = Masamune::Commands::Shell.new(command, opts)

  command.interactive? ? command.replace : command.execute
end