Welcome to mirror list, hosted at ThFree Co, Russian Federation.

template_helper.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3b8e45e068843efcee0f48008f55191c9b1a795c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Gitlab
  module TemplateHelper
    include Gitlab::Utils::StrongMemoize

    def prepare_template_environment(file_path)
      return unless file_path.present?

      FileUtils.mkdir_p(File.dirname(import_upload_path))
      FileUtils.copy_entry(file_path, import_upload_path)
    end

    def import_upload_path
      strong_memoize(:import_upload_path) do
        Gitlab::ImportExport.import_upload_path(filename: tmp_filename)
      end
    end

    def tmp_filename
      SecureRandom.hex
    end
  end
end