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