Class: Yogi::ErrorOut

Inherits:
Object
  • Object
show all
Defined in:
lib/yogi.rb

Instance Method Summary collapse

Instance Method Details

#undoObject



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/yogi.rb', line 263

def undo
  #undo changes originaly made.
  Dir.foreach('.git/.backupFiles') do |item|
    next if item == '.' or item == '..'
  FileUtils.cp_r ".git/.backupFiles/"+ item, "./"
  # puts item
    end
  #removes folder backupFiles
  FileUtils.rm_r '.git/.backupFiles' if File.exist?('.git/.backupFiles')
  FileUtils.rm_r '.git/.ignoreme.json' if File.exist?('.git/.ignoreme.json')
  FileUtils.rm_r '.git/.ignoremefile.txt' if File.exist?('.git/.ignoremefile.txt')
  puts " Hope You had fun and try it again later."
  if OS.mac?
    file = File.join(__dir__, 'sound', 'Giving-up.mp3')
    escfile = Shellwords.escape(file)
    cmd = "afplay #{escfile}"
    system cmd
  # elsif OS.linux?
  #   file = File.join(__dir__, 'sound', 'Giving-up.mp3')
  #   escfile = Shellwords.escape(file)
  #   cmd = "aplay #{escfile}"
  #   system cmd
  end
end