Class: Wordmove::Organizers::Ftp::Pull

Inherits:
Object
  • Object
show all
Extended by:
LightService::Organizer
Includes:
Actions::Ftp::Helpers, Actions::Helpers
Defined in:
lib/wordmove/organizers/ftp/pull.rb

Class Method Summary collapse

Class Method Details

.actionsObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/wordmove/organizers/ftp/pull.rb', line 32

def self.actions
  [
    Wordmove::Actions::RunBeforePullHook, # Will fail and warn the user
    Wordmove::Actions::FilterAndSetupTasksToRun,
    reduce_if(
      lambda(&:wordpress_task),
      [Wordmove::Actions::Ftp::PullWordpress]
    ),
    iterate(:folder_tasks, [Wordmove::Actions::Ftp::GetDirectory]),
    reduce_if(lambda(&:database_task),
              [
                Wordmove::Actions::SetupContextForDb,
                Wordmove::Actions::BackupLocalDb,
                Wordmove::Actions::Ftp::DownloadRemoteDb,
                Wordmove::Actions::AdaptRemoteDb,
                Wordmove::Actions::Ftp::CleanupAfterAdapt
              ]),
    Wordmove::Actions::RunAfterPullHook # Will fail and warn the user
  ]
end

.call(cli_options, movefile) ⇒ Object

Can’t use keyword arguments since LightService still has some problems with modern ruby syntax: github.com/adomokos/light-service/pull/224



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wordmove/organizers/ftp/pull.rb', line 11

def self.call(cli_options, movefile)
  logger = Logger.new($stdout, movefile.secrets).tap { |l| l.level = Logger::DEBUG }
  remote_options = movefile.options[movefile.environment]
  ftp_opts = ftp_options(remote_options:)

  LightService::Configuration.logger = ::Logger.new($stdout) if cli_options[:debug]

  with(
    cli_options:,
    global_options: movefile.options[:global],
    local_options: movefile.options[:local],
    remote_options:,
    movefile:,
    guardian: Wordmove::Guardian.new(cli_options:, action: :pull),
    logger:,
    photocopier: Photocopier::FTP
                  .new(ftp_opts)
                  .tap { |c| c.logger = logger }
  ).reduce(actions)
end