Commit 7275096f authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

git push origin masterMerge branch 'take-cheeze-add_conflicts'

parents 2067f1f9 8ef971a3
...@@ -32,7 +32,7 @@ module MRuby ...@@ -32,7 +32,7 @@ module MRuby
attr_accessor :bins attr_accessor :bins
attr_accessor :requirements attr_accessor :requirements
attr_reader :dependencies attr_reader :dependencies, :conflicts
attr_accessor :export_include_paths attr_accessor :export_include_paths
...@@ -72,7 +72,7 @@ module MRuby ...@@ -72,7 +72,7 @@ module MRuby
@bins = [] @bins = []
@requirements = [] @requirements = []
@dependencies = [] @dependencies, @conflicts = [], []
@export_include_paths = [] @export_include_paths = []
@export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include" @export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include"
...@@ -102,6 +102,10 @@ module MRuby ...@@ -102,6 +102,10 @@ module MRuby
@dependencies << {:gem => name, :requirements => requirements, :default => default_gem} @dependencies << {:gem => name, :requirements => requirements, :default => default_gem}
end end
def add_conflict(name, *req)
@conflicts << {:gem => name, :requirements => req.empty? ? nil : req}
end
def self.bin=(bin) def self.bin=(bin)
@bins = [bin].flatten @bins = [bin].flatten
end end
...@@ -323,6 +327,12 @@ module MRuby ...@@ -323,6 +327,12 @@ module MRuby
fail "#{name} version should be #{req_versions.join(' and ')} but was '#{dep_g.version}'" fail "#{name} version should be #{req_versions.join(' and ')} but was '#{dep_g.version}'"
end end
end end
cfls = g.conflicts.select { |c|
cfl_g = gem_table[c[:gem]]
cfl_g and cfl_g.version_ok?(c[:requirements] || ['>= 0.0.0'])
}.map { |c| "#{c[:gem]}(#{gem_table[c[:gem]].version})" }
fail "Conflicts of gem `#{g.name}` found: #{cfls.join ', '}" unless cfls.empty?
end end
class << gem_table class << gem_table
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment