Class: Wordmove::Deployer::SSH
- Defined in:
- lib/wordmove/deployer/ssh.rb
Instance Attribute Summary
Attributes inherited from Base
#environment, #logger, #options
Instance Method Summary collapse
-
#initialize(environment, options) ⇒ SSH
constructor
A new instance of SSH.
- #pull_db ⇒ Object
- #push_db ⇒ Object
Methods inherited from Base
current_dir, deployer_for, #exclude_dir_contents, extract_available_envs, fetch_movefile, last_dir?, logger, #pull_wordpress, #push_wordpress, #remote_get_directory, #remote_put_directory, upper_dir
Constructor Details
#initialize(environment, options) ⇒ SSH
Returns a new instance of SSH.
7 8 9 10 11 |
# File 'lib/wordmove/deployer/ssh.rb', line 7 def initialize(environment, ) super = [:ssh] @copier = Photocopier::SSH.new().tap { |c| c.logger = logger } end |
Instance Method Details
#pull_db ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/wordmove/deployer/ssh.rb', line 26 def pull_db super local_dump_path = local_wp_content_dir.path("dump.sql") remote_dump_path = remote_wp_content_dir.path("dump.sql") local_backup_path = local_wp_content_dir.path("local-backup-#{Time.now.to_i}.sql") save_local_db(local_backup_path) download_remote_db(local_dump_path) adapt_sql(local_dump_path, , ) run mysql_import_command(local_dump_path, [:database]) run "rm #{local_dump_path}" end |
#push_db ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wordmove/deployer/ssh.rb', line 13 def push_db super local_dump_path = local_wp_content_dir.path("dump.sql") local_backup_path = local_wp_content_dir.path("#{environment}-backup-#{Time.now.to_i}.sql") download_remote_db(local_backup_path) save_local_db(local_dump_path) adapt_sql(local_dump_path, , ) import_remote_dump(local_dump_path) run "rm #{local_dump_path}" end |