[
  {
    "path": ".gitignore",
    "content": "build\n.gradle\n*.iml\n*.ipr\n*.iws\n.classpath\n.project\n.settings\n.idea\nout\nclasses"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# Gradle Templates Plugin\n\n## Introduction\n\nThe Gradle Templates plugin helps you get started using Gradle by providing convenient tasks for creating new projects that work with the Gradle build system.\nEg. To create a new Java project you can run:\n\n```gradle createJavaProject```\n\nWhich will prompt you for the name of your new project and then create a new directory with it. It will also create a standard directory structure in your\nproject's directory that works with Gradle's default configurations.\n\nThe plugin also makes it easy to create your own templates which can be useful in creating new projects, or creating components within your projects. Eg.\nIt's easy to create a simple task to generate a new GSP that fits your company's standard layout. Or to create a more complex task to generate a new servlet\nand add the entry into your webapp's web.xml file.\n\n## Installation\n\nThe standard way to install this plugin is by adding the following to your build.gradle file:\n\n```groovy\nbuildscript {\n    repositories {\n        maven {\n\t\t\turl 'http://dl.bintray.com/cjstehno/public'\n\t\t}\n    }\n    dependencies {\n        classpath 'gradle-templates:gradle-templates:1.5'\n    }\n}\n\napply plugin:'templates'\n```\n\nOther methods of installation are documented on the project [installation](https://github.com/townsfolk/gradle-templates/wiki/Installation) page.\n\n## Usage\n\nRun the `gradle tasks` command to see a list of \"create\", \"init\", and \"export\" tasks provided by the default plugin templates.\n\nRunning a create or init task will prompt the user for information and then generate the appropriate content.\n\nThe main difference between the `create*Project` and `init*Project` tasks is that the create tasks end up creating a new directory\nfor your new project, and the init tasks will create the default directory structure under the current directory.\n\nThe `export*` tasks cause the templates to be exported to the local project.\n\nOther usage documentation can be found on the project [Usage](https://github.com/townsfolk/gradle-templates/wiki/Usage) page.\n\n## Details\n\n* Version: 1.5\n* Project Site: [http://cjstehno.github.io/gradle-templates](http://cjstehno.github.io/gradle-templates)\n* Project Repo: [https://github.com/townsfolk/gradle-templates](https://github.com/townsfolk/gradle-templates)\n* Wiki/Documentation: [https://github.com/townsfolk/gradle-templates/wiki](https://github.com/townsfolk/gradle-templates/wiki)\n* License: [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.html)\n* Questions, bugs, issues: [https://github.com/townsfolk/gradle-templates/issues](https://github.com/townsfolk/gradle-templates/issues)\n\n[![Build Status](https://drone.io/github.com/cjstehno/gradle-templates/status.png)](https://drone.io/github.com/cjstehno/gradle-templates/latest)\n\n"
  },
  {
    "path": "build.gradle",
    "content": "apply plugin: 'groovy'\napply plugin: 'maven'\napply plugin: 'maven-publish'\n\nrepositories { mavenCentral() }\n\ndependencies {\n\tcompile gradleApi()\n\tcompile localGroovy()\n\n    testCompile 'junit:junit:4.11'\n}\n"
  },
  {
    "path": "gradle.properties",
    "content": "group=gradle-templates\nversion=1.5\n"
  },
  {
    "path": "installation/apply-local.groovy",
    "content": "buildscript {\n\trepositories {\n\t\tivy {\n\t\t   String tpInstallDir = project.hasProperty('gradle.templates.dir') ? project.getProperty('gradle.templates.dir') :\n\t\t\t\t                                                         System.properties['user.dir']\n\t\t\tname = 'gradle_templates'\n\t\t\tartifactPattern \"${tpInstallDir}/build/libs/[artifact]-[revision].jar\"\n\t\t}\n\t}\n\tdependencies {\n\t\tdef templatesVersion = project.hasProperty('gradle.templates.ver') ? project.getProperty('gradle.templates.ver') :\n                                                                         project.version\n\t\tclasspath \"gradle-templates:gradle-templates:${templatesVersion}\"\n\t}\n}\n// Check to make sure templates.TemplatesPlugin isn't already added.\nif (!project.plugins.findPlugin(templates.TemplatesPlugin)) {\n\tproject.apply(plugin: templates.TemplatesPlugin)\n}"
  },
  {
    "path": "installation/apply.groovy",
    "content": "\nbuildscript {\n    repositories {\n        maven {\n            url 'http://dl.bintray.com/cjstehno/public'\n        }\n    }\n    dependencies {\n        classpath 'gradle-templates:gradle-templates:1.5'\n    }\n}\n\n// Check to make sure templates.TemplatesPlugin isn't already added.\nif (!project.plugins.findPlugin(templates.TemplatesPlugin)) {\n\tproject.apply(plugin: templates.TemplatesPlugin)\n}"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n  ~ Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\" xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n    <modelVersion>4.0.0</modelVersion>\n    <groupId>gradle-templates</groupId>\n    <artifactId>gradle-templates</artifactId>\n    <version>1.5</version>\n    <dependencies>\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <version>4.11</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "release.gradle",
    "content": "apply plugin: 'groovy'\napply from: 'https://launchpad.net/gradle-release/trunk/latest/+download/apply.groovy'\n\nconfigurations {\n\tinstallers {}\n}\n\nrepositories {\n\tmavenCentral()\n}\n\ndependencies {\n\tcompile gradleApi()\n\tgroovy localGroovy()\n}\n\n// This updates the apply script with the new version.\nupdateVersion << {\n\tdef applyFile = new File(\"installation\", \"apply.groovy\")\n\tdef oldVersion = project.getProperty(\"release.oldVersion\")\n\tdef newVersion = project.getProperty(\"release.newVersion\")\n\tant.replace(file: applyFile, token: \"${group}:${name}:${oldVersion}\", value: \"${group}:${name}:${newVersion}\")\n\tant.replaceregexp(file: readmeFile, match: \"Current Version: .*?\\$\", replace: \"Current Version: ${oldVersion}\", byline: true)\n\tant.replaceregexp(file: readmeFile, match: \"gradle-templates/\\\\d+\\\\.\\\\d+/apply.groovy\", replace: \"gradle-templates/${oldVersion}/apply.groovy\", byline: true)\n}\n\nartifacts {\n\tarchives jar\n\tinstallers file('installation/apply.groovy')\n}\n\nuploadArchives {\n\trepositories {\n\t\tadd(new org.apache.ivy.plugins.resolver.SFTPResolver()) {\n\t\t\thost = releaseRepoHost\n\t\t\taddIvyPattern \"${releaseRepoBase}/[module]/[revision]/[artifact]-[revision].[ext]\"\n\t\t\taddArtifactPattern \"${releaseRepoBase}/[module]/[revision]/[artifact]-[revision].[ext]\"\n\t\t}\n\t}\n}\n\nuploadInstallers {\n\trepositories {\n\t\tadd(new org.apache.ivy.plugins.resolver.SFTPResolver()) {\n\t\t\thost = releaseRepoHost\n\t\t\taddArtifactPattern \"${releaseRepoBase}/[module]/[revision]/[artifact].[ext]\"\n\t\t}\n\t\tadd(new org.apache.ivy.plugins.resolver.SFTPResolver()) {\n\t\t\thost = releaseRepoHost\n\t\t\taddArtifactPattern \"${releaseRepoBase}/[module]/[artifact].[ext]\"\n\t\t}\n\t}\n}\n\ncreateReleaseTag.dependsOn uploadArchives\ncreateReleaseTag.dependsOn uploadInstallers"
  },
  {
    "path": "src/main/groovy/templates/GradlePluginTemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Project\nimport templates.tasks.gradle.CreateGradlePluginTask\nimport templates.tasks.gradle.ExportPluginTemplatesTask\nimport templates.tasks.gradle.InitGradlePluginTask\n\n/**\n * Adds basic tasks for bootstrapping gradle plugin projects. Adds createGradlePlugin, exportPluginTemplates, and\n * initGradlePlugin tasks. Also applies the groovy-templates plugin.\n */\nclass GradlePluginTemplatesPlugin extends GroovyTemplatesPlugin {\n\n\tvoid apply(Project project) {\n\t\t// Check to make sure GroovyTemplatesPlugin isn't already added.\n\t\tif (!project.plugins.findPlugin(GroovyTemplatesPlugin)) {\n\t\t\tproject.apply(plugin: GroovyTemplatesPlugin)\n\t\t}\n\n\t\tproject.task 'createGradlePlugin', type:CreateGradlePluginTask\n\n\t\tproject.task 'exportPluginTemplates', type:ExportPluginTemplatesTask\n\n\t\tproject.task 'initGradlePlugin', type:InitGradlePluginTask\n\t}\n}"
  },
  {
    "path": "src/main/groovy/templates/GroovyTemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\nimport templates.tasks.groovy.CreateGroovyClassTask\nimport templates.tasks.groovy.CreateGroovyProjectTask\nimport templates.tasks.groovy.ExportGroovyTemplatesTask\nimport templates.tasks.groovy.InitGroovyProjectTask\n\n/**\n * Adds basic tasks for bootstrapping Groovy projects. Adds createGroovyClass, createGroovyProject,\n * exportGroovyTemplates, and initGroovyProject tasks.\n */\nclass GroovyTemplatesPlugin implements Plugin<Project> {\n\n\tvoid apply(Project project) {\n\t\tproject.task 'createGroovyClass',   type:CreateGroovyClassTask\n        project.task 'createGroovyProject', type:CreateGroovyProjectTask\n\n\t\tproject.task 'exportGroovyTemplates', type:ExportGroovyTemplatesTask\n\n\t\tproject.task 'initGroovyProject', type:InitGroovyProjectTask\n\t}\n}"
  },
  {
    "path": "src/main/groovy/templates/JavaTemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\nimport templates.tasks.java.CreateJavaClassTask\nimport templates.tasks.java.CreateJavaProjectTask\nimport templates.tasks.java.ExportJavaTemplatesTask\nimport templates.tasks.java.InitJavaProjectTask\n\n/**\n * Adds basic tasks for bootstrapping Java projects. Adds createJavaClass, createJavaProject,\n * exportJavaTemplates, and initJavaProject tasks.\n */\nclass JavaTemplatesPlugin implements Plugin<Project> {\n\n\t/**\n\t * Pulls a fully qualified class name into it's parts - package, and name.\n     *\n\t * @param fullClassName\n\t * @return Map containing the class name, package, and package as a path.\n\t */\n\tstatic getClassParts( final String fullClassName ){\n\t\tdef classParts = fullClassName.split(/\\./) as List\n\t\t[\n\t\t\t\tclassName: classParts.pop(),\n\t\t\t\tclassPackagePath: classParts.join(File.separator),\n\t\t\t\tclassPackage: classParts.join('.')\n\t\t]\n\t}\n\n\tvoid apply(Project project) {\n\t\tproject.task 'createJavaClass',   type:CreateJavaClassTask\n\t\tproject.task 'createJavaProject', type:CreateJavaProjectTask\n\n        project.task 'exportJavaTemplates', type:ExportJavaTemplatesTask\n\n        project.task 'initJavaProject', type:InitJavaProjectTask\n\t}\n}"
  },
  {
    "path": "src/main/groovy/templates/ProjectTemplate.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport groovy.text.GStringTemplateEngine\n\n/**\n * This class is used to construct a ProjectTemplate. A project template consists of files and directories. This builder\n * can be used to set up the necessary files and directories needed for new projects.\n *\n * Eg.\n * <pre>\n * ProjectTemplate.fromUserDir {\n *    directory('src') { // creates new directory named 'src'\n *       dir('main') { // creates a new directory named 'main'\n *          d('java') { // creates a new directory named 'java'\n *             file('Class1.java') // creates a new file named 'Class1.java'\n *             f('Class2.java') // creates a new file named 'Class2.java'\n *          }\n *       }\n *    }\n * }\n * </pre>\n *\n * Can also be used without method calls for directory and file.\n * Eg.\n * <pre>\n * ProjectTemplate.fromUserDir {\n *    'src/main' { // creates the directories 'src', and 'main'.\n *       'java' {\n *          'Class1.java' 'public class Class1 {}' // creates the file 'Class1.java' with some initial content.\n *       }\n *       'resources' {}\n *    }\n * }\n * </pre>\n *\n * @author: elberry\n * Date: 4/9/11 6:04 PM\n */\nclass ProjectTemplate {\n\n\tprivate File parent\n\n\t/**\n\t * Private so that it can't be accessed. Use one of the static 'fromUserDir' methods to start building a template.\n\t */\n\tprivate ProjectTemplate() {}\n\n\t/**\n\t * Same as the directory method.\n\t * @param name\n\t * @param closure\n\t * @see #directory(String, Closure)\n\t */\n\tvoid d(String name, Closure closure = {}) {\n\t\tdirectory(name, closure)\n\t}\n\n\t/**\n\t * Same as the directory method.\n\t * @param name\n\t * @param closure\n\t * @see #directory(String, Closure)\n\t */\n\tvoid dir(String name, Closure closure = {}) {\n\t\tdirectory(name, closure)\n\t}\n\n\t/**\n\t * Creates a directory, and it's parents if they don't already exist.\n\t * @param name\n\t * @param closure\n\t * @see #directory(String, Closure)\n\t */\n\tvoid directory(String name, Closure closure = {}) {\n\t\tFile oldParent = parent\n\t\tif (parent) {\n\t\t\tparent = new File(parent, name)\n\t\t} else {\n\t\t\tparent = new File(name)\n\t\t}\n\t\tparent.mkdirs()\n\t\tclosure.delegate = this\n\t\tclosure()\n\t\tparent = oldParent\n\t}\n\n\t/**\n\t * Same as file method\n\t * @param args\n\t * @param name\n\t * @see #file(Map, String)\n\t */\n\tvoid f(Map args = [:], String name) {\n\t\tfile(args, name)\n\t}\n\n\t/**\n\t * Same as file method\n\t * @param args\n\t * @param name\n\t * @see #file(String, String)\n\t */\n\tvoid f(String name, String content) {\n\t\tfile(name, content)\n\t}\n\n\t/**\n\t * Creates a new file with the given name. If a 'content' argument is provided it will be appended, or replace the\n\t * content of the current file (if it exists) based on the value of the 'append' argument.\n\t * @param args Arguments to be used when creating the new file: [content: String, append: boolean]\n\t * @param name Name of the new file to be created.\n\t */\n\tvoid file(Map args = [:], String name) {\n\t\tFile file\n\t\tif (parent) {\n\t\t\tfile = new File(parent, name)\n\t\t} else {\n\t\t\tfile = new File(name)\n\t\t}\n\t\tfile.exists() ?: file.parentFile.mkdirs() && file.createNewFile()\n\t\tdef content\n\t\tif (args.content) {\n\t\t\tcontent = args.content.stripIndent()\n\t\t} else if (args.template) {\n\t\t\tcontent = renderTemplate(args, args.template)\n\t\t}\n\t\tif (content) {\n\t\t\tif (args.append) {\n\t\t\t\tfile.append(content)\n\t\t\t} else {\n\t\t\t\tfile.text = content\n\t\t\t}\n\t\t}\n\t}\n\n    /**\n     * Render the template at the given path with the provided parameters. An attempt will be made to load the template path\n     * as an absolute path, then as a relative path, then lastly from the classpath.\n     *\n     * @param params\n     * @param template the template path\n     * @return the rendered template\n     */\n\tString renderTemplate(Map params = [:], String template) {\n\t\tdef tLoc = new File(template)\n\t\tif (!tLoc.exists()) { // check given path\n\t\t\t// Couldn't find file at given path, trying relative path.\n\t\t\tdef rTemplate = template\n\t\t\tif (rTemplate.startsWith('/')) {\n\t\t\t\trTemplate = rTemplate - '/'\n\t\t\t}\n\t\t\ttLoc = new File(System.getProperty('user.dir'), rTemplate)\n\t\t\tif (!tLoc.exists()) { // check relative path from current working dir.\n\t\t\t\ttLoc = getClass().getResource(template) // last ditch, use classpath.\n\t\t\t}\n\t\t}\n\t\tdef tReader = tLoc?.newReader()\n\t\tif (tReader) {\n\t\t\treturn new GStringTemplateEngine().createTemplate(tReader)?.make(params)?.toString()\n\t\t}\n\t\tthrow new RuntimeException(\"Could not locate template: ${template}\")\n\t}\n\n\t/**\n\t * Calls file([content: content], name)\n\t * @param name\n\t * @param content\n\t * @see #file(Map, String)\n\t */\n\tvoid file(String name, String content) {\n\t\tfile([content: content], name)\n\t}\n\n\t/**\n\t * Starts the ProjectTemplate in the \"user.dir\" directory, unless the init.dir system property is specified.\n\t * @param closure\n\t */\n\tstatic void fromUserDir(Closure closure = {}) {\n\t\tnew ProjectTemplate().directory(System.getProperty( 'init.dir', System.getProperty('user.dir') ), closure)\n\t}\n\n\t/**\n\t * Starts the ProjectTemplate in the given path.\n\t * @param path String path to the root of the new project.\n\t * @param closure\n\t */\n\tstatic void fromRoot(String path, Closure closure = {}) {\n\t\tnew ProjectTemplate().directory(path, closure)\n\t}\n\n\t/**\n\t * Starts the ProjectTemplate in the given file path.\n\t * @param pathFile File path to the root of the new project.\n\t * @param closure\n\t */\n\tstatic void fromRoot(File pathFile, Closure closure = {}) {\n\t\tnew ProjectTemplate().directory(pathFile.path, closure)\n\t}\n\n\t/**\n\t * Handles creation of files or directories without the need to specify directly.\n\t * @param name\n\t * @param args\n\t * @return\n\t */\n\tdef methodMissing(String name, def args) {\n\t\tif (args) {\n\t\t\tdef arg = args[0]\n\t\t\tif (arg instanceof Closure) {\n\t\t\t\tdirectory(name, arg)\n\t\t\t} else if (arg instanceof Map) {\n\t\t\t\tfile(arg, name)\n\t\t\t} else if (arg instanceof String || arg instanceof GString) {\n\t\t\t\tfile([content: arg], name)\n\t\t\t} else {\n\t\t\t\tprintln \"Couldn't figure out what to do. name: ${name}, arg: ${arg}, type: ${arg.getClass()}\"\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/main/groovy/templates/ScalaTemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\nimport templates.tasks.scala.CreateScalaClassTask\nimport templates.tasks.scala.CreateScalaObjectTask\nimport templates.tasks.scala.CreateScalaProjectTask\nimport templates.tasks.scala.ExportScalaTemplatesTask\nimport templates.tasks.scala.InitScalaProjectTask\n\n/**\n * Adds basic tasks for bootstrapping Scala projects.\n *\n * Adds createScalaClass, createScalaObject, createScalaProject, exportScalaTemplates, and initScalaProject tasks.\n */\nclass ScalaTemplatesPlugin implements Plugin<Project> {\n    // TODO: is this plugin really needed or just roll into main?\n\n    void apply(Project project) {\n\t\tproject.task 'createScalaClass',   type:CreateScalaClassTask\n\t\tproject.task 'createScalaObject',  type:CreateScalaObjectTask\n        project.task 'createScalaProject', type:CreateScalaProjectTask\n\n        project.task 'exportScalaTemplates', type:ExportScalaTemplatesTask\n\n        project.task 'initScalaProject', type:InitScalaProjectTask\n    }\n}\n\n"
  },
  {
    "path": "src/main/groovy/templates/TemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage templates\n\nimport org.gradle.api.GradleException\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\n\n/**\n * The core of the templates plugin.\n */\nclass TemplatesPlugin implements Plugin<Project> {\n\n\tstatic final String group = 'Template'\n\tstatic final String lineSep = System.getProperty( 'line.separator' )\n\tstatic final String inputPrompt = \"${lineSep}templates>\"\n\n\tstatic void prependPlugin(String plugin, File gradleFile) {\n\t\tdef oldText = gradleFile.text\n\t\tgradleFile.text = ''\n\t\tgradleFile.withPrintWriter { pw ->\n\t\t\tpw.println \"apply plugin: '${plugin}'\"\n\t\t\tpw.print oldText\n\t\t}\n\t}\n\n\tstatic String prompt(String message, String defaultValue = null) {\n\t\treadLine(message, defaultValue)\n\t}\n\n\tstatic int promptOptions(String message, List options = []) {\n\t\tpromptOptions(message, 0, options)\n\t}\n\n\tstatic int promptOptions(String message, int defaultValue, List options = []) {\n\t\tString consoleMessage = \"${message}\"\n\t\tconsoleMessage += \"${lineSep}    Pick an option ${1..options.size()}\"\n\t\toptions.eachWithIndex { option, index ->\n\t\t\tconsoleMessage += \"${lineSep}     (${index + 1}): ${option}\"\n\t\t}\n\t\ttry {\n\t\t\tdef range = 0..options.size() - 1\n\t\t\tint choice = Integer.parseInt(readLine(consoleMessage, defaultValue))\n\t\t\tif (choice == 0) {\n\t\t\t\tthrow new GradleException('No option provided')\n\t\t\t}\n\t\t\tchoice--\n\t\t\tif (range.containsWithinBounds(choice)) {\n\t\t\t\treturn choice\n\t\t\t} else {\n\t\t\t\tthrow new IllegalArgumentException('Option is not valid.')\n\t\t\t}\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new IllegalArgumentException('Option is not valid.', e)\n\t\t}\n\t}\n\n\tstatic boolean promptYesOrNo( final String message, final boolean defaultValue = false) {\n\t\tString consoleVal = readLine(\"$message (Y|n)\", defaultValue ? 'Y' : 'n')\n        return consoleVal?.toLowerCase()?.startsWith('y') ?: defaultValue\n\t}\n\n\tprivate static String readLine(String message, def defaultValue = null) {\n\t\tString _message = \"$inputPrompt $message \" + (defaultValue ? \"$lineSep [$defaultValue] \" : \"\")\n\t\tif (System.console()) {\n\t\t\treturn System.console().readLine(_message) ?: String.valueOf(defaultValue)\n\t\t}\n\t\tprintln \"$_message (WAITING FOR INPUT BELOW)\"\n\t\treturn System.in.newReader().readLine() ?: String.valueOf(defaultValue)\n\t}\n\n\tdef void apply(Project project) {\n\t\tproject.convention.plugins.templatePlugin = new TemplatesPluginConvention()\n\n        // FIXME: would be better to allow user to configure the desired template set rather than get them all\n\t\tproject.apply(plugin: GroovyTemplatesPlugin)\n\t\tproject.apply(plugin: GradlePluginTemplatesPlugin)\n\t\tproject.apply(plugin: JavaTemplatesPlugin)\n\t\tproject.apply(plugin: ScalaTemplatesPlugin)\n\t\tproject.apply(plugin: WebappTemplatesPlugin)\n\n\t\tproject.task(\n            'exportAllTemplates',\n            dependsOn: [\n\t\t\t\t'exportJavaTemplates', 'exportGroovyTemplates', 'exportScalaTemplates', 'exportWebappTemplates', 'exportPluginTemplates'\n            ],\n            group: TemplatesPlugin.group,\n            description: 'Exports all the default template files into the current directory.'\n        ) {}\n\t}\n}\n"
  },
  {
    "path": "src/main/groovy/templates/TemplatesPluginConvention.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\n/**\n * @author: elberry\n * Date: 4/12/11 12:27 AM\n */\nclass TemplatesPluginConvention {\n\tString gradlePluginApplyLabel\n\tString gradlePluginClassName\n\tString sourceBasePackage\n\n\tdef templates(Closure closure) {\n\t\tclosure.delegate = this\n\t\tclosure()\n\t}\n}\n"
  },
  {
    "path": "src/main/groovy/templates/WebappTemplatesPlugin.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\nimport templates.tasks.webapp.CreateWebappProjectTask\nimport templates.tasks.webapp.ExportWebappTemplatesTask\nimport templates.tasks.webapp.InitWebappProjectTask\n\n/**\n * Adds basic tasks for bootstrapping Webapp projects. Adds createWebappProject, exportWebappTemplates, and\n * initWebappProject tasks. Also applies the java-templates plugin.\n */\nclass WebappTemplatesPlugin extends JavaTemplatesPlugin implements Plugin<Project> {\n\n\tvoid apply(Project project) {\n\t\t// Check to make sure JavaTemplatesPlugin isn't already added.\n\t\tif (!project.plugins.findPlugin(JavaTemplatesPlugin)) {\n\t\t\tproject.apply(plugin: JavaTemplatesPlugin)\n\t\t}\n\n\t\tproject.task 'createWebappProject', type:CreateWebappProjectTask\n\n\t\tproject.task 'exportWebappTemplates', type:ExportWebappTemplatesTask\n\n\t\tproject.task 'initWebappProject', type:InitWebappProjectTask\n\t}\n}"
  },
  {
    "path": "src/main/groovy/templates/tasks/AbstractProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks\n\nimport org.gradle.api.DefaultTask\nimport templates.TemplatesPlugin\n\n/**\n * Abstract base class for project tasks.\n */\nabstract class AbstractProjectTask extends DefaultTask {\n\n    static final String NEW_PROJECT_NAME = 'newProjectName'\n    static final String PROJECT_GROUP = 'projectGroup'\n    static final String PROJECT_VERSION = 'projectVersion'\n    static final String PROJECT_PARENT_DIR = 'projectParentDir'\n\n    AbstractProjectTask( final String name, final String description ){\n        this.name = name\n        this.group = TemplatesPlugin.group\n        this.description = description\n    }\n\n    /**\n     * A solution to allow external generation directory config which also allows unit testing for init.\n     * It will try a system property named 'init.dir' and then fallback to the 'user.dir' property value.\n     */\n    protected String defaultDir(){\n        System.getProperty( 'init.dir', System.getProperty('user.dir') )\n    }\n\n    /**\n     * Determine the project path directory based on the specified project name.\n     *\n     * If the \"projectParentDir\" is not specified as a property, the user will be prompted for it.\n     *\n     * @param projectName the project name\n     * @return the project directory path\n     */\n    protected String projectPath( final String projectName ){\n        String parentDir = project.properties[PROJECT_PARENT_DIR]\n        if( parentDir ){\n            return \"$parentDir/$projectName\"\n        } else {\n            String dir = TemplatesPlugin.prompt( 'Project Parent Directory:', defaultDir() )\n            return \"$dir/$projectName\"\n        }\n    }\n\n    /**\n     * Determine the project name to be used. If the 'newProjectName' is not specified as a property, the user will\n     * be prompted for it.\n     *\n     * @return the project name to be used\n     */\n    protected String projectName(){\n        project.properties[NEW_PROJECT_NAME] ?: TemplatesPlugin.prompt('Project Name:')\n    }\n\n    /**\n     * Determine the project group to be used based on the project name. If the 'projectGroup' is not specified as a\n     * property, the user will be prompted for it.\n     *\n     * @param projectName the project name\n     * @return the project group\n     */\n    protected String projectGroup( final String projectName ){\n        project.properties[PROJECT_GROUP] ?: TemplatesPlugin.prompt('Group:', projectName.toLowerCase())\n    }\n\n    /**\n     * Determine the project version to be used. If the 'projectVersion' is not specified as a property the user will\n     * be prompted for it.\n     *\n     * @return the project version\n     */\n    protected String projectVersion(){\n        project.properties[PROJECT_VERSION] ?: TemplatesPlugin.prompt('Version:', '0.1')\n    }\n\n    /**\n     * Ensures that the specified file exists under the current default directory. The file reference is returned.\n     *\n     * @param file the file suffix to ensure\n     * @return the existing file\n     */\n    protected File ensureFileExists( final String file ){\n        File buildFile = new File(defaultDir(), file)\n\n        if( !buildFile.exists() ){\n            buildFile.createNewFile()\n        }\n\n        return buildFile\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/AbstractTemplateExportTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks\n\nimport org.gradle.api.DefaultTask\nimport org.gradle.api.tasks.TaskAction\nimport templates.TemplatesPlugin\n\n/**\n * Abstract base task for template exporters.\n */\nabstract class AbstractTemplateExportTask extends DefaultTask {\n\n    private final templatePaths = []\n\n    /**\n     * Creates a new template export task with the given properties and templates.\n     *\n     * @param name the task name\n     * @param description the task description\n     * @param paths the template paths\n     */\n    protected AbstractTemplateExportTask( final String name, final String description, final paths = []){\n        this.name = name\n        this.group = TemplatesPlugin.group\n        this.description = description\n        this.templatePaths = paths\n    }\n\n    /**\n     * Exports the configured templates.\n     */\n    @TaskAction void export(){\n        exportTemplates templatePaths\n    }\n\n    private void exportTemplates(def templates = []) {\n        templates.ProjectTemplate.fromUserDir {\n            templates.each { template ->\n                def tStream = getClass().getResourceAsStream(template)\n                \"$template\" tStream.text\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/gradle/AbstractGradleProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\n\nimport templates.JavaTemplatesPlugin\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\nimport templates.tasks.AbstractProjectTask\n\n/**\n *\n */\nabstract class AbstractGradleProjectTask extends AbstractProjectTask {\n\n    static final String PLUGIN_APPLY_LABEL = 'pluginApplyLabel'\n    static final String PLUGIN_CLASS_NAME = 'pluginClassName'\n\n    AbstractGradleProjectTask( final String name, final String description ){\n        super( name, description )\n    }\n\n    /**\n     * Creates the default project structure for a new gradle plugin.\n     * @param path The root path of the project. optional, defaults to user.dir.\n     * @param project A project object.\n     */\n    protected void createBase(String path = defaultDir(), def project) {\n\n        def props = project.properties\n        String lProjectName = project.name.toLowerCase()\n        String cProjectName = project.name.capitalize()\n        String projectGroup = props[ PROJECT_GROUP ] ?: TemplatesPlugin.prompt('Group:', lProjectName)\n        String projectVersion = props[ PROJECT_VERSION ] ?: TemplatesPlugin.prompt('Version:', '1.0')\n        String pluginApplyLabel = props[ PLUGIN_APPLY_LABEL ] ?: TemplatesPlugin.prompt('Plugin \\'apply\\' label:', lProjectName)\n        String pluginClassName = props[ PLUGIN_CLASS_NAME ] ?: TemplatesPlugin.prompt('Plugin class name:', \"${projectGroup}.${cProjectName}Plugin\")\n\n        createGroovyBase( path )\n\n        ProjectTemplate.fromRoot(path){\n            'src/main/' {\n                'resources/META-INF/gradle-plugins' {\n                    \"${pluginApplyLabel}.properties\" \"implementation-class=${pluginClassName}\"\n                }\n                'groovy' {\n                    if (pluginClassName) {\n                        def classParts = JavaTemplatesPlugin.getClassParts(pluginClassName)\n                        \"${classParts.classPackagePath}\" {\n                            \"${classParts.className}.groovy\" template: '/templates/plugin/plugin-class.tmpl',\n                                className: classParts.className,\n                                classPackage: classParts.classPackage\n                            \"${classParts.className}Convention.groovy\" template: '/templates/plugin/convention-class.tmpl',\n                                className: classParts.className,\n                                classPackage: classParts.classPackage\n                        }\n                    }\n                }\n            }\n            'build.gradle' template: '/templates/plugin/build.gradle.tmpl', projectGroup: projectGroup\n            'gradle.properties' content: \"version=${projectVersion}\", append: true\n        }\n    }\n\n    // FIXME: a bit of duplicated code to start with, need to refactor away\n    private void createGroovyBase( path ){\n        ProjectTemplate.fromRoot(path) {\n            'src' {\n                'main' {\n                    'groovy' {}\n                    'resources' {}\n                }\n                'test' {\n                    \"groovy\" {}\n                    \"resources\" {}\n                }\n            }\n            'LICENSE.txt' '// Your License Goes here'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/gradle/CreateGradlePluginTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\nimport org.gradle.api.tasks.TaskAction\n\n/**\n * Task to create a gradle project in a new directory.\n */\nclass CreateGradlePluginTask extends AbstractGradleProjectTask {\n\n    CreateGradlePluginTask(){\n        super(\n            'createGradlePlugin',\n            'Creates a new Gradle Plugin project in a new directory named after your project.'\n        )\n    }\n\n    @TaskAction void create(){\n        def projectName = projectName()\n        if (projectName) {\n            createBase(\n                projectPath( projectName ),\n                [\n                    name:projectName,\n                    properties:project.properties\n                ]\n            )\n\n        } else {\n            // FIXME: error\n            println 'No project name provided.'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/gradle/ExportPluginTemplatesTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\n\nimport templates.tasks.AbstractTemplateExportTask\n\n/**\n * Task to export the default gradle project templates.\n */\nclass ExportPluginTemplatesTask extends AbstractTemplateExportTask {\n\n    ExportPluginTemplatesTask(){\n        super(\n            'exportPluginTemplates',\n            'Exports the default plugin template files into the current directory.',\n            [\n                '/templates/plugin/build.gradle.tmpl',\n                '/templates/plugin/convention-class.tmpl',\n                '/templates/plugin/plugin-class.tmpl'\n            ]\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/gradle/InitGradlePluginTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\nimport org.gradle.api.tasks.TaskAction\n\n/**\n * Task to initialize a new gradle plugin project in the current directory.\n */\nclass InitGradlePluginTask extends AbstractGradleProjectTask {\n\n    InitGradlePluginTask(){\n        super(\n            'initGradlePlugin',\n            'Initializes a new Gradle Plugin project in the current directory.'\n        )\n    }\n\n    @TaskAction def init(){\n        createBase project\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/groovy/AbstractGroovyProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\nimport templates.ProjectTemplate\nimport templates.tasks.AbstractProjectTask\n/**\n *\n */\nabstract class AbstractGroovyProjectTask extends AbstractProjectTask {\n\n    AbstractGroovyProjectTask( final String name, final String description ){\n        super( name, description )\n    }\n\n    /**\n     * Creates the basic Groovy project directory structure.\n     * @param path the root of the project. Optional,defaults to user.dir.\n     */\n    protected void createBase(String path = defaultDir() ) {\n        ProjectTemplate.fromRoot(path) {\n            'src' {\n                'main' {\n                    'groovy' {}\n                    'resources' {}\n                }\n                'test' {\n                    \"groovy\" {}\n                    \"resources\" {}\n                }\n            }\n            'LICENSE.txt' '// Your License Goes here'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/groovy/CreateGroovyClassTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\n\nimport org.gradle.api.Project\nimport org.gradle.api.tasks.TaskAction\nimport templates.JavaTemplatesPlugin\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\n\n/**\n * Task to create a new Groovy class in the current project.\n */\nclass CreateGroovyClassTask extends AbstractGroovyProjectTask {\n\n    public static final String NEW_CLASS_NAME = 'newClassName'\n\n    CreateGroovyClassTask(){\n        super(\n            'createGroovyClass',\n            'Creates a new Groovy class in the current project.'\n        )\n    }\n\n    @TaskAction def create(){\n        def mainSrcDir = null\n        try {\n            // get main groovy dir, and check to see if Groovy plugin is installed.\n            mainSrcDir = findMainGroovyDir(project)\n        } catch (Exception e) {\n            throw new IllegalStateException('It seems that the Groovy plugin is not installed, I cannot determine the main groovy source directory.', e)\n        }\n\n        def fullClassName = project.properties[NEW_CLASS_NAME] ?: TemplatesPlugin.prompt('Class name (com.example.MyClass)')\n\n        if (fullClassName) {\n            def classParts = JavaTemplatesPlugin.getClassParts(fullClassName)\n            ProjectTemplate.fromUserDir {\n                \"${mainSrcDir}\" {\n                    \"${classParts.classPackagePath}\" {\n                        \"${classParts.className}.groovy\" template: '/templates/groovy/groovy-class.tmpl',\n                            className: classParts.className,\n                            classPackage: classParts.classPackage\n                    }\n                }\n            }\n        } else {\n            println 'No class name provided.'\n        }\n    }\n\n    // FIXME: these finders are all very similar, refactor\n    /**\n     * Finds the path to the main java source directory.\n     * @param project The project.\n     * @return The path to the main groovy source directory.\n     */\n    private static String findMainGroovyDir(Project project) {\n        def mainSrcDir = project.sourceSets?.main?.groovy?.srcDirs*.path\n        mainSrcDir = mainSrcDir?.first()\n        mainSrcDir = mainSrcDir?.minus(project.projectDir.path)\n        return mainSrcDir\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/groovy/CreateGroovyProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\nimport org.gradle.api.tasks.TaskAction\nimport templates.ProjectTemplate\n\n/**\n * Task to create a Groovy Gradle project in a new directory.\n */\nclass CreateGroovyProjectTask extends AbstractGroovyProjectTask {\n\n    CreateGroovyProjectTask(){\n        super(\n            'createGroovyProject',\n            'Creates a new Gradle Groovy project in a new directory named after your project.'\n        )\n    }\n\n    @TaskAction def create(){\n        String projectName = projectName()\n        if (projectName) {\n            String projectPath = projectPath( projectName )\n\n            createBase projectPath\n\n            ProjectTemplate.fromRoot(projectPath) {\n                'build.gradle' template:'/templates/groovy/build.gradle.tmpl', projectGroup:projectGroup(projectName)\n                'gradle.properties' content:\"version=${projectVersion()}\", append:true\n            }\n\n        } else {\n            // FIXME: should be an error\n            println 'No project name provided.'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/groovy/ExportGroovyTemplatesTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\n\nimport templates.tasks.AbstractTemplateExportTask\n\n/**\n * Task to export the default groovy templates.\n */\nclass ExportGroovyTemplatesTask extends AbstractTemplateExportTask {\n\n    ExportGroovyTemplatesTask(){\n        super(\n            'exportGroovyTemplates',\n            'Exports the default groovy template files into the current directory.',\n            [\n                '/templates/groovy/build.gradle.tmpl',\n                '/templates/groovy/groovy-class.tmpl'\n            ]\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/groovy/InitGroovyProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\n\nimport org.gradle.api.tasks.TaskAction\nimport templates.TemplatesPlugin\n\n/**\n * Task to initialize a groovy project.\n */\nclass InitGroovyProjectTask extends AbstractGroovyProjectTask {\n\n    InitGroovyProjectTask(){\n        super(\n            'initGroovyProject',\n            'Initializes a new Gradle Groovy project in the current directory.'\n        )\n    }\n\n    @TaskAction def init(){\n        createBase()\n\n        File buildFile = ensureFileExists('build.gradle')\n\n        TemplatesPlugin.prependPlugin 'groovy', buildFile\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/java/AbstractJavaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\nimport templates.ProjectTemplate\nimport templates.tasks.AbstractProjectTask\n/**\n * Base class for Java project tasks.\n */\nabstract class AbstractJavaProjectTask extends AbstractProjectTask {\n\n    AbstractJavaProjectTask( final String name, final String description ){\n        super( name, description )\n    }\n\n    /**\n     * Creates the basic Java project directory structure.\n     *\n     * @param path the root of the project. Optional,defaults to user.dir.\n     */\n    protected void createBase(String path = defaultDir() ){\n        ProjectTemplate.fromRoot(path) {\n            'src' {\n                'main' {\n                    'java' {}\n                    'resources' {}\n                }\n                'test' {\n                    'java' {}\n                    'resources' {}\n                }\n            }\n            'LICENSE.txt' '// Your License Goes here'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/java/CreateJavaClassTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\n\nimport org.gradle.api.Project\nimport org.gradle.api.tasks.TaskAction\nimport templates.JavaTemplatesPlugin\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\n\n/**\n * Task to create a new Java class in the current project.\n */\nclass CreateJavaClassTask extends AbstractJavaProjectTask {\n\n    // TODO: the property names should be standardized and in a shared location\n    public static final String NEW_CLASS_NAME = 'newClassName'\n\n    CreateJavaClassTask(){\n        super(\n            'createJavaClass',\n            'Creates a new Java class in the current project.'\n        )\n    }\n\n    @TaskAction def create(){\n        def mainSrcDir = null\n        try {\n            // get main java dir, and check to see if Java plugin is installed.\n            mainSrcDir = findMainJavaDir(project)\n        } catch (Exception e) {\n            throw new IllegalStateException('It seems that the Java plugin is not installed, I cannot determine the main java source directory.', e)\n        }\n\n        def fullClassName = project.properties[NEW_CLASS_NAME] ?: TemplatesPlugin.prompt('Class name (com.example.MyClass)')\n        if (fullClassName) {\n            def classParts = JavaTemplatesPlugin.getClassParts(fullClassName)\n            ProjectTemplate.fromUserDir {\n                \"${mainSrcDir}\" {\n                    \"${classParts.classPackagePath}\" {\n                        \"${classParts.className}.java\" template: '/templates/java/java-class.tmpl',\n                            classPackage: classParts.classPackage,\n                            className: classParts.className\n                    }\n                }\n            }\n        } else {\n            // TODO: should be an error\n            println 'No class name provided.'\n        }\n    }\n\n    /**\n     * Finds the path to the main java source directory.\n     *\n     * @param project The project.\n     * @return The path to the main java source directory.\n     */\n    private static String findMainJavaDir( final Project project ){\n        def mainSrcDir = project.sourceSets?.main?.java?.srcDirs*.path\n        mainSrcDir = mainSrcDir?.first()\n        mainSrcDir = mainSrcDir?.minus(project.projectDir.path)\n        return mainSrcDir\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/java/CreateJavaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\nimport org.gradle.api.tasks.TaskAction\nimport templates.ProjectTemplate\n\n/**\n * Task that creates a new java project in a specified directory.\n */\nclass CreateJavaProjectTask extends AbstractJavaProjectTask {\n\n    CreateJavaProjectTask(){\n        super(\n            'createJavaProject',\n            'Creates a new Gradle Java project in a new directory named after your project.'\n        )\n    }\n\n    @TaskAction void create(){\n        String projectName = projectName()\n        if (projectName) {\n            String projectPath = projectPath( projectName )\n\n            createBase projectPath\n\n            ProjectTemplate.fromRoot(projectPath) {\n                'build.gradle' template:'/templates/java/build.gradle.tmpl', projectGroup:projectGroup(projectName)\n                'gradle.properties' content:\"version=${projectVersion()}\", append:true\n            }\n\n        } else {\n            // FIXME: should be an error\n            println 'No project name provided.'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/java/ExportJavaTemplatesTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\n\nimport templates.tasks.AbstractTemplateExportTask\n\n/**\n *  Task to export the default java templates into the current directory.\n */\nclass ExportJavaTemplatesTask extends AbstractTemplateExportTask {\n\n    ExportJavaTemplatesTask(){\n        super(\n            'exportJavaTemplates',\n            'Exports the default java template files into the current directory.',\n            [\n                '/templates/java/build.gradle.tmpl',\n                '/templates/java/java-class.tmpl'\n            ]\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/java/InitJavaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\n\nimport org.gradle.api.tasks.TaskAction\nimport templates.TemplatesPlugin\n\n/**\n * Task to initialize a gradle Java project in the current directory.\n */\nclass InitJavaProjectTask extends AbstractJavaProjectTask {\n\n    InitJavaProjectTask(){\n        super(\n            'initJavaProject',\n            'Initializes a new Gradle Java project in the current directory.'\n        )\n    }\n\n    @TaskAction def init(){\n        createBase()\n\n        File buildFile = ensureFileExists( 'build.gradle')\n\n        TemplatesPlugin.prependPlugin 'java', buildFile\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/AbstractScalaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\n\nimport org.gradle.api.Project\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\nimport templates.tasks.AbstractProjectTask\n\n/**\n * Base class for Scala tasks.\n */\nabstract class AbstractScalaProjectTask extends AbstractProjectTask {\n\n    static final String SCALA_VERSION = 'scalaVersion'\n    static final String USE_FAST_SCALA_COMPILER = 'useFastScalaCompiler'\n\n    AbstractScalaProjectTask( final String name, final String description ){\n        super( name, description )\n    }\n\n    /**\n     * Creates the basic Scala project directory structure.\n     *\n     * @param path the root of the project. Optional,defaults to user.dir.\n     */\n    protected void createBase(String path = defaultDir() ){\n        ProjectTemplate.fromRoot(path) {\n            'src' {\n                'main' {\n                    'scala' {}\n                    'resources' {}\n                }\n                'test' {\n                    'scala' {}\n                    'resources' {}\n                }\n            }\n            'LICENSE.txt' '// Your License Goes here'\n        }\n    }\n\n    /**\n     * Initializes or creates the project's build.gradle file.\n     *\n     * @param project The project\n     * @param path The path to the root of the project. optional, defaults to user.dir.\n     */\n    protected void setupBuildFile(Project project, String path = defaultDir() ) {\n        def props = project.properties\n\n        String scalaVersion = props[SCALA_VERSION] ?: TemplatesPlugin.prompt('Scala Version:', '2.9.0')\n\n        boolean useFastCompiler = props[USE_FAST_SCALA_COMPILER] ?: TemplatesPlugin.promptYesOrNo('Use fast compiler?', false)\n\n        ProjectTemplate.fromRoot(path) {\n            'build.gradle' template: '/templates/scala/build.gradle.tmpl', append: true,\n                scalaVersion: scalaVersion,\n                useFastCompiler: useFastCompiler,\n                projectGroup: props[AbstractProjectTask.PROJECT_GROUP]\n            'gradle.properties' content: \"version=${props[AbstractProjectTask.PROJECT_VERSION] ?: '0.1'}\", append: true\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/CreateScalaClassTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\n\nimport org.gradle.api.Project\nimport org.gradle.api.tasks.TaskAction\nimport templates.JavaTemplatesPlugin\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\n\n/**\n * Task for creating a new scala class in the current project.\n */\nclass CreateScalaClassTask extends AbstractScalaProjectTask {\n\n    protected static final String NEW_CLASS_NAME = 'newClassName'\n    protected static final String NEW_OBJECT_NAME = 'newObjectName'\n\n    CreateScalaClassTask(){\n        super(\n            'createScalaClass',\n            'Creates a new Scala class in the current project.'\n        )\n    }\n\n    @TaskAction\n    def create(){\n        createScalaClass project, false\n    }\n\n    /**\n     * Creates a Scala class, or object in the current working directory.\n     *\n     * @param project The project.\n     * @param object Is this a Scala class, or object.\n     */\n    protected void createScalaClass(Project project, boolean object) {\n        def mainSrcDir = null\n        try {\n            // get main Scala dir, and check to see if Scala plugin is installed.\n            mainSrcDir = findMainScalaDir(project)\n        } catch (Exception e) {\n            throw new IllegalStateException('It seems that the Scala plugin is not installed, I cannot determine the main scala source directory.', e)\n        }\n\n        def props = project.properties\n        def type = object ? 'Object' : 'Class'\n\n        // TODO: seems like we'd only need one name that works for either case\n        def fullClassName = props[NEW_CLASS_NAME] ?: props[NEW_OBJECT_NAME] ?: TemplatesPlugin.prompt(\"${type} name (com.example.My${type})\")\n\n        if (fullClassName) {\n            def classParts = JavaTemplatesPlugin.getClassParts(fullClassName)\n            ProjectTemplate.fromUserDir {\n                \"${mainSrcDir}\" {\n                    \"${classParts.classPackagePath}\" {\n                        \"${classParts.className}.scala\" template: '/templates/scala/scala-class.tmpl',\n                            className: classParts.className,\n                            classPackage: classParts.classPackage,\n                            object: object\n                    }\n                }\n            }\n\n        } else {\n            // TODO: should be an error of some sort\n            println 'No class name provided.'\n        }\n    }\n\n    /**\n     * Finds the path to the main java source directory.\n     *\n     * @param project The project.\n     * @return The path to the main groovy source directory.\n     */\n    protected static String findMainScalaDir( final Project project ){\n        def mainSrcDir = project.sourceSets?.main?.scala?.srcDirs*.path\n        mainSrcDir = mainSrcDir?.first()\n        mainSrcDir = mainSrcDir?.minus(project.projectDir.path)\n        return mainSrcDir\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/CreateScalaObjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.gradle.api.tasks.TaskAction\n\n/**\n * Task for creating a new scala object in the current project.\n */\nclass CreateScalaObjectTask extends CreateScalaClassTask {\n    // TODO: seems like there should be a better way to do this since its just a different property\n\n    CreateScalaObjectTask(){\n        super()\n        name = 'createScalaObject'\n        description = 'Creates a new Scala object in the current project.'\n    }\n\n    @Override @TaskAction\n    def create(){\n        createScalaClass project, true\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/CreateScalaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.gradle.api.tasks.TaskAction\n\n/**\n * Task for creating a new Gradle Scala project in a specified directory.\n */\nclass CreateScalaProjectTask extends AbstractScalaProjectTask {\n\n    CreateScalaProjectTask(){\n        super(\n            'createScalaProject',\n            'Creates a new Gradle Scala project in a new directory named after your project.'\n        )\n    }\n\n    @TaskAction void create(){\n        String projectName = projectName()\n        if (projectName) {\n            project.ext[PROJECT_GROUP] = projectGroup( projectName )\n            project.ext[PROJECT_VERSION] = projectVersion()\n\n            String projectPath = projectPath( projectName )\n\n            createBase projectPath\n            setupBuildFile project, projectPath\n\n        } else {\n            // FIXME: error\n            println 'No project name provided.'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/ExportScalaTemplatesTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\n\nimport templates.tasks.AbstractTemplateExportTask\n\n/**\n * Task to export the scala templates.\n */\nclass ExportScalaTemplatesTask extends AbstractTemplateExportTask {\n\n    ExportScalaTemplatesTask(){\n        super(\n            'exportScalaTemplates',\n            'Exports the default scala template files into the current directory.',\n            [\n                '/templates/scala/build.gradle.tmpl',\n                '/templates/scala/scala-class.tmpl'\n            ]\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/scala/InitScalaProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.gradle.api.tasks.TaskAction\n/**\n * Task for initializing a new Gradle Scala project in the current directory.\n */\nclass InitScalaProjectTask extends AbstractScalaProjectTask {\n\n    InitScalaProjectTask(){\n        super(\n            'initScalaProject',\n            'Initializes a new Gradle Scala project in the current directory.'\n        )\n    }\n\n    @TaskAction\n    def init(){\n        createBase()\n        setupBuildFile(project)\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/webapp/AbstractWebappProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\n\nimport templates.ProjectTemplate\nimport templates.TemplatesPlugin\nimport templates.tasks.AbstractProjectTask\n\n/**\n *\n */\nabstract class AbstractWebappProjectTask extends AbstractProjectTask {\n\n    static final String USE_JETTY_PLUGIN = 'useJettyPlugin'\n\n    AbstractWebappProjectTask( final String name, final String description ){\n        super( name, description )\n    }\n\n    /**\n     * Creates the basic Groovy project directory structure.\n     * @param path the root of the project. Optional,defaults to user.dir.\n     */\n    protected void createBase(String path = defaultDir(), String projectName) {\n        createJavaBase path\n\n        ProjectTemplate.fromRoot(path) {\n            'src/main/webapp/WEB-INF' {\n                'web.xml' template: '/templates/webapp/web-xml.tmpl', project: [name: projectName]\n            }\n        }\n    }\n\n    protected boolean useJetty(){\n        if( project.properties[USE_JETTY_PLUGIN] ){\n            return project.properties[USE_JETTY_PLUGIN]?.toLowerCase() == 'y'\n        } else {\n            return TemplatesPlugin.promptYesOrNo('Use Jetty Plugin?')\n        }\n    }\n\n    // FIXME: copied from AbstractJavaProjectTask\n    private void createJavaBase(String path = defaultDir() ){\n        ProjectTemplate.fromRoot(path) {\n            'src' {\n                'main' {\n                    'java' {}\n                    'resources' {}\n                }\n                'test' {\n                    'java' {}\n                    'resources' {}\n                }\n            }\n            'LICENSE.txt' '// Your License Goes here'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/webapp/CreateWebappProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\nimport org.gradle.api.tasks.TaskAction\nimport templates.ProjectTemplate\n/**\n * Task to create a new gradle web app project in a directory.\n */\nclass CreateWebappProjectTask extends AbstractWebappProjectTask {\n\n    CreateWebappProjectTask(){\n        super(\n            'createWebappProject',\n            'Creates a new Gradle Webapp project in a new directory named after your project.'\n        )\n    }\n\n    @TaskAction def create(){\n        String projectName = projectName()\n        if (projectName) {\n            String projectPath = projectPath( projectName )\n\n            createBase projectPath, projectName\n\n            ProjectTemplate.fromRoot(projectPath) {\n                'build.gradle' template:'/templates/webapp/build.gradle.tmpl', useJetty:useJetty(), projectGroup:projectGroup(projectName)\n                'gradle.properties' content:\"version=${projectVersion()}\", append:true\n            }\n\n        } else {\n            // FIXME: error here\n            println 'No project name provided.'\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/webapp/ExportWebappTemplatesTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\n\nimport templates.tasks.AbstractTemplateExportTask\n\n/**\n * Task to export the default webapp templates.\n */\nclass ExportWebappTemplatesTask extends AbstractTemplateExportTask {\n\n    ExportWebappTemplatesTask(){\n        super(\n            'exportWebappTemplates',\n            'Exports the default webapp template files into the current directory.',\n            [\n                '/templates/webapp/build.gradle.tmpl',\n                '/templates/webapp/web-xml.tmpl'\n            ]\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/groovy/templates/tasks/webapp/InitWebappProjectTask.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\n\nimport org.gradle.api.tasks.TaskAction\nimport templates.TemplatesPlugin\n\n/**\n * Task to initialize a webapp project.\n */\nclass InitWebappProjectTask extends AbstractWebappProjectTask {\n\n    InitWebappProjectTask(){\n        super(\n            'initWebappProject',\n            'Initializes a new Gradle Webapp project in the current directory.'\n        )\n    }\n\n    @TaskAction def init(){\n        createBase project.name\n\n        File buildFile = ensureFileExists( 'build.gradle' )\n\n        TemplatesPlugin.prependPlugin useJetty() ? 'jetty' : 'war', buildFile\n    }\n}\n"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/gradle-plugin-templates.properties",
    "content": "implementation-class=templates.GradlePluginTemplatesPlugin"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/groovy-templates.properties",
    "content": "implementation-class=templates.GroovyTemplatesPlugin"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/java-templates.properties",
    "content": "implementation-class=templates.JavaTemplatesPlugin"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/scala-templates.properties",
    "content": "implementation-class=templates.ScalaTemplatesPlugin"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/templates.properties",
    "content": "implementation-class=templates.TemplatesPlugin"
  },
  {
    "path": "src/main/resources/META-INF/gradle-plugins/webapp-templates.properties",
    "content": "implementation-class=templates.WebappTemplatesPlugin"
  },
  {
    "path": "src/main/resources/templates/groovy/build.gradle.tmpl",
    "content": "apply plugin: 'groovy'\n\ngroup = '${projectGroup}'\n\ndependencies {\n   groovy localGroovy()\n}"
  },
  {
    "path": "src/main/resources/templates/groovy/groovy-class.tmpl",
    "content": "package ${classPackage}\n\n/**\n * @author ${System.getProperty('user.name')}\n * Created: ${new Date()}\n */\nclass ${className} {\n\n}"
  },
  {
    "path": "src/main/resources/templates/java/build.gradle.tmpl",
    "content": "apply plugin: 'java'\n\ngroup = '${projectGroup}'"
  },
  {
    "path": "src/main/resources/templates/java/java-class.tmpl",
    "content": "package ${classPackage};\n\n/**\n * @author ${System.getProperty('user.name')}\n * Created: ${new Date()}\n */\npublic class ${className} {\n   public ${className}() {\n   \n   }\n}"
  },
  {
    "path": "src/main/resources/templates/plugin/build.gradle.tmpl",
    "content": "apply plugin: 'groovy'\n\ngroup = '${projectGroup}'\n\ndependencies {\n   compile gradleApi()\n   groovy localGroovy()\n}\n"
  },
  {
    "path": "src/main/resources/templates/plugin/convention-class.tmpl",
    "content": "package ${classPackage}\n\n/**\n * @author ${System.getProperty('user.name')}\n * Created: ${new Date()}\n */\nclass ${className}Convention {\n\n}"
  },
  {
    "path": "src/main/resources/templates/plugin/plugin-class.tmpl",
    "content": "package ${classPackage}\n\nimport org.gradle.api.Project\nimport org.gradle.api.Plugin\n\n/**\n * @author ${System.getProperty('user.name')}\n * Created: ${new Date()}\n */\nclass ${className} implements Plugin<Project> {\n   void apply (Project project) {\n      project.convention.plugins.${className} = new ${className}Convention()\n      \n      // add your plugin tasks here.\n   }\n}"
  },
  {
    "path": "src/main/resources/templates/scala/build.gradle.tmpl",
    "content": "apply plugin: 'scala'\n\n<% if(projectGroup){ %>\ngroup = '${projectGroup}'\n<% } %>\n\nrepositories {\n\tmavenCentral()\n}\n\nscalaVersion = '${scalaVersion}'\n\ndependencies {\n\t// Libraries needed to run the scala tools\n\tscalaTools \"org.scala-lang:scala-compiler:\\${scalaVersion}\",\n\t           \"org.scala-lang:scala-library:\\${scalaVersion}\"\n\n\t// Libraries needed for scala api\n\tcompile \"org.scala-lang:scala-library:\\${scalaVersion}\"\n}\n\n<% if (useFastCompiler) { %>\ncompileScala {\n\tscalaCompileOptions.useCompileDaemon = true\n\n\t// optionally specify host and port of the daemon:\n\tscalaCompileOptions.daemonServer = 'localhost:4243'\n}\n<% } %>"
  },
  {
    "path": "src/main/resources/templates/scala/scala-class.tmpl",
    "content": "package ${classPackage}\n\n/**\n * @author ${System.getProperty('user.name')}\n * Created: ${new Date()}\n */\n${object ? 'object' : 'class'} ${className} {\n\n}"
  },
  {
    "path": "src/main/resources/templates/webapp/build.gradle.tmpl",
    "content": "${useJetty ? 'apply plugin: \\'jetty\\'' : 'apply plugin: \\'war\\''}\n\ngroup = '${projectGroup}'"
  },
  {
    "path": "src/main/resources/templates/webapp/web-xml.tmpl",
    "content": "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<!DOCTYPE web-app\n    PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\"\n    \"http://java.sun.com/dtd/web-app_2_3.dtd\">\n\n<web-app>\n   <!-- General description of your web application -->\n   <display-name>${project.name} - Webapp</display-name>\n      <description>\n         Describe the ${project.name} Webapp here.\n         ${System.getProperty('user.name')}@example.com\n\n         See http://tomcat.apache.org/tomcat-6.0-doc/appdev/web.xml.txt for more information\n         regarding this Web Descriptor File.\n   </description>\n</web-app>"
  },
  {
    "path": "src/test/groovy/templates/AbstractTaskTester.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Project\nimport org.gradle.api.Task\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.After\nimport org.junit.Before\nimport org.junit.Rule\nimport org.junit.rules.TemporaryFolder\n\n/**\n * Base class for template-based task testers.\n */\nabstract class AbstractTaskTester {\n\n    @Rule\n    public TemporaryFolder folder = new TemporaryFolder()\n\n    protected Project project\n    protected Task task\n\n    private final Class taskClass\n\n    AbstractTaskTester( final Class taskClass ){\n        this.taskClass = taskClass\n    }\n\n    @Before\n    void before(){\n        System.setProperty( 'init.dir', folder.root as String )\n\n        project = ProjectBuilder.builder().build()\n        task = project.task( 'targetTask', type:taskClass )\n    }\n\n    @After void after(){\n        System.setProperty( 'init.dir', '' )\n    }\n\n    /**\n     * Asserts that the specified file exists.\n     *\n     * @param root the root directory\n     * @param path the path to the file\n     */\n    protected void assertFileExists( File root, String path ){\n        assert new File( root, path ).exists()\n    }\n\n    /**\n     * Asserts that the file at the given path (root+path) exists and that it contains the specified\n     * content strings.\n     *\n     * @param root the root directory\n     * @param path the path to the file\n     * @param contents the content string to be tested\n     */\n    protected void assertFileContains( File root, String path, String... contents ){\n        assertFileExists root, path\n\n        String text = new File( root, path ).text\n\n        contents.each { String str ->\n            assert text.contains( str )\n        }\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/GradlePluginTemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\n\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.rules.TemporaryFolder\n\nclass GradlePluginTemplatesPluginTest {\n\n    @Rule public TemporaryFolder rootFolder = new TemporaryFolder()\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.createGradlePlugin\n        assert project.tasks.exportPluginTemplates\n        assert project.tasks.initGradlePlugin\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/GroovyTemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Test\n\nclass GroovyTemplatesPluginTest {\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.createGroovyClass\n        assert project.tasks.createGroovyProject\n        assert project.tasks.exportGroovyTemplates\n        assert project.tasks.initGroovyProject\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/JavaTemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Test\n\nclass JavaTemplatesPluginTest {\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.createJavaClass\n        assert project.tasks.createJavaProject\n        assert project.tasks.exportJavaTemplates\n        assert project.tasks.initJavaProject\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/ProjectTemplateTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.rules.TemporaryFolder\n\nclass ProjectTemplateTest {\n\n    private static final String PROJECT_NAME = 'some_project'\n\n    @Rule public TemporaryFolder rootFolder = new TemporaryFolder()\n\n    @Test void 'fromRoot(String): empty'(){\n        assert !(new File( rootFolder.root, PROJECT_NAME ).exists())\n\n        ProjectTemplate.fromRoot( \"${rootFolder.root}/$PROJECT_NAME\" )\n\n        assert new File( rootFolder.root, PROJECT_NAME ).exists()\n    }\n\n    @Test void 'fromRoot(String): with content'(){\n        assert !(new File( rootFolder.root, PROJECT_NAME ).exists())\n\n        File templateFile = rootFolder.newFile( 'template.tmpl' )\n        templateFile.text = 'The answer is ${bar}'\n\n        ProjectTemplate.fromRoot( \"${rootFolder.root}/$PROJECT_NAME\" ){\n            'stuff' {\n                'README.txt' '''\n                    This is a generated README file.\n                '''\n                'deeper' {}\n                'foo' template:templateFile.toString(), bar:42\n            }\n        }\n\n        assert new File( rootFolder.root, PROJECT_NAME ).exists()\n        assert new File( rootFolder.root, \"$PROJECT_NAME/stuff\" ).exists()\n        assert new File( rootFolder.root, \"$PROJECT_NAME/stuff/deeper\" ).exists()\n\n        assertFileText rootFolder.root, \"$PROJECT_NAME/stuff/README.txt\", 'This is a generated README file.'\n        assertFileText rootFolder.root, \"$PROJECT_NAME/stuff/foo\", 'The answer is 42'\n    }\n\n    private void assertFileText( File dir, String path, String expectedText ){\n        def targetFile = new File( dir, path )\n        assert targetFile.exists()\n        assert targetFile.text.trim() == expectedText\n    }\n\n    @Test void 'fromRoot(File): empty'(){\n        assert !(new File( rootFolder.root, PROJECT_NAME ).exists())\n\n        ProjectTemplate.fromRoot( new File( rootFolder.root, PROJECT_NAME ) )\n\n        assert new File( rootFolder.root, PROJECT_NAME ).exists()\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/ScalaTemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Test\n\nclass ScalaTemplatesPluginTest {\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.createScalaClass\n        assert project.tasks.createScalaObject\n        assert project.tasks.createScalaProject\n        assert project.tasks.exportScalaTemplates\n        assert project.tasks.initScalaProject\n    }\n}\n\n"
  },
  {
    "path": "src/test/groovy/templates/TemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Test\n\nclass TemplatesPluginTest {\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.exportAllTemplates\n\n        assert project.tasks.createGradlePlugin\n        assert project.tasks.exportPluginTemplates\n        assert project.tasks.initGradlePlugin\n\n        assert project.tasks.createGroovyClass\n        assert project.tasks.createGroovyProject\n        assert project.tasks.exportGroovyTemplates\n        assert project.tasks.initGroovyProject\n\n        assert project.tasks.createJavaClass\n        assert project.tasks.createJavaProject\n        assert project.tasks.exportJavaTemplates\n        assert project.tasks.initJavaProject\n\n        assert project.tasks.createScalaClass\n        assert project.tasks.createScalaObject\n        assert project.tasks.createScalaProject\n        assert project.tasks.exportScalaTemplates\n        assert project.tasks.initScalaProject\n\n        assert project.tasks.createWebappProject\n        assert project.tasks.exportWebappTemplates\n        assert project.tasks.initWebappProject\n    }\n\n}\n"
  },
  {
    "path": "src/test/groovy/templates/WebappTemplatesPluginTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates\nimport org.gradle.api.Project\nimport org.gradle.testfixtures.ProjectBuilder\nimport org.junit.Test\n\nclass WebappTemplatesPluginTest {\n\n    @Test void 'apply'(){\n        Project project = ProjectBuilder.builder().build()\n        project.apply plugin: 'templates'\n\n        assert project.tasks.createWebappProject\n        assert project.tasks.exportWebappTemplates\n        assert project.tasks.initWebappProject\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/gradle/CreateGradlePluginTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static AbstractGradleProjectTask.NEW_PROJECT_NAME\nimport static AbstractGradleProjectTask.PROJECT_PARENT_DIR\nimport static AbstractGradleProjectTask.PROJECT_GROUP\nimport static AbstractGradleProjectTask.PROJECT_VERSION\nimport static AbstractGradleProjectTask.PLUGIN_CLASS_NAME\nimport static AbstractGradleProjectTask.PLUGIN_APPLY_LABEL\n\nclass CreateGradlePluginTaskTest extends AbstractTaskTester {\n\n    CreateGradlePluginTaskTest(){\n        super( CreateGradlePluginTask )\n    }\n\n    @Test void create(){\n        project.ext[PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[NEW_PROJECT_NAME] = 'tester'\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[PROJECT_VERSION] = '1.1.1'\n        project.ext[PLUGIN_APPLY_LABEL] = 'test-foo'\n        project.ext[PLUGIN_CLASS_NAME] = 'com.test'\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/groovy'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/groovy'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/gradle/ExportPluginTemplatesTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nclass ExportPluginTemplatesTaskTest extends AbstractTaskTester {\n\n    ExportPluginTemplatesTaskTest(){\n        super( ExportPluginTemplatesTask )\n    }\n\n    @Test void export(){\n        task.export()\n\n        assertFileExists folder.root, 'templates/plugin/build.gradle.tmpl'\n        assertFileExists folder.root, 'templates/plugin/convention-class.tmpl'\n        assertFileExists folder.root, 'templates/plugin/plugin-class.tmpl'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/gradle/InitGradlePluginTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.gradle\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.gradle.AbstractGradleProjectTask.*\n\nclass InitGradlePluginTaskTest extends AbstractTaskTester{\n\n    InitGradlePluginTaskTest(){\n        super( InitGradlePluginTask )\n    }\n\n    @Test void init(){\n        project.ext[PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[PROJECT_VERSION] = '1.1.1'\n        project.ext[PLUGIN_APPLY_LABEL] = 'test-foo'\n        project.ext[PLUGIN_CLASS_NAME] = 'com.test'\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/groovy'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/groovy'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/groovy/CreateGroovyClassTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.groovy.CreateGroovyClassTask.NEW_CLASS_NAME\n\n/**\n * Created by cjstehno on 12/23/13.\n */\nclass CreateGroovyClassTaskTest extends AbstractTaskTester {\n\n    CreateGroovyClassTaskTest(){\n        super( CreateGroovyClassTask )\n    }\n\n    @Test void create(){\n        project.apply plugin:'groovy'\n\n        project.ext[NEW_CLASS_NAME] = 'foo.Something'\n\n        task.create()\n\n        assertFileContains folder.root, 'src/main/groovy/foo/Something.groovy', 'class Something'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/groovy/CreateGroovyProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nclass CreateGroovyProjectTaskTest extends AbstractTaskTester {\n\n    CreateGroovyProjectTaskTest(){\n        super( CreateGroovyProjectTask )\n    }\n\n    @Test void create(){\n        project.ext[ CreateGroovyProjectTask.PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[ CreateGroovyProjectTask.NEW_PROJECT_NAME] = 'tester'\n        project.ext[ CreateGroovyProjectTask.PROJECT_GROUP] = 'test-group'\n        project.ext[ CreateGroovyProjectTask.PROJECT_VERSION] = '1.1.1'\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/groovy'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/groovy'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/groovy/ExportGroovyTemplatesTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\n\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nclass ExportGroovyTemplatesTaskTest extends AbstractTaskTester {\n\n    ExportGroovyTemplatesTaskTest(){\n        super( ExportGroovyTemplatesTask )\n    }\n\n    @Test void export(){\n        task.export()\n\n        assertFileExists folder.root, 'templates/groovy/build.gradle.tmpl'\n        assertFileExists folder.root, 'templates/groovy/groovy-class.tmpl'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/groovy/InitGroovyProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.groovy\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.scala.AbstractScalaProjectTask.PROJECT_GROUP\n\nclass InitGroovyProjectTaskTest extends AbstractTaskTester {\n\n    InitGroovyProjectTaskTest(){\n        super( InitGroovyProjectTask )\n    }\n\n    @Test void init(){\n        project.ext[PROJECT_GROUP] = 'test-group'\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/groovy'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/groovy'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'apply plugin: \\'groovy\\''\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/java/CreateJavaClassTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.java.CreateJavaClassTask.NEW_CLASS_NAME\n\nclass CreateJavaClassTaskTest extends AbstractTaskTester {\n\n    CreateJavaClassTaskTest(){\n        super( CreateJavaClassTask )\n    }\n\n    @Test void create(){\n        project.apply plugin:'java'\n\n        project.ext[NEW_CLASS_NAME] = 'foo.Something'\n\n        task.create()\n\n        assertFileContains folder.root, 'src/main/java/foo/Something.java', 'class Something'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/java/CreateJavaProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nclass CreateJavaProjectTaskTest extends AbstractTaskTester {\n\n    CreateJavaProjectTaskTest(){\n        super( CreateJavaProjectTask )\n    }\n\n    @Test void create(){\n        project.ext[CreateJavaProjectTask.PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[CreateJavaProjectTask.NEW_PROJECT_NAME] = 'tester'\n        project.ext[CreateJavaProjectTask.PROJECT_GROUP] = 'test-group'\n        project.ext[CreateJavaProjectTask.PROJECT_VERSION] = '1.1.1'\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/java'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/java'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/java/ExportJavaTemplatesTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\n\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nclass ExportJavaTemplatesTaskTest extends AbstractTaskTester {\n\n    ExportJavaTemplatesTaskTest(){\n        super( ExportJavaTemplatesTask )\n    }\n\n    @Test void export(){\n        task.export()\n\n        assertFileExists folder.root, 'templates/java/build.gradle.tmpl'\n        assertFileExists folder.root, 'templates/java/java-class.tmpl'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/java/InitJavaProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.java\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.java.AbstractJavaProjectTask.PROJECT_GROUP\n\nclass InitJavaProjectTaskTest extends AbstractTaskTester {\n\n    InitJavaProjectTaskTest(){\n        super( InitJavaProjectTask )\n    }\n\n    @Test void init(){\n        project.ext[PROJECT_GROUP] = 'test-group'\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/java'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/java'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'apply plugin: \\'java\\''\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/scala/CreateScalaClassTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.scala.CreateScalaClassTask.NEW_CLASS_NAME\n\nclass CreateScalaClassTaskTest extends AbstractTaskTester {\n\n    CreateScalaClassTaskTest(){\n        super( CreateScalaClassTask )\n    }\n\n    @Test void create(){\n        project.apply plugin:'scala'\n\n        project.ext[NEW_CLASS_NAME] = 'foo.Something'\n\n        task.create()\n\n        assertFileContains folder.root, 'src/main/scala/foo/Something.scala', 'class Something'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/scala/CreateScalaObjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.scala.CreateScalaClassTask.NEW_CLASS_NAME\n\nclass CreateScalaObjectTaskTest extends AbstractTaskTester {\n\n    CreateScalaObjectTaskTest(){\n        super( CreateScalaObjectTask )\n    }\n\n    @Test void create(){\n        project.apply plugin:'scala'\n\n        project.ext[NEW_CLASS_NAME] = 'foo.Something'\n\n        task.create()\n\n        assertFileContains folder.root, 'src/main/scala/foo/Something.scala', 'object Something'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/scala/CreateScalaProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.scala.AbstractScalaProjectTask.NEW_PROJECT_NAME\nimport static templates.tasks.scala.AbstractScalaProjectTask.PROJECT_GROUP\nimport static templates.tasks.scala.AbstractScalaProjectTask.PROJECT_PARENT_DIR\nimport static templates.tasks.scala.AbstractScalaProjectTask.PROJECT_VERSION\nimport static templates.tasks.scala.AbstractScalaProjectTask.SCALA_VERSION\nimport static templates.tasks.scala.AbstractScalaProjectTask.USE_FAST_SCALA_COMPILER\n\nclass CreateScalaProjectTaskTest extends AbstractTaskTester {\n\n    CreateScalaProjectTaskTest(){\n        super( CreateScalaProjectTask )\n    }\n\n    @Test\n    void create(){\n        project.ext[PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[NEW_PROJECT_NAME] = 'tester'\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[PROJECT_VERSION] = '1.1.1'\n        project.ext[SCALA_VERSION] = '2.9.0'\n        project.ext[USE_FAST_SCALA_COMPILER] = true\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/scala'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/scala'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'scalaVersion = \\'2.9.0\\'', 'scalaCompileOptions.useCompileDaemon = true', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/scala/ExportScalaTemplatesTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\n\nimport org.junit.Test\nimport templates.AbstractTaskTester\nimport templates.tasks.scala.ExportScalaTemplatesTask\n\nclass ExportScalaTemplatesTaskTest extends AbstractTaskTester {\n\n    ExportScalaTemplatesTaskTest(){\n        super( ExportScalaTemplatesTask )\n    }\n\n    @Test void export(){\n        task.export()\n\n        assertFileExists folder.root, 'templates/scala/build.gradle.tmpl'\n        assertFileExists folder.root, 'templates/scala/scala-class.tmpl'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/scala/InitScalaProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.scala\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.scala.AbstractScalaProjectTask.PROJECT_GROUP\nimport static templates.tasks.scala.AbstractScalaProjectTask.SCALA_VERSION\nimport static templates.tasks.scala.AbstractScalaProjectTask.USE_FAST_SCALA_COMPILER\n\nclass InitScalaProjectTaskTest extends AbstractTaskTester {\n\n    InitScalaProjectTaskTest(){\n        super( InitScalaProjectTask )\n    }\n\n    @Test void init(){\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[SCALA_VERSION] = '2.9.0'\n        project.ext[USE_FAST_SCALA_COMPILER] = true\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/scala'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/scala'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'scalaVersion = \\'2.9.0\\'', 'scalaCompileOptions.useCompileDaemon = true', 'group = \\'test-group\\''\n        assertFileContains folder.root, 'gradle.properties', 'version=0.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/webapp/CreateWebappProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.webapp.AbstractWebappProjectTask.NEW_PROJECT_NAME\nimport static templates.tasks.webapp.AbstractWebappProjectTask.PROJECT_GROUP\nimport static templates.tasks.webapp.AbstractWebappProjectTask.PROJECT_PARENT_DIR\nimport static templates.tasks.webapp.AbstractWebappProjectTask.PROJECT_VERSION\nimport static templates.tasks.webapp.AbstractWebappProjectTask.USE_JETTY_PLUGIN\n\nclass CreateWebappProjectTaskTest extends AbstractTaskTester {\n\n    CreateWebappProjectTaskTest(){\n        super( CreateWebappProjectTask )\n    }\n\n    @Test void 'create: jetty'(){\n        project.ext[PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[NEW_PROJECT_NAME] = 'tester'\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[PROJECT_VERSION] = '1.1.1'\n        project.ext[USE_JETTY_PLUGIN] = 'y'\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/java'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/java'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'group = \\'test-group\\'', 'apply plugin: \\'jetty\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n\n    @Test void 'create: war'(){\n        project.ext[PROJECT_PARENT_DIR] = folder.getRoot() as String\n        project.ext[NEW_PROJECT_NAME] = 'tester'\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[PROJECT_VERSION] = '1.1.1'\n        project.ext[USE_JETTY_PLUGIN] = 'n'\n\n        task.create()\n\n        assertFileExists folder.root, 'tester/src/main/java'\n        assertFileExists folder.root, 'tester/src/main/resources'\n        assertFileExists folder.root, 'tester/src/test/java'\n        assertFileExists folder.root, 'tester/src/test/resources'\n        assertFileExists folder.root, 'tester/LICENSE.txt'\n\n        assertFileContains folder.root, 'tester/build.gradle', 'group = \\'test-group\\'', 'apply plugin: \\'war\\''\n        assertFileContains folder.root, 'tester/gradle.properties', 'version=1.1.1'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/webapp/ExportWebappTemplatesTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\n\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\n\nclass ExportWebappTemplatesTaskTest extends AbstractTaskTester {\n\n    ExportWebappTemplatesTaskTest(){\n        super( ExportWebappTemplatesTask )\n    }\n\n    @Test void export(){\n        task.export()\n\n        assertFileExists folder.root, 'templates/webapp/build.gradle.tmpl'\n        assertFileExists folder.root, 'templates/webapp/web-xml.tmpl'\n    }\n}\n"
  },
  {
    "path": "src/test/groovy/templates/tasks/webapp/InitWebappProjectTaskTest.groovy",
    "content": "/*\n * Copyright (c) 2011,2012 Eric Berry <elberry@tellurianring.com>\n * Copyright (c) 2013 Christopher J. Stehno <chris@stehno.com>\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage templates.tasks.webapp\nimport org.junit.Test\nimport templates.AbstractTaskTester\n\nimport static templates.tasks.webapp.AbstractWebappProjectTask.PROJECT_GROUP\nimport static templates.tasks.webapp.AbstractWebappProjectTask.USE_JETTY_PLUGIN\n\nclass InitWebappProjectTaskTest extends AbstractTaskTester {\n\n    InitWebappProjectTaskTest(){\n        super( InitWebappProjectTask )\n    }\n\n    @Test void 'init: jetty'(){\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[USE_JETTY_PLUGIN] = 'y'\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/java'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/java'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'apply plugin: \\'jetty\\''\n    }\n\n    @Test void 'init: war'(){\n        project.ext[PROJECT_GROUP] = 'test-group'\n        project.ext[USE_JETTY_PLUGIN] = 'n'\n\n        task.init()\n\n        assertFileExists folder.root, 'src/main/java'\n        assertFileExists folder.root, 'src/main/resources'\n        assertFileExists folder.root, 'src/test/java'\n        assertFileExists folder.root, 'src/test/resources'\n        assertFileExists folder.root, 'LICENSE.txt'\n\n        assertFileContains folder.root, 'build.gradle', 'apply plugin: \\'war\\''\n    }\n}\n"
  }
]