Skip to content

Commit

Permalink
Move GemList to MRuby::Gem::List. More logical location
Browse files Browse the repository at this point in the history
  • Loading branch information
bovi committed May 3, 2013
1 parent 822a711 commit 1eb2a4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
16 changes: 16 additions & 0 deletions tasks/mrbgem_spec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ module MRuby
end

end # Specification

class List < 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 # List
end # Gem

GemBox = Object.new
Expand Down
2 changes: 1 addition & 1 deletion tasks/mruby_build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module MRuby
@mrbc = Command::Mrbc.new(self)

@bins = %w(mrbc)
@gems, @libmruby = GemList.new, []
@gems, @libmruby = MRuby::Gem::List.new, []
@build_mrbtest_lib_only = false

MRuby.targets[@name] = self
Expand Down
16 changes: 0 additions & 16 deletions tasks/mruby_build_gem.rake
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
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")
Expand Down

0 comments on commit 1eb2a4b

Please sign in to comment.