gitlab-org--gitlab-foss/app/uploaders/artifact_uploader.rb

42 lines
759 B
Ruby
Raw Normal View History

2016-08-18 10:31:44 -04:00
class ArtifactUploader < GitlabUploader
storage :file
attr_accessor :build, :field
def self.artifacts_path
2015-11-22 08:27:30 -05:00
Gitlab.config.artifacts.path
end
def self.artifacts_upload_path
2015-11-22 08:27:30 -05:00
File.join(self.artifacts_path, 'tmp/uploads/')
end
def self.artifacts_cache_path
2015-11-22 08:27:30 -05:00
File.join(self.artifacts_path, 'tmp/cache/')
end
def initialize(build, field)
@build, @field = build, field
end
def store_dir
File.join(self.class.artifacts_path, @build.artifacts_path)
end
def cache_dir
File.join(self.class.artifacts_cache_path, @build.artifacts_path)
end
def file_storage?
self.class.storage == CarrierWave::Storage::File
end
def filename
file.try(:filename)
end
def exists?
file.try(:exists?)
end
end