2017-08-17 22:00:37 +05:30
|
|
|
class ArtifactUploader < GitlabUploader
|
2015-11-26 14:37:03 +05:30
|
|
|
storage :file
|
|
|
|
|
|
|
|
attr_accessor :build, :field
|
|
|
|
|
|
|
|
def self.artifacts_path
|
|
|
|
Gitlab.config.artifacts.path
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.artifacts_upload_path
|
|
|
|
File.join(self.artifacts_path, 'tmp/uploads/')
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.artifacts_cache_path
|
|
|
|
File.join(self.artifacts_path, 'tmp/cache/')
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(build, field)
|
|
|
|
@build, @field = build, field
|
|
|
|
end
|
|
|
|
|
|
|
|
def store_dir
|
2016-01-14 18:37:52 +05:30
|
|
|
File.join(self.class.artifacts_path, @build.artifacts_path)
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def cache_dir
|
2016-01-14 18:37:52 +05:30
|
|
|
File.join(self.class.artifacts_cache_path, @build.artifacts_path)
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
def filename
|
|
|
|
file.try(:filename)
|
|
|
|
end
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|