diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-10-01 16:52:07 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-10-01 16:52:07 -0700 |
| commit | 34cdc21c57244d26a4249aa940e29d12b74a578a (patch) | |
| tree | 6d03cb105413bcaf54309fd4dfae9035b10a18ba | |
| parent | e06a0e39f8bad9c4f2b6f52d8b70345ca63d1d7d (diff) | |
| parent | 72d6db8bc417ef966c5dff16b6baa885140c96dc (diff) | |
| download | mruby-34cdc21c57244d26a4249aa940e29d12b74a578a.tar.gz mruby-34cdc21c57244d26a4249aa940e29d12b74a578a.zip | |
Merge pull request #1523 from wrl/relative-gembox-nokeyword
Implement gembox-relative gemdir paths
| -rw-r--r-- | tasks/mrbgem_spec.rake | 2 | ||||
| -rw-r--r-- | tasks/mruby_build_gem.rake | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake index 94f24af26..70c44ed5e 100644 --- a/tasks/mrbgem_spec.rake +++ b/tasks/mrbgem_spec.rake @@ -297,6 +297,8 @@ module MRuby GemBox = Object.new class << GemBox + attr_accessor :path + def new(&block); block.call(self); end def config=(obj); @config = obj; end def gem(gemdir, &block); @config.gem(gemdir, &block); end diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake index 39be984ad..ea1307132 100644 --- a/tasks/mruby_build_gem.rake +++ b/tasks/mruby_build_gem.rake @@ -3,17 +3,26 @@ module MRuby def gembox(gemboxfile) gembox = File.expand_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems") fail "Can't find gembox '#{gembox}'" unless File.exists?(gembox) + GemBox.config = self + 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 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) |
