class DevDock::DevBind
binds are a type of mount which just map what is on the host into the container
Attributes
permissions[R]
source[R]
target[R]
Public Class Methods
new(internal_volumes, source, target, permissions)
click to toggle source
# File lib/dev_dock/binds.rb, line 11 def initialize(internal_volumes, source, target, permissions) @internal_volumes = internal_volumes @source = source @target = target @permissions = permissions end
Public Instance Methods
create()
click to toggle source
# File lib/dev_dock/binds.rb, line 22 def create if not exist? if not File.directory?(@source) FileUtils.mkdir_p(File.dirname(@source)) FileUtils.touch(@source) else FileUtils.mkdir_p(@source) end end end
exist?()
click to toggle source
# File lib/dev_dock/binds.rb, line 18 def exist? File.exist?(@source) end
host_path()
click to toggle source
# File lib/dev_dock/binds.rb, line 33 def host_path if @internal_volumes internal, host = parent_volume # just need to take out the part of the path which is internal, and # replace it with the host volume. relative = @source.slice(internal.length, @source.length) if relative.length == 0 host else File.join(host, relative) end else @source end end
parent_volume()
click to toggle source
# File lib/dev_dock/binds.rb, line 49 def parent_volume @internal_volumes.find { |internal, host| @source.index(internal) == 0 } end
to_argument()
click to toggle source
# File lib/dev_dock/binds.rb, line 53 def to_argument [host_path, @target, @permissions].compact.join(':') end