:zap: boilerplate template manager that generates files or directories from template repositories

Boilr

Build Status License Release Version Code Quality Documentation Chat Room

Are you doing the same steps over and over again every time you start a new programming project?

Boilr is here to help you create projects from boilerplate templates.

Usage Demonstration

For more details, see Introduction page.

Features

  • No dependencies (NodeJS, Python Interpreter etc.) - Boilr is a single statically linked binary. Grab the one that fits your architecture, and you're all set to save time by using templates!
  • Full Power of Golang Templates - Golang has powerful templating constructs which are very easy to learn and powerful.
  • Dead-Simple Template Creation - Creating boilerplate templates are very easy, check out the license template to see a simple, but very useful template for adding licenses to new projects with a single command.

Installation

Binaries for Linux & OSX are built automatically by Travis every release. You can download them directly or run the installation script.

Please see Installation page for more information.

Getting Started with Boilr

Use boilr help to get the list of available commands.

Download a Template

In order to download a template from a github repository, use the following command:

boilr template download <github-repo-path> <template-tag>
boilr template download tmrts/boilr-license license

The downloaded template will be saved to local boilr registry.

Save a Local Template

In order to save a template from filesystem to the template registry use the following command:

boilr template save <template-path> <template-tag>
boilr template save ~/boilr-license license

The saved template will be saved to local boilr registry.

Use a Template

For a Boilr template with the given directory structure:

.
├── project.json
├── README.md
└── template
    └── LICENSE

And the following project.json context file:

{
    "Author": "Tamer Tas",
    "Year": "2015",
    "License": [
        "Apache Software License 2.0",
        "MIT",
        "GNU GPL v3.0"
    ]
}

When using the template with the following command:

boilr template use <template-tag> <target-dir>
boilr template use license /workspace/tmrts/example-project/

The user will be prompted as follows:

[?] Please choose an option for "License"
    1 -  "Apache Software License 2.0"
    2 -  "MIT"
    3 -  "GNU GPL v3.0"
    Select from 1..3 [default: 1]: 2
[?] Please choose a value for "Year" [default: "2015"]:
[?] Please choose a value for "Author" [default: "Tamer Tas"]:
[✔] Created /workspace/tmrts/example-project/LICENSE
[✔] Successfully executed the project template license in /workspace/tmrts/example-project

For more information please take a look at Usage and Creating Templates pages in the wiki.

List of Templates

Electron Logo Docker Logo Kubernetes Logo

Take a look at the Templates page for an index of project templates, examples, and more information.

Need Help? Found a bug? Want a Feature?

If you'd like to contribute, share your opinions or ask questions, please feel free to open an issue.

At this stage, user feedback is of utmost importance, every contribution is welcome however small it may be.

