module Comandante::Cleaner

Extended modules

Comandante::Cleaner

Class methods

.debug

Debug Mode, you can use an action to set this with a global --debug option

View source

.debug=(debug)

Debug Mode, you can use an action to set this with a global --debug option

View source

.exit_on_pipe_error

Exit on pipe error, sometimes you to exit on pipe errors

View source

.exit_on_pipe_error=(exit_on_pipe_error)

Exit on pipe error, sometimes you to exit on pipe errors

View source

.failure_behavior

The desired failure_behavior, see FailureMode

View source

.failure_behavior=(failure_behavior)

The desired failure_behavior, see FailureMode

View source

.verbose

View source

.verbose=(verbose)

View source

Methods

#cleanup : Nil

Runs cleanup manually before end of block or from outside it. will run user cleanup procs first, then remove any tempfiles or tempdirs.

View source

#exit_failure(msg : String, status = 1) : Nil

Will exit or raise exception with a message in accordance with failure_behavior. Will run cleanup first.

View source

#exit_success(msg : String = "", status = 0) : Nil

Will exit with a message. Will run cleanup first.

View source

#register(proc : SimpleProc) : Nil

Register a cleanup proc to be executed on exit from Cleanup::run block.

Example:

register ->{ my_cleaner; puts "cleanup done!" }
View source

#run : Nil

Runs a block with cleanup afterwards. You should wrap your app.run inside

Examples:

Cleaner.run do
  app.run
end

Will capture exceptions and run user cleanup function at end of block.

View source

#tempdir(name = File.tempname) : Dir

Create a tempdir that will be removed on exit as long as you are running inside a run block

View source

#tempdir(name = File.tempname, &) : Nil

Create a tempdir that will be removed on exit from block

View source

#tempfile : File

Create a tempfile that will be removed on exit as long as you are running inside a run block

View source

#tempfile : Nil

Create a tempfile that will be removed on exit from block

View source