Class: Kubes::Compiler::Strategy::Erb
- Extended by:
- Dsl::Core::Fields
- Includes:
- Dsl::Core::Helpers, Layering, Kubes::Compiler::Shared::RuntimeHelpers
- Defined in:
- lib/kubes/compiler/strategy/erb/comment.rb,
lib/kubes/compiler/strategy/erb.rb,
lib/kubes/compiler/strategy/erb/yaml_error.rb
Overview
Processes the ERB files and looks for comments like
#ERB if @testvar
- "some yaml"
#ERB end
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Erb
constructor
A new instance of Erb.
- #render_result(path) ⇒ Object
- #yaml_load(path, yaml) ⇒ Object
Methods included from Kubes::Compiler::Shared::RuntimeHelpers
#base_class_for_helper, #load_custom_helpers, #load_custom_variables, #load_plugin_helpers, #load_runtime_helpers, #show_variable_layer_path
Methods included from Util::Pretty
Methods included from Kubes::Compiler::Shared::Helpers::SecretHelper
#decode64, #encode64, #generic_secret_data, #parse_env_like_line
Methods included from Kubes::Compiler::Shared::Helpers::ExtraHelper
Methods included from Kubes::Compiler::Shared::Helpers::DockerHelper
#built_image, #built_image_helper, #docker_image
Methods included from Kubes::Compiler::Shared::Helpers::ConfigMapHelper
Methods included from Layering
#add_exts, #post_layers, #pre_layers
Methods included from Logging
Methods included from Util::SaveFile
Methods included from Util::Normalize
#extract_type, #normalize_kind
Constructor Details
#initialize(options = {}) ⇒ Erb
Returns a new instance of Erb.
10 11 12 13 14 15 |
# File 'lib/kubes/compiler/strategy/erb.rb', line 10 def initialize(={}) super # For ERB scope is in this same Strategy::Erb class # For DSL scope is within the each for the Resource classes. IE: kubes/compile/dsl/core/base.rb load_runtime_helpers end |
Instance Method Details
#render_result(path) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kubes/compiler/strategy/erb.rb', line 17 def render_result(path) return unless File.exist?(path) comment = Comment.new(path) path = comment.process if comment.process? yaml = RenderMePretty.result(path, context: self) comment.clean if comment.process? result = yaml_load(path, yaml) # in case of blank yaml doc a Boolean false is returned. else Hash or Array is returned %w[Array Hash].include?(result.class.to_s) ? result : {} end |