Comments
  • Cut a release.

    Cut a release.

    It'd be nice to get the folder changes in a distributed package. It affects us, as we create a template for PHP software called "Magento", which heavily relies on folders.

    If i can help in any way, please let me know!

  • Possibility of

    Possibility of "if" in templates?

    Hey @tmrts

    I'm really tempted to use boilr, but one critical feature is missing. I need the possibility to create a condition in the questions. Nothing very complicated, but still. I had the idea of implementing it on my own, but there are so many libraries and tools out there, I didn't want to make "just another templater".

    So I found your boilr.

    Do you think it would be possible to add an if condition to the project.json?

    Like:

    {
        "AppName": "Demo",
        "ExpertMode": [
            true,
            false
        ],
        "FolderName": {
            "value": "Demo",
            "condition": "ExpertMode"
        }
    }
    

    Only ask the question about the FolderName if the answer to ExpertMode is evaluated truthly.

    Cheers Chris

  • Automatically `init`

    Automatically `init`

    Boilr should ensure the configuration directory exists, rather than relying on installation script or a user running 'init'

    I'm not sure if this is something you'll want to merge, but I think the user-experience is nicer.

    Should you wish to adopt this, I'm happy to update this PR and remove init command completely, if wanted.

  • Unwanted Whitespace

    Unwanted Whitespace

    When composing slightly more complicated templates, there's no way to trim the whitespace.

    Example:

    my_key:
        my_super_app: {{ template app_type }}
        my_super_app_version: {{ template app_version }}
    
    {{ define "template_app_type" }}
    {{ if eq app_type "php" }}
        {{ if eq php_version "7" }}
            php_7
        {{ else if eq php_version "5" }}
            php_5
        {{ end }}
    {{ else if eq app_type "ruby" }}
        ruby
    {{ end }}
    {{ end }}
    

    Outputs:

    my_key:
        my_super_app: 
    
            php_7
        my_super_app_version: version
    

    I know | trimSpace exists, but not when using template. Also go template support {{- -}} - but that doesn't seem to work with boilr?

    Please advise when you can - I'm assuming maybe I'm doing something wrong :)

  • Is this project dead?

    Is this project dead?

    I love this project and use it for a while ...

    It seems that there are quite a few folks out there being willing to contribute (see the PRs).

    @tmrts Can we make this repo open to other contributors + maintainers? It would be really great to get some traction on this repo ...

    Regards Stefan

  • Fixes issue with late-binding inside closure

    Fixes issue with late-binding inside closure

    It was getting the last value of v instead of the specific value at the time.

    So I noticed this happening when I performed the fallowing:

    boilr template use <template> <targe> -f
    

    So -f should use the defaults without prompting... what happend was dat it would fill in the last value inside the project.json and fill that in on all spots.

  • Issues while installing from source

    Issues while installing from source

    I'm running into issues while trying to install the package via go get when starting from a completely fresh Go workspace.

    $ go get github.com/tmrts/boilr
    src/srcd.works/go-git.v4/repository.go:10:2: use of internal package not allowed
    

    I'm using Go 1.8 locally.

     $ go version
    go version go1.8 darwin/amd64
    

    Let me know if there's any additional information I can provide to help debug the issue.

  • Feature: Update a Template

    Feature: Update a Template

    Hi @tmrts,

    This PR is not ready for merge yet, as I'm sure you'll see. I got this so-far and I'm not sure how to solve the next problem.

    When running the Pull, this does seem to work but then fails with work tree not clean, which is due to the metadata.json

    Thoughts on this?

    I checked go-git's docs for PullOptions, but can't see anything to ignore this.

  • panic: template index.js:3 function

    panic: template index.js:3 function "Name" not defined

    When attempting to save a local template of the following i get the title'd error

    Command

    boilr template save templates/feature feature

    Output

    panic: template: index.js:3: function "Name" not defined
    
    goroutine 1 [running]:
    panic(0x41c800, 0xc42011dde0)
    	/home/travis/.gimme/versions/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1a1
    text/template.Must(0x0, 0x6a6dc0, 0xc42011dde0, 0x1)
    	/home/travis/.gimme/versions/go1.7.linux.amd64/src/text/template/helper.go:23 +0x66
    github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute.func2(0xc420188120, 0x58, 0x6af6e0, 0xc42017ac30, 0x0, 0x0, 0x0, 0x0)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/template/template.go:240 +0x76c
    path/filepath.walk(0xc420188120, 0x58, 0x6af6e0, 0xc42017ac30, 0xc420149470, 0x0, 0x0)
    	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:351 +0x81
    path/filepath.walk(0xc42000bd60, 0x4f, 0x6af6e0, 0xc420115ba0, 0xc420149470, 0x0, 0x1)
    	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:376 +0x344
    path/filepath.Walk(0xc42000bd60, 0x4f, 0xc420149470, 0x0, 0x0)
    	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:398 +0xd5
    github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute(0xc42016a1c0, 0xc42000bbd0, 0x4f, 0xc42016a1c0, 0x0)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/template/template.go:254 +0xc1
    github.com/tmrts/boilr/pkg/cmd/util.testTemplate(0x7fff5fbff7a4, 0x11, 0x0, 0x0)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/util/validation.go:86 +0x15e
    github.com/tmrts/boilr/pkg/cmd/util.ValidateTemplate(0x7fff5fbff7a4, 0x11, 0xc4200abaa0, 0x59926, 0xc420147701)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/util/validation.go:107 +0x27c
    github.com/tmrts/boilr/pkg/cmd.MustValidateTemplate(0x7fff5fbff7a4, 0x11)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/must_validate.go:31 +0x41
    github.com/tmrts/boilr/pkg/cmd.glob..func7(0x6d4220, 0xc420147740, 0x2, 0x2)
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/save.go:31 +0x12f
    github.com/spf13/cobra.(*Command).execute(0x6d4220, 0xc4201475a0, 0x2, 0x2, 0x6d4220, 0xc4201475a0)
    	/home/travis/gopath/src/github.com/spf13/cobra/command.go:648 +0x443
    github.com/spf13/cobra.(*Command).ExecuteC(0x6d3340, 0xc4200abf00, 0x2f, 0xc42011d94a)
    	/home/travis/gopath/src/github.com/spf13/cobra/command.go:735 +0x367
    github.com/spf13/cobra.(*Command).Execute(0x6d3340, 0xc4200abef8, 0x1)
    	/home/travis/gopath/src/github.com/spf13/cobra/command.go:693 +0x2b
    github.com/tmrts/boilr/pkg/cmd.Run()
    	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/root.go:52 +0x6c8
    main.main()
    	/home/travis/gopath/src/github.com/tmrts/boilr/boilr.go:6 +0x14
    

    project.json

    {
      "Name": "feature"
    }
    

    index.js

    import React, { Component, PropTypes } from 'react';
    
    class {{Name}} extends Component {
    
      state = {};
    
      static propTypes = {};
    
      static defaultProps = {};
    
      render() {
        return (
          <div></div>
        );
      }
    }
    
    export default {{Name}};
    

    am i missing something?

  • "[✘] environment variable ${HOME} should be set" error on Windows

    The title basically describes the error. I've created a environment variable HOME to my user directory but it's not getting recognized. I'm assuming Windows isn't supported, but is there a solution to this?

    I built from source by running go get github.com/tmrts/boilr.

  • Add at lest undersore as allowed character to TAGs names.

    Add at lest undersore as allowed character to TAGs names.

    Currently boilr is not allowing use one of character _ - in tag name. I think that this will be more very helpful.

    Examples:

    # Not easy to read
    sometag01
    sometag02
    
    # Easier to read
    some_tag_01
    some_tag_02
    

    For example if there is 'testing' template and would be nice to add is with different name (version). So this can help test and approve template before renaming (re importing) with the same tag name.

Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.
Rclone (

Rclone ("rsync for cloud storage") is a command line program to sync files and directories to and from different cloud storage providers.

Jan 5, 2023
Rclone ("rsync for cloud storage") is a command-line program to sync files and directories to and from different cloud storage providers.
Rclone (

Website | Documentation | Download | Contributing | Changelog | Installation | Forum Rclone Rclone ("rsync for cloud storage") is a command-line progr

Nov 5, 2021
Command-line tool to organize large directories of media files recursively by date, detecting duplicates.

go-media-organizer Command-line tool written in Go to organise all media files in a directory recursively by date, detecting duplicates.

Jan 6, 2022
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!

F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely.

Dec 31, 2022
A tool to manage all your boilerplate from cli and generate files for you !

A tool to manage all your boilerplate from cli and generate files for you !

Jul 20, 2022
A simple tool which you can use to move through your directories from the command line

Fe What is Fe ? Fe is a simple tool which you can use to move through your direc

Jan 1, 2022
painless task queue manager for shell commands with an intuitive cli interface (execute shell commands in distributed cloud-native queue manager).

EXEQ DOCS STILL IN PROGRESS. Execute shell commands in queues via cli or http interface. Features Simple intuitive tiny cli app. Modular queue backend

Dec 14, 2022
CLI todo manager for iCalendar files.

tdx tdx is a todo manager for iCalendar files. It is designed to work with Vdirsyncer and expects to operate in its storage format. iCalendar-compatib

Dec 23, 2022
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration

TerraCognita Imports your current Cloud infrastructure to an Infrastructure As Code Terraform configuration (HCL) or/and to a Terraform State. At Cycl

Dec 30, 2022
A CLI tool that generates OpenTelemetry Collector binaries based on a manifest.

OpenTelemetry Collector builder This program generates a custom OpenTelemetry Collector binary based on a given configuration. TL;DR $ go get github.c

Sep 14, 2022
create boilerplate structure for neovim plugins

boilit Boil yourself a sweet plugin Installation • Usage Ain't nobody got time to create plugin directories: boilit yourself! boilit creates boilerpla

Dec 28, 2022
A sample FaaS function that gets a stock quote and 30 day history by symbol and returns a HTML page with a generates SVG sparkline.

faas stonks This uses serverless technology to get a stock quote and 30 day sparkline from Yahoo Finance. Deployment Nimbella account Namespace with o

Sep 23, 2021
This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an encoded polyline with the locations found in the log file.
This is a Go Cli app that receives an string path to a log file, and based on it generates  and prints in console an encoded polyline with the locations found in the log file.

GEOENCODE GO CLI APP DESCRIPTION This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an e

Oct 1, 2021
linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

Aug 21, 2022
Onion-Layer-Golang - A web application boilerplate built with go and clean architecture
Onion-Layer-Golang - A web application boilerplate built with go and clean architecture

go-clean-architecture-web-application-boilerplate A web application boilerplate

May 4, 2022
Softsuite - Start from gofiber boilerplate and plan to build large projects

Softsuite Thanks to Cozy (ItsCosmas) to build gofiber boilerplate. I start learn

Apr 25, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.

Table of contents Introduction Reference Contributing Introduction Overview git-xargs is a command-line tool (CLI) for making updates across multiple

Dec 31, 2022
A better way to clone, organize and manage multiple git repositories
A better way to clone, organize and manage multiple git repositories

git-get git-get is a better way to clone, organize and manage multiple git repositories. git-get Description Installation macOS Linux Windows Usage gi

Nov 16, 2022
CLI tool for manipulating GitHub Labels across multiple repositories

takolabel Installation Mac $ brew install tommy6073/tap/takolabel Other platforms Download from Releases page in this repository. Usage Set variables

Nov 3, 2022