Method: Dbsync::Sync#initialize
- Defined in:
- lib/dbsync/sync.rb
#initialize(ssh_config, db_config, options = {}) ⇒ Sync
Returns a new instance of Sync.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dbsync/sync.rb', line 13 def initialize(ssh_config, db_config, ={}) ssh_config = symbolize_keys(ssh_config) db_config = symbolize_keys(db_config) @verbose = !![:verbose] @db_username = db_config[:username] @db_password = db_config[:password] @db_host = db_config[:host] @db_database = db_config[:database] @remote = ssh_config[:remote] @local = File.(ssh_config[:local]) if ssh_config[:local] if !@remote $stdout.puts "DEPRECATED: The remote_host, remote_dir, and filename " \ "options will be removed. " \ "Instead, combine remote_host, remote_dir, and filename into a " \ "single 'remote' configuration. Example: " \ "'{ remote: \"[email protected]:~/dbuser/yourdb.dump\" }'" remote_host = ssh_config[:remote_host] remote_dir = ssh_config[:remote_dir] filename = ssh_config[:filename] @remote = "#{remote_host}:#{File.join(remote_dir, filename)}" end if !@local $stdout.puts "DEPRECATED: The local_dir and filename " \ "options will be removed. " \ "Instead, combine local_dir and filename into a " \ "single 'local' configuration. Example: " \ "'{ local: \"../dbsync/yourdb.dump\" }'" local_dir = ssh_config[:local_dir] filename = ssh_config[:filename] @local = File.(File.join(local_dir, filename)) end end |