summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2013-05-03 14:06:16 +0800
committerDaniel Bovensiepen <[email protected]>2013-05-03 14:06:16 +0800
commitdd8bfcb49f10922173e2f3d3171e8a8e5ba54be9 (patch)
treed93897c3201dee0c93ee85a0a3fdd10e33106a7f /tasks
parent0e529c22d6ab6387b472a244df4dac17f702e4a1 (diff)
downloadmruby-dd8bfcb49f10922173e2f3d3171e8a8e5ba54be9.tar.gz
mruby-dd8bfcb49f10922173e2f3d3171e8a8e5ba54be9.zip
Implement GemList which can identify GEM duplicates
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mruby_build_gem.rake16
1 files changed, 16 insertions, 0 deletions
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index 83c46de24..b40522331 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -1,4 +1,20 @@
module MRuby
+ class GemList < Array
+ def <<(gem)
+ fail ArgumentError.new("Don't find directory for this GEM") unless gem.respond_to? :dir
+ unless include?(gem)
+ super(gem)
+ else
+ # GEM was already added to this list
+ end
+ end
+
+ # we assume that a gem with the same directory is equal
+ def include?(gem)
+ detect {|g| g.dir == gem.dir }
+ end
+ end
+
module LoadGems
def gembox(gemboxfile)
gembox = File.expand_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems")