Class: DC::Image
- Inherits:
-
Object
- Object
- DC::Image
- Defined in:
- lib/dc.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(name, directory: name) ⇒ Image
constructor
A new instance of Image.
- #tag(tag) ⇒ Object
Constructor Details
#initialize(name, directory: name) ⇒ Image
Returns a new instance of Image.
162 163 164 165 166 |
# File 'lib/dc.rb', line 162 def initialize name, directory: name @name = name @directory = directory self.class[name] = self end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
168 169 170 |
# File 'lib/dc.rb', line 168 def name @name end |
Class Method Details
.[](name) ⇒ Object
153 154 155 |
# File 'lib/dc.rb', line 153 def [] name all[name] end |
.[]=(name, image) ⇒ Object
157 158 159 |
# File 'lib/dc.rb', line 157 def []= name, image all[name] = image end |
.all ⇒ Object
149 150 151 |
# File 'lib/dc.rb', line 149 def all @all ||= {} end |
Instance Method Details
#build ⇒ Object
174 175 176 177 178 179 180 181 |
# File 'lib/dc.rb', line 174 def build build_parent_image_if_available image = Docker::Image.build_from_dir @directory do |json| puts JSON.parse json end image.tag repo: @name image end |
#exist? ⇒ Boolean
170 171 172 |
# File 'lib/dc.rb', line 170 def exist? Docker::Image.exist? @name end |
#tag(tag) ⇒ Object
183 184 185 |
# File 'lib/dc.rb', line 183 def tag tag Docker::Image.get(@name).tag repo: @name, tag: tag end |