mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add gembox feature
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
module MRuby
|
||||
GemBox = BasicObject.new
|
||||
class << GemBox
|
||||
def new(&block); block.call(self); end
|
||||
def config=(obj); @config = obj; end
|
||||
def gem(gemdir, &block); @config.gem(gemdir, &block); end
|
||||
end
|
||||
|
||||
module LoadGems
|
||||
def gembox(gemboxfile)
|
||||
gembox = File.absolute_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems")
|
||||
fail "Can't find gembox '#{gembox}'" unless File.exists?(gembox)
|
||||
GemBox.config = self
|
||||
instance_eval File.read(gembox)
|
||||
end
|
||||
|
||||
def gem(gemdir, &block)
|
||||
caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
|
||||
if gemdir.is_a?(Hash)
|
||||
|
||||
Reference in New Issue
Block a user