diff --git a/README.md b/README.md index 40194fd6d4b2d4e8521cc30cd4e127ab33e831c8..51e1d0767fc067569dd6c8c2a3121d83f641167d 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ For more details, see [Introduction](https://github.com/tmrts/boilr/wiki/Introdu Grab the one that fits your architecture, and you're all set to save time by using templates! * **Full Power of [Golang Templates](https://golang.org/pkg/text/template/)** - 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 +* **Dead-Simple Template Creation** - Creating boilerplate templates are very easy, check out the [license template](https://github.com/tmrts/boilr-license) 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. +You can download them directly or run the installation script. Please see [Installation](https://github.com/tmrts/boilr/wiki/Installation) page for more information. @@ -42,20 +42,20 @@ 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: -```bash +```bash 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: -```bash +```bash boilr template save <template-path> <template-tag> boilr template save ~/boilr-license license -``` +``` The saved template will be saved to local `boilr` registry. @@ -86,7 +86,7 @@ And the following `project.json` context file: When using the template with the following command: -```bash +```bash boilr template use <template-tag> <target-dir> boilr template use license /workspace/tmrts/example-project/ ``` @@ -121,6 +121,4 @@ Take a look at the [Templates](https://github.com/tmrts/boilr/wiki/Templates) pa # 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. -The [Wiki](https://github.com/tmrts/boilr/wiki) is public and edits are open to everyone, feel free to contribute to sections where you feel needs improvement. - At this stage, user feedback is of **utmost importance**, every contribution is welcome however small it may be. diff --git a/wiki/Creating-Templates.md b/wiki/Creating-Templates.md new file mode 100644 index 0000000000000000000000000000000000000000..8685265ab1daae507d71bdd2b9227d926ff53cdc --- /dev/null +++ b/wiki/Creating-Templates.md @@ -0,0 +1,70 @@ +# Creating Templates +At the top-level of your repository include an optional "project.json" +file that contains the default values that you'd like to substitute + +```json +{ + "Name": "example-project", + "Author": "Tamer Tas", + "Email": "contact@tmrts.com", + "PrintHomeDir": true, + "License": [ + "MIT", + "GNU GPL v3.0", + "Apache Software License 2.0" + ] +} +``` + +Now, create a `template` folder that contains all the files that you'd like to +be part of your project template. When using a template, the contents of this +folder will be parsed and copied to the target directory requested by user + +`template` directory: +```txt +template/ + LICENSE + README.md + {{Name}}.go + {{time "Mon Jan 2 15:04:05 -0700 MST 2006"}}.log +``` + +`LICENSE` file: +```txt +{{if eq License "MIT"}} +// MIT License + +{{else if eq License "GNU GPL v3.0"}} +// GNU GPL v3.0 License + +{{else if eq License "Apache Software License 2.0"}} +// Apache License + +{{end}} +``` + +`README` file: +```markdown +This project was created by {{Author}}. + +This project is under the {{License}} license. + +For more information please send an e-mail to `{{Email}}`. + +{{if PrintHomeDir}} +During the project creation the home directory path was `{{env "HOME" | toLower}}`. +{{end}} +``` + +## File/Directory Name Templating + +File/Directory names can also be templated: + +- `{{Name}}.go` file will be `example-project.go`. +- `{{time "Mon_Jan_2_15:04_2006"}}.log` file will be formatted with the given example +time format using the current time. It will become `Mon_Dec_14_15:08_2015.log` + +**Note:** +- Defined values are by convention, capital CamelCase and functions are lowercase camelCase. +- The user will be prompted for a choice for each value in the `project.json` template +- Only the contents of the `template` folder will be copied. diff --git a/wiki/Installation.md b/wiki/Installation.md new file mode 100644 index 0000000000000000000000000000000000000000..5a92424712301141dc85e32ce7417231cdda3551 --- /dev/null +++ b/wiki/Installation.md @@ -0,0 +1,24 @@ +# Install Script +Download the latest version +of [install](https://raw.githubusercontent.com/tmrts/boilr/master/install) +script, which is also included in +every [release](https://github.com/tmrts/boilr/releases), and run it to install +the `boilr` binary. The `boilr` binary will be installed to `~/bin/boilr`. + +# Binary Release +You can find the latest binary +releases [here](https://github.com/tmrts/boilr/releases). Grab the one the suits +your architecture and operating system and start using it. + +# Building from Source +Make sure you have setup a Go >=1.6 development environment and the `GOPATH` +environment variable is configured +(see [official docs](https://golang.org/doc/code.html#GOPATH) for instructions) +and your `PATH` includes `$GOPATH/bin`. + +Then use the following command +```bash +go get github.com/tmrts/boilr +``` + +The binary will be installed into `$GOPATH/bin`. diff --git a/wiki/Introduction.md b/wiki/Introduction.md new file mode 100644 index 0000000000000000000000000000000000000000..779ff85324e31ecb0972adf0a86e894d0ff104de --- /dev/null +++ b/wiki/Introduction.md @@ -0,0 +1,20 @@ +`boilr` is a *fast* & *powerful* command-line project templating tool. +It is written in Go and supports Go templates for project templates. + +## Motivation + +Coding usually requires a lot of tedious work at the beginning, such as +creating license files, Makefiles, gathering asset files, creating a working skeleton. + + +## Solution + +`boilr` is a cli-tool with a pragmatic approach to creating projects and +eliminating boilerplate coding parts. `boilr` has the following goals: + +- Make creating projects easier and error-free. +- Eliminate dependencies and create a single binary that is portable. + +## Where to start? +After following the [Installation](Installation.md) page, take a look at the [Usage](Usage.md) +page for details on how to start using `boilr`. diff --git a/wiki/Templates.md b/wiki/Templates.md new file mode 100644 index 0000000000000000000000000000000000000000..3517dff5e41512a714339808afd15cabe6891fa0 --- /dev/null +++ b/wiki/Templates.md @@ -0,0 +1,16 @@ +Here is a list of project templates + +## Applications +- [Apache Spark App Template for Scala](https://github.com/tmrts/boilr-spark) +- [Docker Compose PHP Template](https://github.com/rawkode/boilr-docker-compose-php) +- [Docker Host Vagrant Template](https://github.com/dmstr/vado-ligure) +- [Electron Quick Start Template](https://github.com/tmrts/boilr-electron) +- [Makefile](https://github.com/littlemanco/boilr-makefile) + +- [Boilr Template for a Boilr Template](https://github.com/littlemanco/boilr-template) +- [License Template](https://github.com/tmrts/boilr-license) + +## Kubernetes +- [Kubernetes Namespace](https://github.com/littlemanco/boilr-k8snamespace) +- [Kuberentes Service](https://github.com/littlemanco/boilr-k8sservice) +- [Kubernetes Deployment](https://github.com/littlemanco/boilr-k8sdeployment) diff --git a/wiki/Usage.md b/wiki/Usage.md new file mode 100644 index 0000000000000000000000000000000000000000..855837b41bf84a9a17cc126bf8b56453ab270402 --- /dev/null +++ b/wiki/Usage.md @@ -0,0 +1,32 @@ +# Usage +Use `boilr help` to get the list of available commands. + +## Download Template +In order to download a template from a github repository, use the following command: + +```bash +boilr template download <github-repo-path> <template-name> +boilr template download tmrts/boilr-license license +``` + +The downloaded template will be saved to local `boilr` registry. + +## Save Local Template +In order to save a template from filesystem to the template registry use the following command: + +```bash +boilr template save <template-path> <template-name> +boilr template save ~/boilr-license license +``` + +The saved template will be saved to local `boilr` registry. + +## Use Template +In order to use a template from template registry use the following command: + +```bash +boilr template use <template-name> <target-dir> +boilr template use license ~/Workspace/example-project/ +`` + +You will be prompted for values when using a template. diff --git a/wiki/Wiki-Homepage.md b/wiki/Wiki-Homepage.md new file mode 100644 index 0000000000000000000000000000000000000000..a60f501d1267a47c6a603f9962bfe1e262a97fbe --- /dev/null +++ b/wiki/Wiki-Homepage.md @@ -0,0 +1,5 @@ +- [Introduction](Introduction.md) +- [Installation](Installation.md) +- [Usage](Usage.md) +- [Creating Templates](Creating-Templates.md) +- [Project Templates](Templates.md)