summaryrefslogtreecommitdiff
path: root/app/models/ci/artifact_blob.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-02 17:42:37 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-04 08:50:12 -0500
commit0f58eb6bde35009b69ef871534d9ff80fc38bbf7 (patch)
tree0a5065d9fc05822a81a9379f5a6a64f8105f9503 /app/models/ci/artifact_blob.rb
parent4faa65d8381f3e1e45bdf3a9bc9785b588891b66 (diff)
downloadgitlab-ce-0f58eb6bde35009b69ef871534d9ff80fc38bbf7.tar.gz
Add artifact file page that uses the blob viewerdm-artifact-blob-viewer
Diffstat (limited to 'app/models/ci/artifact_blob.rb')
-rw-r--r--app/models/ci/artifact_blob.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/models/ci/artifact_blob.rb b/app/models/ci/artifact_blob.rb
new file mode 100644
index 00000000000..b35febc9ac5
--- /dev/null
+++ b/app/models/ci/artifact_blob.rb
@@ -0,0 +1,35 @@
+module Ci
+ class ArtifactBlob
+ include BlobLike
+
+ attr_reader :entry
+
+ def initialize(entry)
+ @entry = entry
+ end
+
+ delegate :name, :path, to: :entry
+
+ def id
+ Digest::SHA1.hexdigest(path)
+ end
+
+ def size
+ entry.metadata[:size]
+ end
+
+ def data
+ "Build artifact #{path}"
+ end
+
+ def mode
+ entry.metadata[:mode]
+ end
+
+ def external_storage
+ :build_artifact
+ end
+
+ alias_method :external_size, :size
+ end
+end