Class: Avm::Tools::Runner::Files::Rotate

Inherits:
EacRubyUtils::Console::DocoptRunner
  • Object
show all
Includes:
EacRubyUtils::Console::Speaker
Defined in:
lib/avm/tools/runner/files/rotate.rb

Constant Summary collapse

DOC =
<<~DOCOPT
  Rotates a file (Like a backup).

  Usage:
    __PROGRAM__ [options] <path>
    __PROGRAM__ -h | --help

  Options:
    -h --help                 Show this screen.
    -L --space-limit=<space>  Limit by <space> the space used by rotated files.
DOCOPT

Instance Method Summary collapse

Instance Method Details

#rotateObject



31
32
33
34
35
36
# File 'lib/avm/tools/runner/files/rotate.rb', line 31

def rotate
  @rotate ||= ::Avm::Files::Rotate.new(
    options.fetch('<path>'),
    space_limit: options.fetch('--space-limit')
  )
end

#runObject



26
27
28
29
# File 'lib/avm/tools/runner/files/rotate.rb', line 26

def run
  error_message = rotate.run
  fatal_error(error_message) if error_message
end