Class: DevDock::DevVolumes

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_dock/volumes.rb

Overview

Collection representing volumes needed for then development environment

Instance Method Summary collapse

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

#createObject

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

#listObject

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

#nameObject



57
58
59
# File 'lib/dev_dock/volumes.rb', line 57

def name
	@name
end

#removeObject

purges all related volumes



90
91
92
93
94
95
# File 'lib/dev_dock/volumes.rb', line 90

def remove
	puts 'DevVolumes::remove'
	list.each do |volume|
		volume.remove
	end
end