Module: Rucola::Nib

Defined in:
lib/rucola/nib.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Classes, KeyedObjects

Class Method Summary collapse

Class Method Details

.backup(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rucola/nib.rb', line 7

def self.backup(path)
  nib = File.dirname(path)
  nib_name = File.basename(nib)
  backup = "/tmp/#{nib_name}.bak"
  unless $TESTING
    puts "\n========================================================================="
    puts "Backing up #{nib} to #{backup}"
    puts "Please retrieve that one if for some reason the nib was damaged!"
    puts "=========================================================================\n\n"
  end
  FileUtils.rm_rf(backup) if File.exists?(backup)
  FileUtils.cp_r(nib, backup)
end