Class: Wordmove::Actions::Ssh::PullWordpress

Inherits:
Object
  • Object
show all
Extended by:
LightService::Action
Includes:
Helpers, WordpressDirectory::RemoteHelperMethods
Defined in:
lib/wordmove/actions/ssh/pull_wordpress.rb

Overview

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

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::SSH)

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
51
52
# File 'lib/wordmove/actions/ssh/pull_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 = remote_wp_content_dir(
    remote_options: context.remote_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::Ssh::GetDirectory.execute(
    photocopier: context.photocopier,
    logger: context.logger,
    command_args: [remote_path, local_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