Class: KuberKit::Core::ImageDefinition
- Defined in:
- lib/kuber_kit/core/image_definition.rb
Instance Attribute Summary collapse
-
#after_build_callback ⇒ Object
readonly
Returns the value of attribute after_build_callback.
-
#before_build_callback ⇒ Object
readonly
Returns the value of attribute before_build_callback.
-
#build_context_dir ⇒ Object
readonly
Returns the value of attribute build_context_dir.
-
#build_vars(value = nil, &block) ⇒ Object
readonly
Returns the value of attribute build_vars.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#dockerfile_path ⇒ Object
readonly
Returns the value of attribute dockerfile_path.
-
#image_name ⇒ Object
readonly
Returns the value of attribute image_name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#registry_name ⇒ Object
readonly
Returns the value of attribute registry_name.
-
#tag(value = nil, &block) ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #after_build(lambda_arg = nil, &block) ⇒ Object
- #before_build(lambda_arg = nil, &block) ⇒ Object
- #build_args(value = nil, &block) ⇒ Object
- #build_context(value = nil, &block) ⇒ Object
- #depends_on(*value, &block) ⇒ Object
- #dockerfile(value = nil, &block) ⇒ Object
-
#initialize(image_name, image_dir) ⇒ ImageDefinition
constructor
A new instance of ImageDefinition.
- #registry(value = nil, &block) ⇒ Object
- #to_image_attrs ⇒ Object
Constructor Details
#initialize(image_name, image_dir) ⇒ ImageDefinition
Returns a new instance of ImageDefinition.
8 9 10 11 12 |
# File 'lib/kuber_kit/core/image_definition.rb', line 8 def initialize(image_name, image_dir) @image_name = image_name.to_sym @image_dir = image_dir @dependencies = [] end |
Instance Attribute Details
#after_build_callback ⇒ Object (readonly)
Returns the value of attribute after_build_callback.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def after_build_callback @after_build_callback end |
#before_build_callback ⇒ Object (readonly)
Returns the value of attribute before_build_callback.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def before_build_callback @before_build_callback end |
#build_context_dir ⇒ Object (readonly)
Returns the value of attribute build_context_dir.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def build_context_dir @build_context_dir end |
#build_vars(value = nil, &block) ⇒ Object (readonly)
Returns the value of attribute build_vars.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def build_vars @build_vars end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def dependencies @dependencies end |
#dockerfile_path ⇒ Object (readonly)
Returns the value of attribute dockerfile_path.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def dockerfile_path @dockerfile_path end |
#image_name ⇒ Object (readonly)
Returns the value of attribute image_name.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def image_name @image_name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def path @path end |
#registry_name ⇒ Object (readonly)
Returns the value of attribute registry_name.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def registry_name @registry_name end |
#tag(value = nil, &block) ⇒ Object (readonly)
Returns the value of attribute tag.
2 3 4 |
# File 'lib/kuber_kit/core/image_definition.rb', line 2 def tag @tag end |
Instance Method Details
#after_build(lambda_arg = nil, &block) ⇒ Object
77 78 79 80 81 |
# File 'lib/kuber_kit/core/image_definition.rb', line 77 def after_build(lambda_arg = nil, &block) @after_build_callback = lambda_arg || block self end |
#before_build(lambda_arg = nil, &block) ⇒ Object
71 72 73 74 75 |
# File 'lib/kuber_kit/core/image_definition.rb', line 71 def before_build(lambda_arg = nil, &block) @before_build_callback = lambda_arg || block self end |
#build_args(value = nil, &block) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/kuber_kit/core/image_definition.rb', line 46 def build_args(value = nil, &block) unless KuberKit.deprecation_warnings_disabled? puts "WARNING: build_args is deprecated, please use build_vars instead" end build_vars(value, *block) end |
#build_context(value = nil, &block) ⇒ Object
59 60 61 62 63 |
# File 'lib/kuber_kit/core/image_definition.rb', line 59 def build_context(value = nil, &block) @build_context_dir = block_given? ? block : value self end |
#depends_on(*value, &block) ⇒ Object
29 30 31 32 |
# File 'lib/kuber_kit/core/image_definition.rb', line 29 def depends_on(*value, &block) @dependencies = Array(value).flatten self end |
#dockerfile(value = nil, &block) ⇒ Object
40 41 42 43 44 |
# File 'lib/kuber_kit/core/image_definition.rb', line 40 def dockerfile(value = nil, &block) @dockerfile_path = block_given? ? block : value self end |
#registry(value = nil, &block) ⇒ Object
34 35 36 37 38 |
# File 'lib/kuber_kit/core/image_definition.rb', line 34 def registry(value = nil, &block) @registry_name = block_given? ? block : value self end |
#to_image_attrs ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kuber_kit/core/image_definition.rb', line 14 def to_image_attrs OpenStruct.new( name: @image_name, dir: @image_dir, dependencies: @dependencies, registry_name: get_value(@registry_name), dockerfile_path: get_value(@dockerfile_path), build_vars: get_value(@build_vars), build_context_dir: get_value(@build_context_dir), tag: get_value(@tag), before_build_callback: @before_build_callback, after_build_callback: @after_build_callback ) end |