Module: Bovem::ShellMethods::Execute
- Included in:
- Bovem::Shell
- Defined in:
- lib/bovem/shell.rb
Overview
Methods to run commands or delete entries.
Instance Method Summary collapse
-
#delete(*files, run: true, show_errors: false, fatal_errors: true) ⇒ Boolean
Deletes a list of files.
-
#run(command, message = nil, run: true, show_exit: true, show_output: false, show_command: false, fatal_errors: true) ⇒ Hash
Runs a command into the shell.
Instance Method Details
#delete(*files, run: true, show_errors: false, fatal_errors: true) ⇒ Boolean
Deletes a list of files.
330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/bovem/shell.rb', line 330 def delete(*files, run: true, show_errors: false, fatal_errors: true) rv = true files = files.ensure_array(no_duplicates: true, compact: true, flatten: true) { |f| File.(f.ensure_string) } if !run show_dry_delete(files) else rv = perform_delete(files, show_errors, fatal_errors) end rv end |
#run(command, message = nil, run: true, show_exit: true, show_output: false, show_command: false, fatal_errors: true) ⇒ Hash
Runs a command into the shell.
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/bovem/shell.rb', line 305 def run(command, = nil, run: true, show_exit: true, show_output: false, show_command: false, fatal_errors: true) rv = {status: 0, output: ""} command = command.ensure_string # Show the command @console.begin() if .present? if !run # Print a message show_dry_run(command, show_exit) else # Run rv = execute_command(command, show_command, show_output) end # Return handle_command_exit(rv, show_exit, fatal_errors) rv end |