Created
February 21, 2013 16:46
-
-
Save sgillespie/5006107 to your computer and use it in GitHub Desktop.
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
apply plugin: DocumentationPlugin | |
authors { | |
gradle { | |
quickStart { | |
sourceFile = file('src/docs/quick-start') | |
} | |
userGuide { | |
} | |
developerGuide { | |
} | |
} | |
sean_gillespie { | |
greatMysteryNovel { | |
} | |
} | |
} | |
task books << { | |
authors.each { author -> | |
author.each { book -> | |
println "$book.name -> $book.sourceFile" | |
} | |
} | |
} | |
class DocumentationPlugin implements Plugin<Project> { | |
void apply(Project project) { | |
def authors = project.container(Author) | |
authors.all { author -> | |
books = project.container(Book) // This doesn't quite work | |
books.all { book -> | |
book.sourceFile = project.file("src/docs/$name") | |
} | |
} | |
project.extensions.authors = authors | |
} | |
} | |
class Book { | |
final String name | |
File sourceFile | |
Book(String name) { | |
this.name = name | |
} | |
} | |
class Author { | |
final String name | |
NamedDomainObjectContainer<Book> books | |
Author(String name) { | |
this.name = name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment