Class: Wordmove::Actions::PutFile
- Inherits:
-
Object
- Object
- Wordmove::Actions::PutFile
- Extended by:
- LightService::Action
- Includes:
- Helpers
- Defined in:
- lib/wordmove/actions/put_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.
Upload a single file to the remote server.
Instance Method Summary collapse
-
#execute ⇒ LightService::Context
Action’s context.
Instance Method Details
#execute ⇒ LightService::Context
Returns Action’s context.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wordmove/actions/put_file.rb', line 21 executed do |context| command = 'put' # First argument could be a file or a content string. Do not log if the latter = if File.exist?(context.command_args.first) context.command_args.join(' ') else context.command_args.second end context.logger.task_step false, "#{command}: #{}" result = simulate?(cli_options: context.) || context.photocopier.send( command, *context.command_args ) next context if result == true # We can't trust the return from the fotocopier method when using FTP. Keep on # and have faith. next context if context.photocopier.is_a? Photocopier::FTP context.fail! "Failed to upload file: #{context.command_args.first}" end |