Class: Wordmove::Actions::Ftp::PushWordpress

Inherits:
Object
  • Object
show all
Extended by:
LightService::Action
Includes:
Helpers, WordpressDirectory::LocalHelperMethods
Defined in:
lib/wordmove/actions/ftp/push_wordpress.rb

Overview

Syncs wordpress folder (usually root folder), exluding wp-content/ folder, over FTP protocol from local host to the remote server

Class Method Summary collapse

Class Method Details

.executeLightService::Context

Returns Action’s context.

Parameters:

  • remote_options (Hash)

    Remote host options fetched from movefile (with symbolized keys)

  • local_options (Hash)

    Local host options fetched from movefile (with symbolized keys)

  • logger (Wordmove::Logger)
  • photocopier (Photocopier::FTP)

Returns:

  • (LightService::Context)

    Action’s context



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/wordmove/actions/ftp/push_wordpress.rb', line 25

executed do |context|
  local_path = context.local_options[:wordpress_path]

  remote_path = context.remote_options[:wordpress_path]

  wp_content_relative_path = local_wp_content_dir(
    local_options: context.local_options
  ).relative_path

  exclude_wp_content = exclude_dir_contents(path: wp_content_relative_path)

  exclude_paths = paths_to_exclude(
    remote_options: context.remote_options
  ).push(exclude_wp_content)

  result = Wordmove::Actions::Ftp::PutDirectory.execute(
    photocopier: context.photocopier,
    logger: context.logger,
    command_args: [local_path, remote_path, exclude_paths],
    folder_task: :wordpress,
    local_options: context.local_options,
    remote_options: context.remote_options,
    cli_options: context.cli_options
  )
  context.fail!(result.message) if result.failure?
end