diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-23 16:57:27 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-03 12:04:49 +0100 |
commit | 871de0f18581bb03fed5c0d800f8183598a0195f (patch) | |
tree | 5b5ac2aadd2a7d58f5e4c845ee85141ee96241a3 /app/uploaders | |
parent | e2242cdf75d2734f78f694ab3191fcbb31947a6f (diff) | |
download | gitlab-ce-871de0f18581bb03fed5c0d800f8183598a0195f.tar.gz |
Rename artifacts_* to legacy_artifacts_*
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/artifact_uploader.rb | 39 | ||||
-rw-r--r-- | app/uploaders/job_artifact_uploader.rb | 18 | ||||
-rw-r--r-- | app/uploaders/legacy_artifact_uploader.rb | 33 |
3 files changed, 38 insertions, 52 deletions
diff --git a/app/uploaders/artifact_uploader.rb b/app/uploaders/artifact_uploader.rb deleted file mode 100644 index 14addb6cf14..00000000000 --- a/app/uploaders/artifact_uploader.rb +++ /dev/null @@ -1,39 +0,0 @@ -class ArtifactUploader < GitlabUploader - storage :file - - attr_reader :job, :field - - def self.local_artifacts_store - Gitlab.config.artifacts.path - end - - def self.artifacts_upload_path - File.join(self.local_artifacts_store, 'tmp/uploads/') - end - - def initialize(job, field) - @job, @field = job, field - end - - def store_dir - default_local_path - end - - def cache_dir - File.join(self.class.local_artifacts_store, 'tmp/cache') - end - - def work_dir - File.join(self.class.local_artifacts_store, 'tmp/work') - end - - private - - def default_local_path - File.join(self.class.local_artifacts_store, default_path) - end - - def default_path - File.join(job.created_at.utc.strftime('%Y_%m'), job.project_id.to_s, job.id.to_s) - end -end diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb index 8a5200504fc..d54411e198f 100644 --- a/app/uploaders/job_artifact_uploader.rb +++ b/app/uploaders/job_artifact_uploader.rb @@ -9,30 +9,22 @@ class JobArtifactUploader < GitlabUploader File.join(self.local_artifacts_store, 'tmp/uploads/') end - def initialize(artifact, _field) - @artifact = artifact - end - def size - return super if @artifact.size.nil? - - @artifact.size - end + return super if model.size.nil? - def store_dir - File.join(self.class.local_artifacts_store, default_path) + model.size end private def default_path - creation_date = @artifact.created_at.utc.strftime('%Y_%m_%d') + creation_date = model.created_at.utc.strftime('%Y_%m_%d') File.join(disk_hash[0..1], disk_hash[2..3], disk_hash, - creation_date, @artifact.job_id.to_s, @artifact.id.to_s) + creation_date, model.job_id.to_s, model.id.to_s) end def disk_hash - @disk_hash ||= Digest::SHA2.hexdigest(@artifact.project_id.to_s) + @disk_hash ||= Digest::SHA2.hexdigest(model.project_id.to_s) end end diff --git a/app/uploaders/legacy_artifact_uploader.rb b/app/uploaders/legacy_artifact_uploader.rb new file mode 100644 index 00000000000..0c23e05b680 --- /dev/null +++ b/app/uploaders/legacy_artifact_uploader.rb @@ -0,0 +1,33 @@ +class LegacyArtifactUploader < GitlabUploader + storage :file + + def self.local_store_path + Gitlab.config.artifacts.path + end + + def self.artifacts_upload_path + File.join(self.local_artifacts_store, 'tmp/uploads/') + end + + def store_dir + default_local_path + end + + def cache_dir + File.join(self.class.local_store_path, 'tmp/cache') + end + + def work_dir + File.join(self.class.local_store_path, 'tmp/work') + end + + private + + def default_local_path + File.join(self.class.local_store_path, default_path) + end + + def default_path + File.join(model.created_at.utc.strftime('%Y_%m'), model.project_id.to_s, model.id.to_s) + end +end |