Class: Ci::ArtifactBlob

Inherits:
Object
  • Object
show all
Includes:
BlobLike
Defined in:
app/models/ci/artifact_blob.rb

Constant Summary

Constants included from Gitlab::BlobHelper

Gitlab::BlobHelper::MEGABYTE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BlobLike

#binary_in_repo?, #load_all_data!, #name, #path, #truncated?

Methods included from Gitlab::BlobHelper

#_mime_type, #binary_in_repo?, #binary_mime_type?, #content_type, #empty?, #encoded_newlines_re, #encoding, #extname, #image?, #known_extension?, #large?, #lines, #mime_type, #ruby_encoding, #text_in_repo?, #viewable?

Constructor Details

#initialize(entry) ⇒ ArtifactBlob

Returns a new instance of ArtifactBlob.



9
10
11
# File 'app/models/ci/artifact_blob.rb', line 9

def initialize(entry)
  @entry = entry
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



7
8
9
# File 'app/models/ci/artifact_blob.rb', line 7

def entry
  @entry
end

Instance Method Details

#dataObject



25
26
27
# File 'app/models/ci/artifact_blob.rb', line 25

def data
  "Build artifact #{path}"
end

#external_link?(job) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/ci/artifact_blob.rb', line 41

def external_link?(job)
  pages_url_builder(job.project).artifact_url_available?(entry, job)
end

#external_storageObject



33
34
35
# File 'app/models/ci/artifact_blob.rb', line 33

def external_storage
  :build_artifact
end

#external_url(job) ⇒ Object



37
38
39
# File 'app/models/ci/artifact_blob.rb', line 37

def external_url(job)
  pages_url_builder(job.project).artifact_url(entry, job)
end

#idObject



15
16
17
# File 'app/models/ci/artifact_blob.rb', line 15

def id
  Digest::SHA1.hexdigest(path)
end

#modeObject



29
30
31
# File 'app/models/ci/artifact_blob.rb', line 29

def mode
  entry.[:mode]
end

#sizeObject Also known as: external_size



19
20
21
22
# File 'app/models/ci/artifact_blob.rb', line 19

def size
  # Old versions of Workhorse omit the size if the file is 0 bytes
  entry..fetch(:size, 0)
end