Class: Kontena::Cli::Stacks::YAML::FileLoader
Instance Attribute Summary
#parent, #source
Class Method Summary
collapse
Instance Method Summary
collapse
#content, #dependencies, #flat_dependencies, for, inherited, #inspect, loaders, #reader, #stack_name, #to_h, #yaml
Constructor Details
#initialize(*args) ⇒ FileLoader
Returns a new instance of FileLoader.
22
23
24
25
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 22
def initialize(*args)
super
@source = self.class.with_context(@source, @parent)
end
|
Class Method Details
.is_file?(parent) ⇒ Boolean
10
11
12
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 10
def self.is_file?(parent)
parent.is_a?(FileLoader)
end
|
.match?(source, parent = nil) ⇒ Boolean
6
7
8
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 6
def self.match?(source, parent = nil)
::File.exist?(with_context(source, parent))
end
|
.with_context(source, parent = nil) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 14
def self.with_context(source, parent = nil)
if is_file?(parent)
File.join(File.dirname(parent.source), source)
else
File.absolute_path(source)
end
end
|
Instance Method Details
#origin ⇒ Object
31
32
33
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 31
def origin
"file"
end
|
#read_content ⇒ Object
27
28
29
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 27
def read_content
::File.read(source)
end
|
#registry ⇒ Object
35
36
37
|
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/file_loader.rb', line 35
def registry
"file://"
end
|