Class: Wordmove::Actions::DeleteLocalFile
- Inherits:
-
Object
- Object
- Wordmove::Actions::DeleteLocalFile
- Extended by:
- LightService::Action
- Includes:
- Helpers
- Defined in:
- lib/wordmove/actions/delete_local_file.rb
Overview
Note:
This action is not meant to be organized, but as a standalone one.
Delete a local file situated at the given path. Command won’t be run if --simulate flag is present on CLI.
Class Method Summary collapse
-
.execute ⇒ LightService::Context
Action’s context.
Class Method Details
.execute ⇒ LightService::Context
Returns Action’s context.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wordmove/actions/delete_local_file.rb', line 20 executed do |context| context.logger.task_step true, "delete: '#{context.file_path}'" next context if simulate?(cli_options: context.) unless File.exist?(context.file_path) context.logger.info "File #{context.file_path} does not exist. Nothing done." next context end File.delete(context.file_path) end |