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, logger, #pull_wordpress, #push_wordpress, #remote_get_directory, #remote_put_directory
Constructor Details
#initialize(environment, options) ⇒ FTP
Returns a new instance of FTP.
4 5 6 7 8 |
# File 'lib/wordmove/deployer/ftp.rb', line 4 def initialize(environment, ) super(environment, ) = [:ftp] @copier = Photocopier::FTP.new().tap { |c| c.logger = logger } end |
Instance Method Details
#pull_db ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/wordmove/deployer/ftp.rb', line 35 def pull_db super return true if simulate? 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 if [:debug] logger.debug "Remote dump located at: #{local_dump_path}" else local_delete(local_dump_path) end end |
#push_db ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wordmove/deployer/ftp.rb', line 10 def push_db super return true if simulate? 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 local_delete(local_dump_path) end |