Class: Wordmove::Deployer::SSH
- Defined in:
- lib/wordmove/deployer/ssh.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options) ⇒ SSH
constructor
A new instance of SSH.
- #pull_db ⇒ Object
- #push_db ⇒ Object
Methods inherited from Base
deployer_for, fetch_movefile, #remote_get_directory, #remote_put_directory
Constructor Details
#initialize(options) ⇒ SSH
Returns a new instance of SSH.
7 8 9 10 11 12 |
# File 'lib/wordmove/deployer/ssh.rb', line 7 def initialize() super = [:remote][:ssh] @copier = Photocopier::SSH.new() @copier.logger = logger end |
Instance Method Details
#pull_db ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/wordmove/deployer/ssh.rb', line 34 def pull_db super local_dump_path = local_wpcontent_path("dump.sql") remote_dump_path = remote_wpcontent_path("dump.sql") # dump remote db into file remote_run mysql_dump_command([:remote][:database], remote_dump_path) # download remote dump remote_get(remote_dump_path, local_dump_path) # gsub sql adapt_sql(local_dump_path, [:remote], [:local]) # import locally run mysql_import_command(local_dump_path, [:local][:database]) # remove it remotely remote_delete(remote_dump_path) # and locally run "rm #{local_dump_path}" end |
#push_db ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wordmove/deployer/ssh.rb', line 14 def push_db super local_dump_path = local_wpcontent_path("dump.sql") remote_dump_path = remote_wpcontent_path("dump.sql") # dump local mysql into file run mysql_dump_command([:local][:database], local_dump_path) # gsub sql adapt_sql(local_dump_path, [:local], [:remote]) # upload it remote_put(local_dump_path, remote_dump_path) # import it remotely remote_run mysql_import_command(remote_dump_path, [:remote][:database]) # remove it remotely remote_delete(remote_dump_path) # and locally run "rm #{local_dump_path}" end |