Module: Backup::CLI::Helpers

Defined in:
lib/backup/cli.rb

Overview

This is to avoid Thor’s warnings when stubbing methods on the Thor class.

Class Method Summary collapse

Class Method Details

.exec!(cmd) ⇒ Object



355
356
357
358
# File 'lib/backup/cli.rb', line 355

def exec!(cmd)
  puts "Launching: #{ cmd }"
  exec(cmd)
end

.overwrite?(path) ⇒ Boolean

Returns:

  • (Boolean)


347
348
349
350
351
352
353
# File 'lib/backup/cli.rb', line 347

def overwrite?(path)
  return true unless File.exist?(path)

  $stderr.print "A file already exists at '#{ path }'.\n" +
                "Do you want to overwrite? [y/n] "
  /^[Yy]/ =~ $stdin.gets
end