Skip to content

Commit

Permalink
Tweak environment block resolve strategy to be more ergonomic
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebind committed Jul 31, 2019
1 parent 18bec66 commit 4c957bf
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ trait ConfigurableEnvironment {
* Set environment variables using a configure block.
*/
void environment(@DelegatesTo(Map) Closure closure) {
[:].with {
with(closure)
environment(it)
}
def map = [:]
closure = (Closure) closure.clone()
closure.delegate = map
closure.resolveStrategy = Closure.OWNER_FIRST
closure()
environment(map)
}
}

0 comments on commit 4c957bf

Please sign in to comment.