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.
4 5 6 7 8 |
# File 'lib/wordmove/deployer/ssh.rb', line 4 def initialize(environment, ) super = [:ssh] @copier = Photocopier::SSH.new().tap { |c| c.logger = logger } end |
Instance Method Details
#pull_db ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/wordmove/deployer/ssh.rb', line 27 def pull_db super local_dump_path = local_wp_content_dir.path("dump.sql") local_gzipped_dump_path = local_dump_path + '.gz' local_backup_path = local_wp_content_dir.path("local-backup-#{Time.now.to_i}.sql") save_local_db(local_backup_path) run compress_command(local_backup_path) download_remote_db(local_gzipped_dump_path) run uncompress_command(local_gzipped_dump_path) adapt_sql(local_dump_path, , ) run mysql_import_command(local_dump_path, [:database]) local_delete(local_dump_path) end |
#push_db ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wordmove/deployer/ssh.rb', line 10 def push_db super local_dump_path = local_wp_content_dir.path("dump.sql") local_gzipped_dump_path = local_dump_path + '.gz' local_gzipped_backup_path = local_wp_content_dir .path("#{environment}-backup-#{Time.now.to_i}.sql.gz") download_remote_db(local_gzipped_backup_path) save_local_db(local_dump_path) adapt_sql(local_dump_path, , ) run compress_command(local_dump_path) import_remote_dump(local_gzipped_dump_path) local_delete(local_gzipped_dump_path) end |