diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-07-20 19:25:10 -0400 |
---|---|---|
committer | Francisco Javier López <fjlopez@gitlab.com> | 2018-07-20 19:25:10 -0400 |
commit | 38eab74483e728018a129c36d4064313f5d152f6 (patch) | |
tree | f946438bc3085b175fe20e08ebf0773cfbfdb782 /lib/gitlab/template_helper.rb | |
parent | 334ee10727540c8e16d47075781564fd21e8a9cb (diff) | |
download | gitlab-ce-38eab74483e728018a129c36d4064313f5d152f6.tar.gz |
EE Port
Diffstat (limited to 'lib/gitlab/template_helper.rb')
-rw-r--r-- | lib/gitlab/template_helper.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/template_helper.rb b/lib/gitlab/template_helper.rb new file mode 100644 index 00000000000..6b4972d5f13 --- /dev/null +++ b/lib/gitlab/template_helper.rb @@ -0,0 +1,20 @@ +module Gitlab + module TemplateHelper + 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 |