Sha256: 216840c8f3445b9df040caa6c366df39688655f74f87a8ad03f18b1386419043

Contents?: true

Size: 1.92 KB

Versions: 8

Compression:

Stored size: 1.92 KB

Contents

module Wordmove
  module Actions
    module Ssh
      # Syncs wordpress folder (usually root folder), exluding +wp-content/+ folder, over SSH
      # protocol from the remote server to local host
      class PullWordpress
        extend ::LightService::Action
        include Wordmove::Actions::Helpers
        include WordpressDirectory::RemoteHelperMethods

        expects :remote_options,
                :local_options,
                :logger,
                :photocopier

        # @!method execute
        # @param remote_options [Hash] Remote host options fetched from
        #        movefile (with symbolized keys)
        # @param local_options [Hash] Local host options fetched from
        #        movefile (with symbolized keys)
        # @param logger [Wordmove::Logger]
        # @param photocopier [Photocopier::SSH]
        # @!scope class
        # @return [LightService::Context] Action's context
        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
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wordmove-6.0.0.alpha.8 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.7 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.6 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.5 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.4 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.3 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.2 lib/wordmove/actions/ssh/pull_wordpress.rb
wordmove-6.0.0.alpha.1 lib/wordmove/actions/ssh/pull_wordpress.rb