Commit 72d6db8b authored by William Light's avatar William Light

Fix for caller_dir relative gems

parent 7c3f06dd
...@@ -8,17 +8,21 @@ module MRuby ...@@ -8,17 +8,21 @@ module MRuby
GemBox.path = gembox GemBox.path = gembox
instance_eval File.read(gembox) instance_eval File.read(gembox)
GemBox.path = nil
end end
def gem(gemdir, &block) def gem(gemdir, &block)
caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1])) caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
if gemdir.is_a?(Hash) if gemdir.is_a?(Hash)
gemdir = load_special_path_gem(gemdir) gemdir = load_special_path_gem(gemdir)
elsif gemdir.is_a?(String) elsif GemBox.path && gemdir.is_a?(String)
gemdir = "#{File.dirname(GemBox.path)}/#{gemdir}" gemdir = File.expand_path(gemdir, File.dirname(GemBox.path))
else else
gemdir = File.expand_path(gemdir, caller_dir) gemdir = File.expand_path(gemdir, caller_dir)
end end
gemrake = File.join(gemdir, "mrbgem.rake") gemrake = File.join(gemdir, "mrbgem.rake")
fail "Can't find #{gemrake}" unless File.exists?(gemrake) fail "Can't find #{gemrake}" unless File.exists?(gemrake)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment