2018-10-06 23:10:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-05-09 19:14:46 +00:00
|
|
|
module ContainerRegistry
|
2016-05-04 12:22:54 +00:00
|
|
|
class Registry
|
2016-05-09 19:27:06 +00:00
|
|
|
attr_reader :uri, :client, :path
|
2016-05-04 12:22:54 +00:00
|
|
|
|
|
|
|
def initialize(uri, options = {})
|
2016-05-17 14:41:47 +00:00
|
|
|
@uri = uri
|
|
|
|
@path = options[:path] || default_path
|
2016-05-09 19:14:46 +00:00
|
|
|
@client = ContainerRegistry::Client.new(uri, options)
|
2016-05-04 12:22:54 +00:00
|
|
|
end
|
|
|
|
|
2016-05-17 14:41:47 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def default_path
|
2018-01-27 05:35:53 +00:00
|
|
|
@uri.sub(%r{^https?://}, '')
|
2016-05-17 14:41:47 +00:00
|
|
|
end
|
2016-05-04 12:22:54 +00:00
|
|
|
end
|
|
|
|
end
|