aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/software_spec.rb
diff options
context:
space:
mode:
authorJack Nagel2014-08-19 17:14:02 -0500
committerJack Nagel2014-08-19 17:14:02 -0500
commit023f02b90a758b147aa75edcca13944033a538c0 (patch)
treefaa73b54b12ea3d9a751cb47b715b5fecd78f346 /Library/Homebrew/software_spec.rb
parent00220c40dbed783be83a661ae3d56d52aa53f9c0 (diff)
downloadbrew-023f02b90a758b147aa75edcca13944033a538c0.tar.bz2
Make fails_with available in spec blocks
Closes Homebrew/homebrew#31706.
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
-rw-r--r--Library/Homebrew/software_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index 9fda2cef9..113230247 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -7,6 +7,7 @@ require 'build_options'
require 'dependency_collector'
require 'bottles'
require 'patch'
+require 'compilers'
class SoftwareSpec
extend Forwardable
@@ -21,6 +22,7 @@ class SoftwareSpec
attr_reader :build, :resources, :patches, :options
attr_reader :dependency_collector
attr_reader :bottle_specification
+ attr_reader :compiler_failures
def_delegators :@resource, :stage, :fetch, :verify_download_integrity
def_delegators :@resource, :cached_download, :clear_cache
@@ -35,6 +37,7 @@ class SoftwareSpec
@patches = []
@options = Options.new
@build = BuildOptions.new(Options.create(ARGV.options_only), options)
+ @compiler_failures = []
end
def owner= owner
@@ -112,6 +115,20 @@ class SoftwareSpec
patches << Patch.create(strip, src, &block)
end
+ def fails_with? compiler
+ compiler_failures.any? { |failure| failure === compiler }
+ end
+
+ def fails_with compiler, &block
+ compiler_failures << CompilerFailure.create(compiler, &block)
+ end
+
+ def needs *standards
+ standards.each do |standard|
+ compiler_failures.concat CompilerFailure.for_standard(standard)
+ end
+ end
+
def add_legacy_patches(list)
list = Patch.normalize_legacy_patches(list)
list.each { |p| p.owner = self }