Class: Wordmove::Organizers::Ssh::Push

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

def self.actions
  [
    Wordmove::Actions::RunBeforePushHook,
    Wordmove::Actions::FilterAndSetupTasksToRun,
    reduce_if(
      lambda(&:wordpress_task),
      [Wordmove::Actions::Ssh::PushWordpress]
    ),
    iterate(:folder_tasks, [Wordmove::Actions::Ssh::PutDirectory]),
    reduce_if(lambda(&:database_task),
              [
                Wordmove::Actions::SetupContextForDb,
                Wordmove::Actions::Ssh::DownloadRemoteDb,
                Wordmove::Actions::Ssh::BackupRemoteDb,
                Wordmove::Actions::AdaptLocalDb,
                Wordmove::Actions::Ssh::PutAndImportDumpRemotely,
                Wordmove::Actions::Ssh::CleanupAfterAdapt
              ]),
    Wordmove::Actions::RunAfterPushHook
  ]
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/push.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: :push),
    logger:,
    photocopier: Photocopier::SSH
                  .new(ssh_opts)
                  .tap { |c| c.logger = logger }
  ).reduce(actions)
end