Sonntag, 16. Februar 2014

Project Templates with Lazybones

Lazybones is a cool command line tool to manage project templates. The tool can be used for example to create a ratpack project. But you can also manage your own project templates, to create any kind of project with lazybones from your own template.

Install lazybones

Before you can use lazybones you should install it. To install lazybones you can use gvm the Groovy enVironment Manager.

gvm install lazybones

More options how to install lazybones can be found in the project README.

How to create your own template

It is easy to create an own project template. For your own templates project you should use the lazybones template. To create a simple templates project, the following steps should be done:
  1. Create a workspace folder for the template project
  2. Switch to the workspace folder
  3. Create the templates project from the lazybones template: 
    • lazybones create lazybones-project simple-templates-project
  4. Switch into the templates project: cd simple-templates-project
  5. Create a template in the templates folder:
    • mkdir templates/simple-groovy/
    • Add a VERSION file in the folder "templates/simple-groovy". The VERSION file should contain the template version.
    • Add a README.md file in the same folder, the README file should contain the template project description.
    • Add a build.gradle file in the folder to build the template project.
  6. Now you can publish the template by running a gradle task. To install the template project local run: 
    • gradle installAllTemplate
  7. The new template now can be used from the lazybones command line tool:
    • lazybones create simple-groovy 0.0.1 my-app
More details how to publish the template project see the lazybones template development documentation.

Template Logic

If you need some user interaction or template logic add a "lazybones.groovy" file in the template project. Here simple "lazybones.groovy" script:

My simple templates demo project can be found here on github. More details about lazybones see the project documentation and the templates projects.

Kommentare:

  1. Dieser Kommentar wurde vom Autor entfernt.

    AntwortenLöschen
  2. The management tools are just best for collaborating with your team members and to keep track of your project status. I am also using Project Management Tools
    in my company to communicate with team members and to finish the project before deadline without compromising on the quality. These tools are simply best. Thanks!!

    AntwortenLöschen
  3. Der Kommentar wurde von einem Blog-Administrator entfernt.

    AntwortenLöschen