summaryrefslogtreecommitdiffhomepage
path: root/tasks/mruby_build_gem.rake
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2013-04-27 16:48:52 +0800
committerDaniel Bovensiepen <[email protected]>2013-04-27 16:48:52 +0800
commit607811c0dc9dbc698475e932ca49f02c1fc97fff (patch)
tree467d561420cda3cf67f354854281f1ac419c95e0 /tasks/mruby_build_gem.rake
parentecd87aa5458f4d5c56dc1d2814975beed6b22dfc (diff)
downloadmruby-607811c0dc9dbc698475e932ca49f02c1fc97fff.tar.gz
mruby-607811c0dc9dbc698475e932ca49f02c1fc97fff.zip
Add gembox feature
Diffstat (limited to 'tasks/mruby_build_gem.rake')
-rw-r--r--tasks/mruby_build_gem.rake14
1 files changed, 14 insertions, 0 deletions
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index 358df1612..29c158c22 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -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)