Class: Wordmove::Deployer::FTP
- Defined in:
- lib/wordmove/deployer/ftp.rb
Instance Attribute Summary
Attributes inherited from Base
#environment, #logger, #options
Instance Method Summary collapse
-
#initialize(environment, options) ⇒ FTP
constructor
A new instance of FTP.
- #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) ⇒ FTP
Returns a new instance of FTP.
10 11 12 13 14 |
# File 'lib/wordmove/deployer/ftp.rb', line 10 def initialize(environment, ) super = [:ftp] @copier = Photocopier::FTP.new().tap { |c| c.logger = logger } end |
Instance Method Details
#pull_db ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/wordmove/deployer/ftp.rb', line 39 def pull_db super local_dump_path = local_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) # gsub sql adapt_sql(local_dump_path, , ) # import locally run mysql_import_command(local_dump_path, [:database]) # and locally run "rm #{local_dump_path}" end |
#push_db ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wordmove/deployer/ftp.rb', line 16 def push_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("remote-backup-#{Time.now.to_i}.sql") download_remote_db(local_backup_path) save_local_db(local_dump_path) # gsub sql adapt_sql(local_dump_path, , ) # upload it remote_put(local_dump_path, remote_dump_path) import_remote_dump # remove dump remotely remote_delete(remote_dump_path) # and locally run "rm #{local_dump_path}" end |