I’m a hobby developer who works in a vacuum. I’ve written my first Gradle plugin that offers users an easy way to download and manage Bootstrap Framework and Font Awesome resources with a few lines in their application’s build.gradle.
Before I publish a 1.0 version I’d like to get some feedback from people who know what they’re doing. I’d especially like some feedback because I plan to use this plugin as a template for two Grails 2 plugins I want to migrate to Gradle. I’d like to get them right the first time. I’ve written what I think are thorough tests, and the plugin works. However, I’m afraid that I could have done something better, more efficiently, etc.
Since this forum is the Internet brain trust for Gradle and Spock, I’d appreciate a critique of the plugin classes and the test specification.
If you don’t have time to look over the GitHub repo, I have a few specific questions:
-
The plugin uses 16 tasks that handle the work with each one depending on the one above it. Finally, the last task is executed with the code below. Does this make sense?
project.afterEvaluate {
project.tasks.processResources.dependsOn(“createFontAwesomeLess”)
} -
Most of the test feature methods have almost 30 assert statements. I thought about trying to squeeze some of them into when, then, where, @Unroll methods, but I got a headache just thinking about it. Can I improve them?
-
I have some Copy tasks that process “from java.lang.File” using the technique below. Does this make sense?
from template.getFile(project, "createBootstrapJsAll") class Template { static getText(String template) { def text = "" switch (template) { case "createBootstrapJsAll": text = """/*
- Do not edit this file. It will be overwritten by the bootstrap-framework plugin.
*= require bootstrap/css/bootstrap.css
*= require bootstrap/css/bootstrap-theme.css
*/
"""
break
}
text.toString()
}static getFile(Project project, String template) { project.resources.text.fromString(getText(template)).asFile() } }
Thanks for your input!
Ken