Class: Wordmove::Organizers::Ssh::Pull

Inherits:
Object
  • Object
show all
Extended by:
LightService::Organizer
Includes:
Actions::Helpers, Actions::Ssh::Helpers
Defined in:
lib/wordmove/organizers/ssh/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/ssh/pull.rb', line 32

def self.actions
  [
    Wordmove::Actions::RunBeforePullHook,
    Wordmove::Actions::FilterAndSetupTasksToRun,
    reduce_if(
      lambda(&:wordpress_task),
      [Wordmove::Actions::Ssh::PullWordpress]
    ),
    iterate(:folder_tasks, [Wordmove::Actions::Ssh::GetDirectory]),
    reduce_if(lambda(&:database_task),
              [
                Wordmove::Actions::SetupContextForDb,
                Wordmove::Actions::BackupLocalDb,
                Wordmove::Actions::Ssh::DownloadRemoteDb,
                Wordmove::Actions::AdaptRemoteDb,
                Wordmove::Actions::Ssh::CleanupAfterAdapt
              ]),
    Wordmove::Actions::RunAfterPullHook
  ]
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/ssh/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]
  ssh_opts = ssh_options(remote_options:, simulate: cli_options[:simulate])

  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::SSH
                  .new(ssh_opts)
                  .tap { |c| c.logger = logger }
  ).reduce(actions)
end