Fix for caller_dir relative gems

This commit is contained in:
William Light
2013-10-01 21:26:04 +02:00
parent 7c3f06ddd8
commit 72d6db8bc4
+6 -2
View File
@@ -8,17 +8,21 @@ module MRuby
GemBox.path = gembox
instance_eval File.read(gembox)
GemBox.path = nil
end
def gem(gemdir, &block)
caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
if gemdir.is_a?(Hash)
gemdir = load_special_path_gem(gemdir)
elsif gemdir.is_a?(String)
gemdir = "#{File.dirname(GemBox.path)}/#{gemdir}"
elsif GemBox.path && gemdir.is_a?(String)
gemdir = File.expand_path(gemdir, File.dirname(GemBox.path))
else
gemdir = File.expand_path(gemdir, caller_dir)
end
gemrake = File.join(gemdir, "mrbgem.rake")
fail "Can't find #{gemrake}" unless File.exists?(gemrake)