Class: Postgres
Overview
this has all of the logic to perform an entire dump of a remote postgress host
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#local_path ⇒ Object
Returns the value of attribute local_path.
-
#password ⇒ Object
Returns the value of attribute password.
-
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #get_backup ⇒ Object
-
#initialize(opts = {}) ⇒ Postgres
constructor
A new instance of Postgres.
Methods included from Utils
#delete_file, #get_age_from_key_name, #get_tempfile, #get_timstamped_key_name, #get_utc_time, #get_utc_time_from_key_name, #get_utc_timestamp, #gzip_file, #need_to_archive?, #safe_run, #ungzip_file, #verify_system_dependency
Constructor Details
#initialize(opts = {}) ⇒ Postgres
Returns a new instance of Postgres.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cryo/database/postgres.rb', line 7 def initialize(opts={}) raise "you need to specify a password" unless opts[:password] self.password = opts[:password] raise "you need to specify a host" unless opts[:host] self.host = opts[:host] raise "you need to specify a tmp path" unless opts[:tmp_path] self.tmp_path = opts[:tmp_path] self.user = opts[:user] || 'ubuntu' self.local_path = opts[:local_path] || get_tempfile verify_system_dependency 'pg_dumpall' end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/cryo/database/postgres.rb', line 5 def host @host end |
#local_path ⇒ Object
Returns the value of attribute local_path.
5 6 7 |
# File 'lib/cryo/database/postgres.rb', line 5 def local_path @local_path end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/cryo/database/postgres.rb', line 5 def password @password end |
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
5 6 7 |
# File 'lib/cryo/database/postgres.rb', line 5 def tmp_path @tmp_path end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/cryo/database/postgres.rb', line 5 def user @user end |
Instance Method Details
#get_backup ⇒ Object
19 20 21 |
# File 'lib/cryo/database/postgres.rb', line 19 def get_backup() take_dump end |