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
359 360 361 362 |
# File 'lib/backup/cli.rb', line 359 def exec!(cmd) puts "Launching: #{cmd}" exec(cmd) end |
.is_backup_error?(error) ⇒ Boolean
364 365 366 |
# File 'lib/backup/cli.rb', line 364 def is_backup_error?(error) error.class.ancestors.include? Backup::Error end |
.overwrite?(path) ⇒ Boolean
351 352 353 354 355 356 357 |
# File 'lib/backup/cli.rb', line 351 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 |