Class: KuberKit::Core::ContextHelper::BaseHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/core/context_helper/base_helper.rb

Direct Known Subclasses

ImageHelper, ServiceHelper

Constant Summary collapse

CONTRACT =
RespondTo[:get_binding]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_store:, artifact_store:, shell:) ⇒ BaseHelper

Returns a new instance of BaseHelper.



6
7
8
9
10
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 6

def initialize(image_store:, artifact_store:, shell:)
  @image_store    = image_store
  @artifact_store = artifact_store
  @shell          = shell
end

Instance Attribute Details

#artifact_store ⇒ Object (readonly)

Returns the value of attribute artifact_store.



4
5
6
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 4

def artifact_store
  @artifact_store
end

#image_store ⇒ Object (readonly)

Returns the value of attribute image_store.



4
5
6
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 4

def image_store
  @image_store
end

#shell ⇒ Object (readonly)

Returns the value of attribute shell.



4
5
6
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 4

def shell
  @shell
end

Instance Method Details

#artifact_path(name, file_name = nil) ⇒ Object



18
19
20
21
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 18

def artifact_path(name, file_name = nil)
  artifact = @artifact_store.get(name)
  [artifact.cloned_path, file_name].compact.join("/")
end

#configuration_name ⇒ Object



23
24
25
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 23

def configuration_name
  KuberKit.current_configuration.name
end

#get_binding ⇒ Object



27
28
29
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 27

def get_binding
  binding
end

#image_url(image_name) ⇒ Object



12
13
14
15
16
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 12

def image_url(image_name)
  image = @image_store.get_image(image_name)

  image.remote_registry_url
end