Remove knowledge of DSL implementation from initialize
This commit is contained in:
parent
426737eb9e
commit
525e5f791f
@ -49,20 +49,27 @@ class CompilerFailure
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize compiler, &block
|
def self.create(spec, &block)
|
||||||
instance_eval(&block) if block_given?
|
|
||||||
# Non-Apple compilers are in the format fails_with compiler => version
|
# Non-Apple compilers are in the format fails_with compiler => version
|
||||||
if compiler.is_a? Hash
|
if spec.is_a?(Hash)
|
||||||
# currently the only compiler for this case is GCC
|
_, major_version = spec.first
|
||||||
_, @major_version = compiler.first
|
compiler = "gcc-#{major_version}"
|
||||||
@compiler = 'gcc-' + @major_version
|
|
||||||
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
|
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
|
||||||
@version ||= @major_version + '.999'
|
version = "#{major_version}.999"
|
||||||
else
|
else
|
||||||
@compiler = compiler
|
compiler = spec
|
||||||
@version ||= 9999
|
version = 9999
|
||||||
@version = @version.to_i
|
major_version = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
new(compiler, version, major_version, &block)
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(compiler, version, major_version, &block)
|
||||||
|
@compiler = compiler
|
||||||
|
@version = version
|
||||||
|
@major_version = major_version
|
||||||
|
instance_eval(&block) if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -745,9 +745,9 @@ class Formula
|
|||||||
# fails_with :gcc => '4.8' do
|
# fails_with :gcc => '4.8' do
|
||||||
# version '4.8.1'
|
# version '4.8.1'
|
||||||
# end
|
# end
|
||||||
def fails_with compiler, &block
|
def fails_with spec, &block
|
||||||
@cc_failures ||= Set.new
|
@cc_failures ||= Set.new
|
||||||
@cc_failures << CompilerFailure.new(compiler, &block)
|
@cc_failures << CompilerFailure.create(spec, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs *standards
|
def needs *standards
|
||||||
|
Loading…
x
Reference in New Issue
Block a user