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

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

Direct Known Subclasses

ImageHelper, ServiceHelper

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractHelper

#get_binding

Constructor Details

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

Returns a new instance of BaseHelper.



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

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

Instance Attribute Details

#artifact_storeObject (readonly)

Returns the value of attribute artifact_store.



2
3
4
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 2

def artifact_store
  @artifact_store
end

#env_file_readerObject (readonly)

Returns the value of attribute env_file_reader.



2
3
4
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 2

def env_file_reader
  @env_file_reader
end

#image_storeObject (readonly)

Returns the value of attribute image_store.



2
3
4
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 2

def image_store
  @image_store
end

#shellObject (readonly)

Returns the value of attribute shell.



2
3
4
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 2

def shell
  @shell
end

Instance Method Details

#artifact_path(name, file_name = nil) ⇒ Object



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

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

#configuration_nameObject



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

def configuration_name
  KuberKit.current_configuration.name
end

#env_file(env_file_name) ⇒ Object



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

def env_file(env_file_name)
  @env_file_reader.call(@shell, env_file_name)
end

#global_build_argsObject



34
35
36
37
38
39
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 34

def global_build_args
  unless KuberKit.deprecation_warnings_disabled?
    puts "DEPRECATION: global_build_args is deprecated, please use global_build_vars instead"
  end
  global_build_vars
end

#global_build_varsObject



30
31
32
# File 'lib/kuber_kit/core/context_helper/base_helper.rb', line 30

def global_build_vars
  KuberKit.global_build_vars
end

#image_url(image_name) ⇒ Object



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

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

  image.remote_registry_url
end