mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-25 16:03:48 +00:00
21 lines
371 B
Ruby
21 lines
371 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'tmpdir'
|
|
|
|
module TmpdirHelper
|
|
def mktmpdir
|
|
@tmpdir_helper_dirs ||= []
|
|
@tmpdir_helper_dirs << Dir.mktmpdir
|
|
@tmpdir_helper_dirs.last
|
|
end
|
|
|
|
def self.included(base)
|
|
base.after do
|
|
if @tmpdir_helper_dirs
|
|
FileUtils.rm_rf(@tmpdir_helper_dirs)
|
|
@tmpdir_helper_dirs = nil
|
|
end
|
|
end
|
|
end
|
|
end
|