lib/dockdev/context/rubygems.rb in dockdev-0.3.5 vs lib/dockdev/context/rubygems.rb in dockdev-0.3.6
- old
+ new
@@ -9,24 +9,28 @@
Rubygems.new(path)
end
def initialize(path)
@path = path
+ @mounts = {}
+ @ports = {}
end
def is_context?
find_gemfile.length > 0
end
def find_gemfile
Dir.glob(File.join(@path,"Gemfile"))
end
- def process_mount(mount_hash, dir_inside_docker = "/opt")
+ def process_mount(opts = { dir_inside_docker: "/opt" })
- if not mount_hash.nil? and mount_hash.is_a?(Hash)
+ if @mounts.empty?
+ dir_inside_docker = opts[:dir_inside_docker]
+
script = ["#!/bin/bash"]
#script << "alias be > /dev/null 2>&1 && echo 'alias be=bundle exec' >> ~/.bashrc"
script << "echo 'alias be=\"bundle exec\"' >> ~/.bashrc"
#
@@ -38,11 +42,11 @@
Bundler.load.dependencies.each do |d|
if not d.source.nil?
src = d.source
if src.path.to_s != "."
pathInsideDocker = File.join(dir_inside_docker, d.name)
- mount_hash[src.path.expand_path.to_s] = pathInsideDocker
+ @mounts[src.path.expand_path.to_s] = pathInsideDocker
script << "bundle config --global local.#{d.name} #{pathInsideDocker}"
#res[d.name] = src.path.expand_path.to_s
end
end
end
@@ -53,10 +57,15 @@
end
`chmod +x #{scriptOut}`
end
- mount_hash
+ @mounts
+
+ end
+
+ def process_port(opts = {})
+ @ports
end
end
end
end