Module: FilesInMyDiff::TmpDir::FileStrategy

Defined in:
lib/files_in_my_diff/tmp_dir/file_strategy.rb

Class Method Summary collapse

Class Method Details

.dir_exists?(folder) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/files_in_my_diff/tmp_dir/file_strategy.rb', line 6

def self.dir_exists?(folder)
  Dir.exist?(folder)
end

.mkdir_p(path) ⇒ Object



16
17
18
19
20
# File 'lib/files_in_my_diff/tmp_dir/file_strategy.rb', line 16

def self.mkdir_p(path)
  FileUtils.mkdir_p(path)
rescue SystemCallError => e
  raise DirectoryError, "Failed to create tmp dir for #{path}: #{e.message}"
end

.revision_dir(sha) ⇒ Object



22
23
24
# File 'lib/files_in_my_diff/tmp_dir/file_strategy.rb', line 22

def self.revision_dir(sha)
  RevisionDir.new(sha:)
end

.tmpdirObject



10
11
12
13
14
# File 'lib/files_in_my_diff/tmp_dir/file_strategy.rb', line 10

def self.tmpdir
  Dir.tmpdir
rescue StandardError => e
  raise DirectoryError, "Failed to locate tmpdir: #{e.message}"
end