mxcl/homebrew — pull request #17178 by jacknagel (2013-01-18 22:34:16+00:00)
Title: Environment DSL enhancements

This allows both formulae and requirements to pass a block to the `env` DSL method.

```rb
env do
append 'PATH', '/some/path/to/bin'
# ...
end
```

This block is evaluated in the context of `ENV`, so it has access to all `ENV` methods (`append`, `compiler`, ...). For requirements, this is meant to replace overriding `#modify_build_environment`. For formulae, this is a new addition that allows environment modifications to happen before `#install` is called, which means they will take effect even in interactive installs. The formula block is called after any requirement blocks.

Also, requirements can now use

```rb
satisfied do
# ...
end
```

instead of overriding `#satisfied?`. The contents of *this* block are evaluated in the context of the instance of the requirement class, so no changes need to be made to the code: it has access to all of the instance variables and methods as it did before.

When it is evaluated, by default it is wrapped in an `ENV.with_build_environment` block, which sets up the build environment and restores its original state when the block returns. This behavior can be disabled (reducing overhead) by passing `:env => false` to the method, i.e.

```rb
satisfied :env => false do
# ...
end
```