module Rumination::Pg::Commands

include this module into something with sh, e.g. next to Rake::FileUtils

Public Instance Methods

create_dump(path, *args) click to toggle source
# File lib/rumination/pg/commands.rb, line 21
def create_dump path, *args
  args = Pg.config.create_dump_args + args + %W[--file=#{path}]
  sh "pg_dump #{args.join(" ")}"
end
load_dump(path, *args) click to toggle source
# File lib/rumination/pg/commands.rb, line 26
def load_dump path, *args
  args = Pg.config.load_dump_args + args
  sh "gunzip -c #{path} | psql #{args.join(" ")}"
end
pg_restore(*args) click to toggle source
# File lib/rumination/pg/commands.rb, line 13
def pg_restore *args
  Pg::Restore.call *args, "-d", ENV["PGDATABASE"]
end
rsync(*args) click to toggle source
# File lib/rumination/pg/commands.rb, line 17
def rsync *args
  sh "rsync #{args.join(" ")}"
end