Move require into method to avoid circular require

There is a nasty circular dependency here:

formula.rb
  requirement.rb
    extend/ENV.rb
      extend/ENV/shared.rb
        formula.rb

Probably the information that the build environment needs from formula
should be passed in at runtime, but that seems hard and I really just
want to be able to run the tests with warnings turned on. :/
This commit is contained in:
Jack Nagel 2014-07-02 21:24:01 -05:00
parent cabc451ca8
commit 2e44ffe80f

View File

@ -1,7 +1,6 @@
require 'dependable' require 'dependable'
require 'dependency' require 'dependency'
require 'build_environment' require 'build_environment'
require 'extend/ENV'
# A base class for non-formula requirements needed by formulae. # A base class for non-formula requirements needed by formulae.
# A "fatal" requirement is one that will fail the build if it is not present. # A "fatal" requirement is one that will fail the build if it is not present.
@ -127,6 +126,7 @@ class Requirement
if instance_variable_defined?(:@satisfied) if instance_variable_defined?(:@satisfied)
@satisfied @satisfied
elsif @options[:build_env] elsif @options[:build_env]
require "extend/ENV"
ENV.with_build_environment { yield @proc } ENV.with_build_environment { yield @proc }
else else
yield @proc yield @proc