module Comandante::Cleaner

Extended Modules

Defined in:

comandante/cleaner.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.debug #

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


[View source]
def self.debug=(debug) #

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


[View source]
def self.exit_on_pipe_error #

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


[View source]
def self.exit_on_pipe_error=(exit_on_pipe_error) #

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


[View source]
def self.failure_behavior #

The desired failure_behavior, see FailureMode


[View source]
def self.failure_behavior=(failure_behavior) #

The desired failure_behavior, see FailureMode


[View source]
def self.verbose #

[View source]
def self.verbose=(verbose) #

[View source]

Instance Method Detail

def 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]
def 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]
def exit_success(msg : String = "", status = 0) : Nil #

Will exit with a message. Will run cleanup first.


[View source]
def 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]
def 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]
def 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]
def tempdir(name = File.tempname, &) : Nil #

Create a tempdir that will be removed on exit from block


[View source]
def tempfile : File #

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


[View source]
def tempfile(&) : Nil #

Create a tempfile that will be removed on exit from block


[View source]