Class: Dockistrano::Registry
- Inherits:
-
Object
- Object
- Dockistrano::Registry
- Defined in:
- lib/dockistrano/registry.rb
Defined Under Namespace
Classes: RepositoryNotFoundInRegistry
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Registry
constructor
A new instance of Registry.
- #latest_id_for_image(image_name, tag) ⇒ Object
- #tags_for_image(image_name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Registry
Returns a new instance of Registry.
7 8 9 |
# File 'lib/dockistrano/registry.rb', line 7 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dockistrano/registry.rb', line 5 def name @name end |
Instance Method Details
#latest_id_for_image(image_name, tag) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/dockistrano/registry.rb', line 27 def latest_id_for_image(image_name, tag) response = get("repositories", image_name, "tags", tag) if response.kind_of?(Net::HTTPNotFound) nil else MultiJson.load(response.body) end end |
#tags_for_image(image_name) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dockistrano/registry.rb', line 14 def (image_name) result = MultiJson.load(get("repositories", image_name, "tags").body) if result["error"] if result["error"] == "Repository not found" raise RepositoryNotFoundInRegistry.new("Could not find repository #{image_name} in registry #{name}") else raise result["error"] end else result end end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/dockistrano/registry.rb', line 36 def to_s name end |