Class: ArtifactUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Defined in:
app/uploaders/artifact_uploader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, field) ⇒ ArtifactUploader

Returns a new instance of ArtifactUploader


19
20
21
# File 'app/uploaders/artifact_uploader.rb', line 19

def initialize(build, field)
  @build, @field = build, field
end

Instance Attribute Details

#buildObject

Returns the value of attribute build


5
6
7
# File 'app/uploaders/artifact_uploader.rb', line 5

def build
  @build
end

#fieldObject

Returns the value of attribute field


5
6
7
# File 'app/uploaders/artifact_uploader.rb', line 5

def field
  @field
end

Class Method Details

.artifacts_cache_pathObject


15
16
17
# File 'app/uploaders/artifact_uploader.rb', line 15

def self.artifacts_cache_path
  File.join(self.artifacts_path, 'tmp/cache/')
end

.artifacts_pathObject


7
8
9
# File 'app/uploaders/artifact_uploader.rb', line 7

def self.artifacts_path
  Gitlab.config.artifacts.path
end

.artifacts_upload_pathObject


11
12
13
# File 'app/uploaders/artifact_uploader.rb', line 11

def self.artifacts_upload_path
  File.join(self.artifacts_path, 'tmp/uploads/')
end

Instance Method Details

#cache_dirObject


27
28
29
# File 'app/uploaders/artifact_uploader.rb', line 27

def cache_dir
  File.join(self.class.artifacts_cache_path, @build.artifacts_path)
end

#exists?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'app/uploaders/artifact_uploader.rb', line 39

def exists?
  file.try(:exists?)
end

#file_storage?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'app/uploaders/artifact_uploader.rb', line 31

def file_storage?
  self.class.storage == CarrierWave::Storage::File
end

#filenameObject


35
36
37
# File 'app/uploaders/artifact_uploader.rb', line 35

def filename
  file.try(:filename)
end

#move_to_cacheObject


43
44
45
# File 'app/uploaders/artifact_uploader.rb', line 43

def move_to_cache
  true
end

#move_to_storeObject


47
48
49
# File 'app/uploaders/artifact_uploader.rb', line 47

def move_to_store
  true
end

#store_dirObject


23
24
25
# File 'app/uploaders/artifact_uploader.rb', line 23

def store_dir
  File.join(self.class.artifacts_path, @build.artifacts_path)
end