module Kubes::Compiler::Shared::RuntimeHelpers
Public Instance Methods
base_class_for_helper()
click to toggle source
# File lib/kubes/compiler/shared/runtime_helpers.rb, line 36 def base_class_for_helper if self.is_a?(Kubes::Compiler::Strategy::Erb) Kubes::Compiler::Strategy::Erb else Kubes::Compiler::Dsl::Core::Base end end
load_custom_helpers()
click to toggle source
# File lib/kubes/compiler/shared/runtime_helpers.rb, line 12 def load_custom_helpers return if @@custom_helpers_loaded paths = Dir.glob("#{Kubes.root}/.kubes/helpers/**/*.rb") paths.sort_by! { |p| p.size } # so namespaces are loaded first paths.each do |path| filename = path.sub(%r{.*.kubes/helpers/},'').sub('.rb','') module_name = filename.camelize base_class_for_helper.send :include, module_name.constantize end @@custom_helpers_loaded = true end
load_custom_variables()
click to toggle source
# File lib/kubes/compiler/shared/runtime_helpers.rb, line 47 def load_custom_variables return if Kubes.kustomize? ext = File.extname(@path) role = @path.sub(%r{.*\.kubes/resources/},'').sub(ext,'').split('/').first # IE: web kind = File.basename(@path).sub(ext,'') # IE: deployment all = "all" if @block_form kind = kind.pluralize all = all.pluralize end layers = [ "base.rb", "#{Kubes.env}.rb", "base/all.rb", "base/all/#{Kubes.env}.rb", "base/#{kind}.rb", "base/#{kind}/base.rb", "base/#{kind}/#{Kubes.env}.rb", "#{role}/#{kind}.rb", "#{role}/#{kind}/base.rb", "#{role}/#{kind}/#{Kubes.env}.rb", ] layers.each do |layer| path = "#{Kubes.root}/.kubes/variables/#{layer}" evaluate_file(path) end end
load_plugin_helpers()
click to toggle source
# File lib/kubes/compiler/shared/runtime_helpers.rb, line 27 def load_plugin_helpers return if @@plugin_helpers_loaded Kubes::Plugin.plugins.each do |klass| helpers_class = "#{klass}::Helpers".constantize # IE: KubesAws::Helpers base_class_for_helper.send :include, helpers_class end @@plugin_helpers_loaded = true end
load_runtime_helpers()
click to toggle source
# File lib/kubes/compiler/shared/runtime_helpers.rb, line 5 def load_runtime_helpers load_custom_variables # also load custom variables load_plugin_helpers load_custom_helpers end