Class: Pgclone::Restore

Inherits:
Object
  • Object
show all
Defined in:
lib/pgclone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Restore

Returns a new instance of Restore.



23
24
25
26
27
28
29
# File 'lib/pgclone.rb', line 23

def initialize(opts={})
  @appname = opts[:appname] || config(:appname)
  @owner = opts[:owner] || config(:owner)
  @local_db = opts[:local_db] || config(:local_db)
  @file = opts[:file] || config(:file) || 'latest.dump'
  raise_missing_keys!
end

Instance Attribute Details

#appnameObject

Returns the value of attribute appname.



22
23
24
# File 'lib/pgclone.rb', line 22

def appname
  @appname
end

#fileObject

Returns the value of attribute file.



22
23
24
# File 'lib/pgclone.rb', line 22

def file
  @file
end

#local_dbObject

Returns the value of attribute local_db.



22
23
24
# File 'lib/pgclone.rb', line 22

def local_db
  @local_db
end

#ownerObject

Returns the value of attribute owner.



22
23
24
# File 'lib/pgclone.rb', line 22

def owner
  @owner
end

Instance Method Details

#config(key) ⇒ Object



31
32
33
# File 'lib/pgclone.rb', line 31

def config(key)
  Pgclone.configuration.send(key)
end

#go!Object



35
36
37
38
39
# File 'lib/pgclone.rb', line 35

def go!
  capture_backup
  grab_dump
  restore_db
end