Class: Postgresql

Inherits:
Source show all
Defined in:
lib/blanket/plugins/sources/postgresql.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

included, #method_missing, #noop

Constructor Details

#initialize(reader) ⇒ Postgresql

Returns a new instance of Postgresql.



4
5
6
# File 'lib/blanket/plugins/sources/postgresql.rb', line 4

def initialize(reader)
  @reader = reader
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Utils

Class Method Details

.attribute_symbolsObject



8
9
10
11
# File 'lib/blanket/plugins/sources/postgresql.rb', line 8

def self.attribute_symbols
  [:source_type, :host, :user, :password, :db_user, :db_host,
   :database, :dump_options, :remote_path, :local_path]
end

.default_databaseObject



37
38
39
# File 'lib/blanket/plugins/sources/postgresql.rb', line 37

def self.default_database
  "test"
end

.default_db_hostObject



33
34
35
# File 'lib/blanket/plugins/sources/postgresql.rb', line 33

def self.default_db_host
  "127.0.0.1"
end

.default_db_userObject



25
26
27
# File 'lib/blanket/plugins/sources/postgresql.rb', line 25

def self.default_db_user
  "username"
end

.default_dump_optionsObject



49
50
51
# File 'lib/blanket/plugins/sources/postgresql.rb', line 49

def self.default_dump_options
  "--format=custom"
end

.default_hostObject



17
18
19
# File 'lib/blanket/plugins/sources/postgresql.rb', line 17

def self.default_host
  "yourhost.com"
end

.default_local_pathObject



45
46
47
# File 'lib/blanket/plugins/sources/postgresql.rb', line 45

def self.default_local_path
  "/path/to/local/sql-file"
end

.default_passwordObject



29
30
31
# File 'lib/blanket/plugins/sources/postgresql.rb', line 29

def self.default_password
  "password"
end

.default_remote_pathObject



41
42
43
# File 'lib/blanket/plugins/sources/postgresql.rb', line 41

def self.default_remote_path
  "/path/to/remote/sql-file"
end

.default_source_typeObject



13
14
15
# File 'lib/blanket/plugins/sources/postgresql.rb', line 13

def self.default_source_type
  "Postgresql"
end

.default_userObject



21
22
23
# File 'lib/blanket/plugins/sources/postgresql.rb', line 21

def self.default_user
  "username"
end

Instance Method Details

#cleanup_commandObject



65
66
67
# File 'lib/blanket/plugins/sources/postgresql.rb', line 65

def cleanup_command
  noop
end

#local_backup_pathObject



57
58
59
# File 'lib/blanket/plugins/sources/postgresql.rb', line 57

def local_backup_path
  local_path
end

#prep_commandObject



61
62
63
# File 'lib/blanket/plugins/sources/postgresql.rb', line 61

def prep_command
  "pg_dump #{dump_options} -U #{db_user} -h #{db_host} #{database} > #{remote_backup_path}"
end

#remote_backup_pathObject



53
54
55
# File 'lib/blanket/plugins/sources/postgresql.rb', line 53

def remote_backup_path
  remote_path
end