Module: Kustomize
- Defined in:
- lib/kustomize.rb,
lib/kustomize/emitter.rb,
lib/kustomize/session.rb,
lib/kustomize/version.rb,
lib/kustomize/transform.rb,
lib/kustomize/target_spec.rb,
lib/kustomize/json_6902_patch.rb,
lib/kustomize/plugin_registry.rb,
lib/kustomize/pathname_refinements.rb
Defined Under Namespace
Modules: Json6902Patch, PathnameRefinements
Classes: Emitter, GeneratorPlugin, Plugin, PluginManager, PluginRegistry, Session, TargetSpec, Transform, TransformerPlugin
Constant Summary
collapse
- VERSION =
"0.1.18"
Class Method Summary
collapse
Class Method Details
.load(rel_path_or_rc, session: Kustomize::Session.new, source_path: nil) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/kustomize.rb', line 12
def self.load(rel_path_or_rc, session: Kustomize::Session.new, source_path: nil)
base_emitter =
case rel_path_or_rc
when String, Pathname
load_path(rel_path_or_rc, session: session)
when Hash
load_doc(rel_path_or_rc, session: session, source_path: source_path)
else
raise ArgumentError, "must be a kustomization document or a path to one, instead got: #{rel_path_or_rc.inspect}"
end
Kustomize::Emitter::FinalizerEmitter.new(base_emitter, session: session)
end
|
.load_doc(rc, session: Kustomize::Session.new, source_path:) ⇒ Object
.load_path(rel_path, session: Kustomize::Session.new) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/kustomize.rb', line 31
def self.load_path(rel_path, session: Kustomize::Session.new)
rel_path = Pathname.new(rel_path.to_s) unless rel_path.kind_of?(Pathname)
unless rel_path.exist?
raise Errno::ENOENT, rel_path.to_s
end
abs_path = rel_path.expand_path
if abs_path.file?
Kustomize::Emitter::FileEmitter.new(abs_path, session: session)
elsif abs_path.directory?
Kustomize::Emitter::DirectoryEmitter.new(abs_path, session: session)
else
raise Errno::EFTYPE, rel_path.to_s
end
end
|