diff options
| author | Jack Nagel | 2014-08-03 10:47:47 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-08-03 10:47:47 -0500 |
| commit | f3a8cbec96ef8b13307ad4722489d8233d5fa954 (patch) | |
| tree | bc1b38ba281bd7738c7e739ebf899ce4e2b31c94 /Library | |
| parent | 94184b00bf7ac5e386513430e450e15393d584d6 (diff) | |
| download | homebrew-f3a8cbec96ef8b13307ad4722489d8233d5fa954.tar.bz2 | |
Use a separate class for GNU compiler failures
major_version is now only used internally by the failure object
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/compilers.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index ad6c6b4c1..4fa7069ac 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -12,7 +12,7 @@ class Compiler < Struct.new(:name, :version, :priority) end class CompilerFailure - attr_reader :name, :major_version + attr_reader :name attr_rw :cause, :version # Allows Apple compiler `fails_with` statements to keep using `build` @@ -32,26 +32,35 @@ class CompilerFailure name = "gcc-#{major_version}" # so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible version = "#{major_version}.999" + GnuCompilerFailure.new(name, major_version, version, &block) else name = spec version = 9999 - major_version = nil + new(name, version, &block) end - - new(name, version, major_version, &block) end - def initialize(name, version, major_version, &block) + def initialize(name, version, &block) @name = name @version = version - @major_version = major_version instance_eval(&block) if block_given? end def ===(compiler) - name == compiler.name && - major_version == compiler.major_version && - version >= (compiler.version || 0) + name == compiler.name && version >= (compiler.version || 0) + end + + class GnuCompilerFailure < CompilerFailure + attr_reader :major_version + + def initialize(name, major_version, version, &block) + @major_version = major_version + super(name, version, &block) + end + + def ===(compiler) + super && major_version == compiler.major_version + end end MESSAGES = { |
