Last active
August 29, 2015 14:22
-
-
Save martinda/31efb7dfc0bd2ac0715a to your computer and use it in GitHub Desktop.
gradle example for environments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Environment { | |
String url | |
String name | |
Environment(String name) { | |
this.name = name | |
} | |
} | |
class MyExtension { | |
def project | |
def environments | |
def password | |
MyExtension(Project project) { | |
this.project = project | |
this.environments = project.container(Environment) | |
} | |
void environments(Closure config) { | |
environments.configure(config) | |
} | |
} | |
extensions.create('apptree',MyExtension, project) | |
apptree { | |
password = 'bar' | |
environments { | |
foo { | |
url = "http://foo.org" | |
} | |
bar { | |
url = "http://bar.org" | |
} | |
} | |
} | |
apptree.environments.foo.url = 'soeth' | |
apptree.environments.all { | |
task "print$it.name"() { | |
doLast { | |
println url | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment