Class: DevDock::DevVolumes
- Inherits:
-
Object
- Object
- DevDock::DevVolumes
- Defined in:
- lib/dev_dock/volumes.rb
Overview
Collection representing volumes needed for then development environment
Instance Method Summary collapse
-
#create ⇒ Object
creates all desired volumes based on the configuration in the image.
-
#get(path) ⇒ Object
returns the volume for the given volume path.
-
#initialize(image) ⇒ DevVolumes
constructor
A new instance of DevVolumes.
-
#list ⇒ Object
returns a list of volumes with their names and paths.
- #name ⇒ Object
-
#remove ⇒ Object
purges all related volumes.
Constructor Details
#initialize(image) ⇒ DevVolumes
Returns a new instance of DevVolumes.
53 54 55 |
# File 'lib/dev_dock/volumes.rb', line 53 def initialize(image) @image = image end |
Instance Method Details
#create ⇒ Object
creates all desired volumes based on the configuration in the image
82 83 84 85 86 87 |
# File 'lib/dev_dock/volumes.rb', line 82 def create Log::debug 'DevVolumes::create' list.each do |volume| volume.create end end |
#get(path) ⇒ Object
returns the volume for the given volume path
73 74 75 76 77 78 79 |
# File 'lib/dev_dock/volumes.rb', line 73 def get(path) if ! @image.container_config['Volumes'].keys.includes? path nil else DevVolume.new(@image.name, path) end end |
#list ⇒ Object
returns a list of volumes with their names and paths
62 63 64 65 66 67 68 69 70 |
# File 'lib/dev_dock/volumes.rb', line 62 def list if @image.container_config['Volumes'].nil? [] else @image.container_config['Volumes'].keys.map do |path| DevVolume.new(@image.name, path) end end end |
#name ⇒ Object
57 58 59 |
# File 'lib/dev_dock/volumes.rb', line 57 def name @name end |