Class: Wordmove::Actions::GetFile

Inherits:
Object
  • Object
show all
Extended by:
LightService::Action
Includes:
Helpers
Defined in:
lib/wordmove/actions/get_file.rb

Overview

Note:

The remote server is already configured inside the Photocopier object

Note:

This action is not meant to be organized, but as a standalone one.

Download a single file from the remote server.

Class Method Summary collapse

Class Method Details

.executeLightService::Context

Returns Action’s context.

Parameters:

  • photocopier (Photocopier::SSH|Photocopier::FTP)
  • logger (Wordmove::Logger)
  • cli_options (Hash)

    Command line options (with symbolized keys)

  • command_args ((String) remote file path, (String) local file path)

Returns:

  • (LightService::Context)

    Action’s context



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wordmove/actions/get_file.rb', line 23

executed do |context|
  command = 'get'

  context.logger.task_step false, "#{command}: #{context.command_args.join(' ')}"

  next context if simulate?(cli_options: context.cli_options)

  result = context.photocopier.send(command, *context.command_args)

  next context if result == true

  context.fail! "Failed to download file: #{context.command_args.first}"
end