class DevDock::DevVolumes

Collection representing volumes needed for then development environment

Public Class Methods

new(image) click to toggle source
# File lib/dev_dock/volumes.rb, line 53
def initialize(image)
  @image = image
end

Public Instance Methods

create() click to toggle source

creates all desired volumes based on the configuration in the image

# File lib/dev_dock/volumes.rb, line 82
def create
  Log::debug 'DevVolumes::create'
  list.each do |volume|
    volume.create
  end
end
get(path) click to toggle source

returns the volume for the given volume path

# 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() click to toggle source

returns a list of volumes with their names and paths

# 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() click to toggle source
# File lib/dev_dock/volumes.rb, line 57
def name
  @name
end
remove() click to toggle source

purges all related volumes

# File lib/dev_dock/volumes.rb, line 90
def remove
  Log::debug 'DevVolumes::remove'
  list.each do |volume|
    volume.remove
  end
end