diff --git a/README.md b/README.md new file mode 100644 index 0000000..e782371 --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ +# Packman +Project Scaffolding for Professionals + +## Motivation +At SecureNative, we push new micro-services on a daily basis and the job of creating new projects, wiring it up, importing our common libs, etc.. is a tedious job and should be automated :) +`packman` is a simple tool that allows you to generate boilerplate without sacrificing your freedom as a developer, no new DSL to learn, no weird config files to edit, only you and your favourite language decides the limits. + +We are using `packman` intensively at SecureNative + +## Prerequisites +- Go 1.11 or above with [Go Modules enabled](https://github.com/golang/go/wiki/Modules#how-to-use-modules) +- Basic knowledge of [Go's templating engine](https://curtisvermeeren.github.io/2017/09/14/Golang-Templates-Cheatsheet) +- Git account (Github, Bitbucket, GitLab, etc...) + +## How to get it +If you have golang installed just use: +`go get -u github.com/securenative/packman` + +You can also use one of the pre-built binaries from our [releases page](https://github.com/securenative/packman/releases) + +after that you can use `packman` to get templates, try it now: +```bash +packman unpack \ + https://github.com/securenative/packman-init \ + packmanExample \ + -author matan \ + -company SecureNative +``` + +## API Reference + +### Render +While working on your *template project* you'll need to constantly render your template to check if it works. +The `packman render` command will take a local path to the template's folder and a list of custom flags and +in return will create a new folder with the rendered template. +```bash +packman render \ + -key-1 value-1 \ + -key-2 value-2 \ + ... \ + -key-n value-n +``` + +For example if I have a template called `myProject` and it requires the following flags: `host`, `port` running: +```bash +packman render myProject \ + -host 127.0.0.1 \ + -port 9909 +``` +will create a new folder called `myProject-rendered` with the rendered template. + +### Unpack +Unpack is the **"wet"** version of render, the only difference is that unpack will ask you where to get the template from (i.e which git repository to clone). +```bash +packman unpack \ + -key-1 value-1 \ + -key-2 value-2 \ + ... \ + -key-n value-n +``` + +### Pack +Pack will just commit and push your changes to the remote git repository, if you prefer (and basically you should) you can manage it manually with your favourite git client. +```bash +packman pack +``` + +### Auth +To get access to private repositories or to use the `packman pack` command you'll need to authenticate with git. +```bash +packman auth +``` + +### Change the default script engine +While the default script engine uses GO and as much as we love GO at SecureNative, `packman` was built as an un-opinionated tool so we don't impose any limit on your scripting capabilities. +You can use any language to write scripts, damn, you can even use bash scripts to generate your template as long as you respect the interface with `packman`. +`packman` scripts defines 2 standards that you must comply to: +1) The script will be executed with 2 additional command-line arguments, the path to the flags.json file and the path to save the reply.json file. +2) The script has to write its reply (as json) to the reply path (provided as a cli argument) + +You can see its pretty simple requirements to fulfil, you can check [this code](https://github.com/securenative/packman/blob/master/pkg/packman.go) to better understand it. + +```bash +packman script "go run" # Will run go files +packman script "python" # will run python files +packman script "node" # will run javascript files +``` \ No newline at end of file