Class: Kontena::Plugin::Shell::PromptLoader

Inherits:
Cli::Stacks::YAML::StackFileLoader
  • Object
show all
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

Returns:

  • (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

#originObject



17
18
19
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 17

def origin
  "prompt"
end

#read_contentObject



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

#registryObject



21
22
23
# File 'lib/kontena/plugin/shell/prompt_loader.rb', line 21

def registry
  "prompt"
end