Module: Gonzui::TemporaryDirectoryUtil

Included in:
AbstractAptGet, AbstractExtractor, HTTPFetcher
Defined in:
lib/gonzui/util.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#temporary_directoryObject (readonly)

Returns the value of attribute temporary_directory.



395
396
397
# File 'lib/gonzui/util.rb', line 395

def temporary_directory
  @temporary_directory
end

Instance Method Details

#clean_temporary_directoryObject



404
405
406
407
# File 'lib/gonzui/util.rb', line 404

def clean_temporary_directory
  raise "temporary directory not set" if temporary_directory.nil?
  FileUtils.rm_rff(temporary_directory)
end

#prepare_temporary_directoryObject



397
398
399
400
401
402
# File 'lib/gonzui/util.rb', line 397

def prepare_temporary_directory
  raise "temporary directory not set" if temporary_directory.nil?
  raise "#{temporary_directory}: exists" if 
    File.any_exist?(temporary_directory)
  File.mkpath(temporary_directory)
end

#set_temporary_directory(directory) ⇒ Object



409
410
411
412
# File 'lib/gonzui/util.rb', line 409

def set_temporary_directory(directory)
  base_name = ["gonzui", "tmp", Process.pid, self.object_id].join(".")
  @temporary_directory = File.join(directory, base_name)
end