Skip to content

Commit 64e924b

Browse files
author
Heiko Alexander Weber
committed
#patch | changed mail, + ADRs
1 parent c3f2b58 commit 64e924b

10 files changed

Lines changed: 82 additions & 139 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "complate"
33
version = "0.0.0"
4-
authors = ["Heiko Alexander Weber <heiko.a.weber@gmail.com>"]
4+
authors = ["Heiko Alexander Weber <haw@voidpointergroup.com>"]
55
edition = "2018"
66
license = "MIT"
77
description = "Standardizing messages the right way."

docs/README.md

Lines changed: 9 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,14 @@
1-
# complate
1+
# How to use ADRs
22

3-
[![crates.io](https://img.shields.io/crates/v/complate.svg)](https://crates.io/crates/complate)
4-
[![crates.io](https://img.shields.io/crates/d/complate?label=crates.io%20downloads)](https://crates.io/crates/complate)
5-
[![pipeline](https://github.com/replicadse/complate/workflows/pipeline/badge.svg)](https://github.com/replicadse/complate/actions?query=workflow%3Apipeline)
6-
[![docs.rs](https://img.shields.io/badge/docs.rs-latest-blue)](https://docs.rs/crate/complate/latest)
3+
This piece of documentation uses the tool `mdbook` in order to generate a servable website.
74

8-
## Introduction and use case
5+
## How to install
96

10-
`complate` (a portmanteau of "commit" and "template") is a project that allows the user to generate strings in a guided way. The original use-case of this was the standardization of GIT commit messages.\
11-
Many projects and teams are standardizing their commit messages in a certain way. This is somewhat error prone and people just tend to mess things up. Spaces, spelling errors or linebreaks are common issues that lead to inconsistency. It can also have more effects than just consistency in the format. If you use [github-tag-action by anothrnick](https://github.com/anothrNick/github-tag-action) in GitHub Workflows (like this project does), the commit message can have direct influence on your version number that is generated on build.
7+
1) Make sure that you have `cargo` installed
8+
2) Make sure that you have `clang` or any other fitting C compiler installed
9+
3) Install `mdbook` via `cargo`: \
10+
`cargo install mdbook`
1211

13-
## Installation via `cargo`
14-
Find this project on [crates.io](https://crates.io/crates/complate).
15-
Install or update (update needs the `--force` flag) the software by executing:
16-
```
17-
cargo install complate --force
18-
```
12+
## How to serve
1913

20-
## Idea
21-
22-
The idea for the concrete use case of standardizing GIT commit messages is to have a configuration file inside the repository which is read by the program. You are then able to select a template that you would like to use for your message. The configuration file declares the template (in handlebars syntax) as well as variables and how to replace them.
23-
24-
## Usage
25-
26-
In order to use `complate`, the recommended way is to place the program including the configuration files and templates into the repository itself. Consider the following structure:
27-
```
28-
Repository root
29-
├── .git
30-
├── .complate
31-
│ ├── complate
32-
│ ├── config.yml
33-
│ └── templates
34-
│ └── template-a.tpl
35-
├── src
36-
│ └── *
37-
└── docs
38-
└── *
39-
```
40-
41-
`complate` writes the generated message to the stdout pipe.\
42-
Expecting the recommended folder structure, you should be able to simply run `./.complate/complate print | git commit -F -` in order to create a new standardized commit.
43-
44-
## General overview
45-
46-
The template itself can be declared as string inside the configuration file or as a reference to a file that contains the template. The template string can contain variables in handlebars syntax ( `{{ variable}}` ). All distinct variables must have a representation in the according section that then also defines on how to find the value for this variable.
47-
48-
## Technical documentation
49-
50-
### Disclaimer
51-
52-
All features that are marked as `experimental` are _not_ considered a public API and therefore eplicitly not covered by the backwards-compatibility policy inside a major version (see [semver v2](https://semver.org)). Use these features on your own risk!
53-
54-
### Features
55-
56-
|Name|Description|Default|
57-
|-- |-- |-- |
58-
|backend+cli|The CLI backend which maps to the original dialoguer implementation.|Yes|
59-
|backend+ui|The UI backend which maps to the new cursive/fui implementation.|No|
60-
61-
#### `backend+`
62-
63-
Either one of the `backend+` flags (or both) MUST be enabled for `complate` to work (it won't compile otherwise).
64-
65-
### Application level arguments
66-
67-
|Name|Short|Long|Description|
68-
|-- |-- |-- |-- |
69-
|Experimental|-e|--experimental|Activates experimental features that are not stable yet. All features that are marked as experimental are not referenced when keeping backwards compatibility inside one major version.|
70-
71-
### Commands
72-
73-
|Command|Description|Status|
74-
|-- |-- |-- |
75-
|help|Prints the help to `STDOUT`.|stable|
76-
|init|Initializes the default configuration in `./.complate/config.yml`|stable|
77-
|print|Prompts for the template, prompts for variable values and prints the data to `STDOUT`|stable|
78-
79-
### `print` command flags
80-
|Name|Short|Long|Description|Status|
81-
|-- |-- |-- |-- |-- |
82-
|Config file path|-c|--config|The path to the configuration file that shall be used. This path can be relative or absolute. The default path is `./complate/config.yml`.|stable|
83-
|Shell trust||--shell-trust|Enables the shell value provider for replacing template placeholders. Due to the potential security risk with this option, it is disabled by default. Possible values for this option are `none` (default), `prompt` and `ultimate`|stable|
84-
|Backend|-b|--backend|Defines the backend for the user interaction.|`CLI` is stable. `UI` is experimental (feature = "backend+ui").|
85-
86-
### Configuration file
87-
88-
Please find an example for the configuration file here:
89-
```
90-
version: 0.6
91-
templates:
92-
default:
93-
content:
94-
inline: |-
95-
{{ a.summary }} | {{ e.version }}
96-
Components: [{{ f.components }}]
97-
Author: {{ b.author.name }} | {{ c.author.account }}
98-
99-
Files:
100-
{{ d.git.staged.files }}
101-
values:
102-
a.summary:
103-
prompt: "Enter the summary"
104-
b.author.name:
105-
shell: "git config user.name | tr -d '\n'"
106-
c.author.account:
107-
shell: "whoami | tr -d '\n'"
108-
d.git.staged.files:
109-
shell: "git diff --name-status --cached"
110-
e.version:
111-
select:
112-
text: Select the version level that shall be incremented
113-
options:
114-
- "#patch"
115-
- "#minor"
116-
- "#major"
117-
f.components:
118-
check:
119-
text: Select the components that are affected
120-
options:
121-
- security
122-
- command::print
123-
- backend+cli
124-
- backend+ui
125-
- misc
126-
127-
```
128-
This project also uses complate templates that can be found in `./complate/config.yml`.
129-
130-
#### Value providers
131-
132-
|Type|Description|Fields|
133-
|-- |-- |-- |
134-
|static|Replaces the value by a static string.|-|
135-
|prompt|Asks the user for input when executing the templating process.|text: string|
136-
|shell|Invokes a certain shell command and renders STDOUT as replacing string into the variable. Due to the fact that this option can run arbitrary shell commands, it is disabled by default. Pass the `--shell-trust` flag to the CLI in order to activate this feature.|-|
137-
|select|Gives the user the option to select _one_ item from the provided array of items.|text: string, options: []string|
138-
|check|Gives the user the option to select _n_ items from the provided array of items.|text: string, options: []string|
139-
140-
<!-- cargo-sync-readme start -->
141-
142-
143-
<!-- cargo-sync-readme end -->
14+
1) Execute `mdbook serve` in `documentation/adrs`.

docs/adrs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

docs/adrs/book.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[book]
2+
authors = ["Heiko Alexander Weber"]
3+
language = "en"
4+
multilingual = false
5+
src = "src"
6+
title = "Architecture Decision Records"
7+
8+
[output.html]
9+
mathjax-support = true

docs/adrs/src/SUMMARY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Summary
2+
3+
Architecture
4+
5+
- [ADR 1: Usage of ADRs](./adrs/1.md)
6+
- [ADR 2: Usage of key words](./adrs/2.md)
7+
- [ADR 3: Versioning](./adrs/3.md)
8+
- [ADR 4: Experimental flag](./adrs/4.md)
9+
- [ADR 5: Usage of feature flags](./adrs/5.md)

docs/adrs/src/adrs/1.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ADR 1: Usage of ADRs
2+
3+
## Summary
4+
5+
This project uses ADRs. ADRs are documented in this repository and format. In doubt, the documents in this repository and documentation are to be considered as the single source of truth.\
6+
ADRs MUST be formatted in a way that is compatible with the [`mdbook tool`](https://crates.io/crates/mdbook).
7+
8+
## Authors
9+
10+
* Heiko Alexander Weber\
11+
[haw@voidpointergroup.com](mailto:haw@voidpointergroup.com)

docs/adrs/src/adrs/2.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ADR 2: Usage of key words
2+
3+
## Summary
4+
5+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document and in all documents in it's subtree as well as all documents that are directly related to this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14), [RFC2119](https://tools.ietf.org/html/rfc2119) and [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here.
6+
7+
## Authors
8+
9+
* Heiko Alexander Weber\
10+
[haw@voidpointergroup.com](mailto:haw@voidpointergroup.com)

docs/adrs/src/adrs/3.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ADR 3: Versioning
2+
3+
## Summary
4+
5+
This project makes use of [the semver v2 versioning scheme](https://semver.org) for all parts of the official public API. The public stable API is a subset of all available features (see [ADR 4](./4.md)).
6+
7+
## Authors
8+
9+
* Heiko Alexander Weber\
10+
[haw@voidpointergroup.com](mailto:haw@voidpointergroup.com)

docs/adrs/src/adrs/4.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ADR 4: Experimental flag
2+
3+
## Summary
4+
5+
There is a application level argument (flag) `experimental` (`-e` | `--experimental`) that indicates that experimental features can now be accessed. This flag explicitly marks features that are NOT part of the official public API and therefore NOT considered when applying the versioning scheme (see [ADR 3](./3.md)).\
6+
This flag is designed to be used with and therefore CAN be used with [feature flags](./5.md).
7+
8+
## Authors
9+
10+
* Heiko Alexander Weber\
11+
[haw@voidpointergroup.com](mailto:haw@voidpointergroup.com)

docs/adrs/src/adrs/5.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ADR 5: Usage of feature flags
2+
3+
## Summary
4+
5+
This project makes use of cargo feature flags. Feature flags count as part of the public API and are therefore to be considered when applying the version rules IF NOT marked as experimental (see [ADR 4](./4.md)).\
6+
All feature flags MUST be documented in an appropriate manner in the README.md file.
7+
8+
## Authors
9+
10+
* Heiko Alexander Weber\
11+
[haw@voidpointergroup.com](mailto:haw@voidpointergroup.com)

0 commit comments

Comments
 (0)