Sha256: 86a168a0653d95d1fec21cf700e83ceea87a99b003139cc8f4902377e1f4906d

Contents?: true

Size: 1.92 KB

Versions: 8

Compression:

Stored size: 1.92 KB

Contents

module Wordmove
  module Actions
    module Ftp
      # Syncs wordpress folder (usually root folder), exluding +wp-content/+ folder, over FTP
      # 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::FTP]
        # @!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::Ftp::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/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.7 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.6 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.5 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.4 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.3 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.2 lib/wordmove/actions/ftp/pull_wordpress.rb
wordmove-6.0.0.alpha.1 lib/wordmove/actions/ftp/pull_wordpress.rb