debian-mirror-gitlab/app/uploaders/namespace_file_uploader.rb

33 lines
694 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
class NamespaceFileUploader < FileUploader
# Re-Override
def self.root
options.storage_path
end
2018-11-20 20:47:30 +05:30
def self.base_dir(model, store = nil)
base_dirs(model)[store || Store::LOCAL]
end
def self.base_dirs(model)
{
Store::LOCAL => File.join(options.base_dir, 'namespace', model_path_segment(model)),
Store::REMOTE => File.join('namespace', model_path_segment(model))
}
2018-03-17 18:26:18 +05:30
end
def self.model_path_segment(model)
File.join(model.id.to_s)
end
2018-11-20 20:47:30 +05:30
def self.workhorse_local_upload_path
File.join(options.storage_path, 'uploads', TMP_UPLOAD_PATH)
end
2018-03-17 18:26:18 +05:30
# Re-Override
def store_dir
2018-05-09 12:01:36 +05:30
store_dirs[object_store]
end
2018-03-17 18:26:18 +05:30
end