Class: Kontena::Cli::Stacks::YAML::UriLoader

Inherits:
StackFileLoader show all
Defined in:
lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb

Instance Attribute Summary

Attributes inherited from StackFileLoader

#parent, #source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StackFileLoader

#content, #dependencies, #flat_dependencies, for, inherited, #initialize, #inspect, loaders, #reader, #stack_name, #to_h, #yaml

Constructor Details

This class inherits a constructor from Kontena::Cli::Stacks::YAML::StackFileLoader

Class Method Details

.match?(source, parent = nil) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb', line 4

def self.match?(source, parent = nil)
  source.include?('://') && !FileLoader.match?(source, parent)
end

Instance Method Details

#originObject



14
15
16
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb', line 14

def origin
  "uri"
end

#read_contentObject



8
9
10
11
12
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb', line 8

def read_content
  require 'open-uri'
  stream = open(source)
  stream.read
end

#registryObject



18
19
20
# File 'lib/kontena/cli/stacks/yaml/stack_file_loader/uri_loader.rb', line 18

def registry
  "file://"
end