Class: Kontena::Plugin::Shell::PromptLoader
- Inherits:
-
Cli::Stacks::YAML::StackFileLoader
- Object
- Cli::Stacks::YAML::StackFileLoader
- Kontena::Plugin::Shell::PromptLoader
- Defined in:
- lib/kontena/plugin/shell/prompt_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.match?(source, parent = nil) ⇒ Boolean
7 8 9 |
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 7 def self.match?(source, parent = nil) source.end_with?('kontena.yml') && !Kontena::Cli::Stacks::YAML::FileLoader.match?(source, parent) end |
Instance Method Details
#origin ⇒ Object
17 18 19 |
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 17 def origin "prompt" end |
#read_content ⇒ Object
11 12 13 14 15 |
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 11 def read_content content = Kontena.prompt.multiline("Enter or paste a stack YAML").join raise "Invalid stack YAML" unless YAML.safe_load(content).kind_of?(Hash) content end |
#registry ⇒ Object
21 22 23 |
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 21 def registry "prompt" end |