Module: Bcpm::Cleanup

Defined in:
lib/bcpm/cleanup.rb

Overview

Cleans up all the messes left behind by bcpm crashes.

Class Method Summary collapse

Class Method Details

.runObject

Cleans up all the messes left behind by bcpm crashes.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bcpm/cleanup.rb', line 9

def self.run
  Bcpm::Player.list.each do |player|
    Bcpm::Player.uninstall player if /^bcpmtest/ =~ player
  end
      
  temp_path = File.join(Dir.tmpdir, 'bcpm')
  return unless File.exist?(temp_path)
  Dir.entries(temp_path).each do |entry|
    next if ['.', '..'].include? entry
    path = File.join temp_path, entry
    FileUtils.rm_rf path if File.directory? path
  end
end