diff --git a/README.md b/README.md index 3763a81..470c31a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**Superseeded by [log4brains](https://github.com/thomvaill/log4brains)** + ADR Tools ========= diff --git a/src/_adr_add_link b/src/_adr_add_link index 9814e45..8a4b892 100755 --- a/src/_adr_add_link +++ b/src/_adr_add_link @@ -14,7 +14,7 @@ awk -v link_type="$link_type" -v target="$(basename $target)" -v target_title="$ } /^##/ { if (in_status_section) { - print link_type " [" target_title "](" target ")" + print link_type " ["target_title"](" target ")" print "" } in_status_section=0 diff --git a/src/_adr_add_link_madr b/src/_adr_add_link_madr new file mode 100755 index 0000000..e594fb0 --- /dev/null +++ b/src/_adr_add_link_madr @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +eval "$($(dirname $0)/adr-config)" +date=${ADR_DATE:-$(date +%Y-%m-%d)} +source=$("$adr_bin_dir/_adr_file" "${1:?SOURCE}") +link_type="${2:?LINK TYPE}" +target=$("$adr_bin_dir/_adr_file" "${3:?TARGET}") + +target_title="$("$adr_bin_dir/_adr_title" "$target")" +updated_status="$link_type [$target_title]($(basename $target))" + +if [ "$link_type" != "Supercedes" ] +then +awk -v n=3 -v s="* Status: $updated_status" '(NR==n) { print s }{ print } ' "$source" > "$source.tmp" && mv "$source.tmp" "$source" +fi + +if [ "$link_type" == "Superceded by" ] +then +sed -e "s/\* Date:.*/\* Date: $date/" "$source" > "$source.tmp" && mv "$source.tmp" "$source" +fi + +if grep -q "## Links" "$source"; then + cat <> "$source" +* $updated_status +EOT +else + cat <> "$source" +## Links + +* $updated_status +EOT +fi diff --git a/src/_adr_generate_graph b/src/_adr_generate_graph index 3d17c44..8ebdf2e 100755 --- a/src/_adr_generate_graph +++ b/src/_adr_generate_graph @@ -31,7 +31,7 @@ eval "$($(dirname $0)/adr-config)" link_prefix= link_extension=.html - +template_type=$("$adr_bin_dir/_adr_type") while getopts e:p: arg do case "$arg" in @@ -51,7 +51,7 @@ shift $((OPTIND-1)) function index() { - basename "$1" | sed -e 's/-.*//' | sed -e 's/^0*//' + basename "$1" | sed -e 's/-.*//' | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' } echo "digraph {" @@ -68,6 +68,7 @@ do then echo " _$(($n - 1)) -> _$n [style=\"dotted\", weight=1];" fi + done echo " }" diff --git a/src/_adr_links b/src/_adr_links index 3556b93..7185d5d 100755 --- a/src/_adr_links +++ b/src/_adr_links @@ -2,4 +2,12 @@ set -e eval "$($(dirname $0)/adr-config)" -"$adr_bin_dir/_adr_status" "$1" | sed -n -E 's/^(.+) \[.*\]\(0*([1-9][0-9]*).*\)/\2=\1/p' +template_type=$("$adr_bin_dir/_adr_type") +case $template_type in + "") + "$adr_bin_dir/_adr_status" "$1" | sed -n -E 's/^(.+) \[.*\]\(0*([1-9][0-9]*).*\)/\2=\1/p' + ;; + madr) + sed 's/^\* //' "$("$adr_bin_dir/_adr_file" "$1")" | sed -n '/Status:/!p' | sed -n -E 's/^([a-zA-Z ]+) \[.*\]\(0*([1-9][0-9]*).*\)/\2=\1/p' + ;; +esac diff --git a/src/_adr_remove_status_madr b/src/_adr_remove_status_madr new file mode 100755 index 0000000..9aec3f2 --- /dev/null +++ b/src/_adr_remove_status_madr @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +eval "$($(dirname $0)/adr-config)" + +current_status=${1:?FROM} +file=$("$adr_bin_dir/_adr_file" "${2:?FILE}") +pattern="* Status: $current_status" +sed -n "/\* Status: $current_status/!p" "$file" > temp && mv temp "$file" diff --git a/src/_adr_title b/src/_adr_title index 92ab09c..01a00eb 100755 --- a/src/_adr_title +++ b/src/_adr_title @@ -2,4 +2,5 @@ set -e eval "$($(dirname $0)/adr-config)" +#sed -n '/---/,/---/p' $("$adr_bin_dir/_adr_file" "$1") | sed -n 's/^title: "\(.*\)"$/\1/p' head -1 $("$adr_bin_dir/_adr_file" "$1") | cut -c 3- diff --git a/src/_adr_type b/src/_adr_type new file mode 100755 index 0000000..0b81678 --- /dev/null +++ b/src/_adr_type @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +eval "$($(dirname $0)/adr-config)" + +if [ -f .adr-type ] +then + cat .adr-type +fi diff --git a/src/adr-init b/src/adr-init index 7e07239..b0900c6 100755 --- a/src/adr-init +++ b/src/adr-init @@ -2,7 +2,7 @@ set -e eval "$($(dirname $0)/adr-config)" -## usage: adr init [DIRECTORY] +## usage: adr init [DIRECTORY] [TYPE] ## ## Initialises the directory of architecture decision records: ## @@ -11,6 +11,14 @@ eval "$($(dirname $0)/adr-config)" ## record architectural decisions with ADRs. ## ## If the DIRECTORY is not given, the ADRs are stored in the directory `doc/adr`. +## +## To initialize with a non default template a directory has to be specified. +## E.g. To use the MADR template and save documentation in the docs directory: +## adr init docs madr +## +## Currently supported templates: +## * madr + if [ ! -z $1 ] then @@ -18,5 +26,19 @@ then echo "$1" > .adr-dir fi -VISUAL=true ADR_TEMPLATE="$adr_template_dir/init.md" \ - "$adr_bin_dir/adr-new" record-architecture-decisions +if [ ! -z $2 ] +then + template_type=$2 + if [ -f "$adr_template_dir/template-$template_type.md" ] && [ -f "$adr_template_dir/init-$template_type.md" ] + then + echo "$2" > .adr-type + else + echo "$2 is not a supported type" + fi + VISUAL=true ADR_TEMPLATE="$adr_template_dir/init-$template_type.md" \ + "$adr_bin_dir/adr-new" record-architecture-decisions +else + VISUAL=true ADR_TEMPLATE="$adr_template_dir/init.md" \ + "$adr_bin_dir/adr-new" record-architecture-decisions +fi + diff --git a/src/adr-link b/src/adr-link index 6fa9f68..6943d85 100755 --- a/src/adr-link +++ b/src/adr-link @@ -18,6 +18,14 @@ source="${1:?SOURCE}" forward_link="${2:?LINK}" target="${3:?TARGET}" reverse_link="${4:?REVERSE-LINK}" +type=$("$adr_bin_dir/_adr_type") -"$adr_bin_dir/_adr_add_link" "$source" "$forward_link" "$target" -"$adr_bin_dir/_adr_add_link" "$target" "$reverse_link" "$source" +if [ -z $type ] +then + type_suffix="" +else + type_suffix="_$type" +fi + +"$adr_bin_dir/_adr_add_link$type_suffix" "$source" "$forward_link" "$target" +"$adr_bin_dir/_adr_add_link$type_suffix" "$target" "$reverse_link" "$source" diff --git a/src/adr-new b/src/adr-new index ae3901b..6832dcf 100755 --- a/src/adr-new +++ b/src/adr-new @@ -73,14 +73,25 @@ done shift $((OPTIND-1)) dstdir=$("$adr_bin_dir/_adr_dir") +template_type=$("$adr_bin_dir/_adr_type") template="$ADR_TEMPLATE" if [ -z $template ] then - template="$dstdir/templates/template.md" - if [ ! -f "$template" ] + if [ -d "$dstdir/templates" ] then - template="$adr_template_dir/template.md" + template="$dstdir/templates/template.md" + else + template="$dstdir/template.md" fi + if [ ! -f "$template" ] + then + if [ -z $template_type ] + then + template="$adr_template_dir/template.md" + else + template="$adr_template_dir/template-$template_type.md" + fi + fi fi title="$@" @@ -91,42 +102,78 @@ then exit 1 fi +#newnum=0 + if [ -d $dstdir ] then - maxid=$(ls $dstdir | grep -Eo '^[0-9]+' | sed -e 's/^0*//' | sort -rn | head -1) +filecount=$(ls $dstdir | grep -Eo '^[0-9]+' | wc -l) + maxid=$(ls $dstdir | grep -Eo '^[0-9]+' | sed -e 's/^0//' | sed -e 's/^0//'| sed -e 's/^0//' | sort -rn | head -1) newnum=$(($maxid + 1)) + if [ -z $maxid ] + then + newnum_madr=1 + else + newnum_madr=$(($maxid + 1)) +fi else newnum=1 + newnum_madr=1 fi -newid=$(printf "%04d" $newnum) +if [ -z $template_type ] +then + newid=$(printf "%04d" $newnum) +else + newid=$(printf "%04d" $newnum_madr) +fi slug=$(echo -n $title | tr -Ccs [:alnum:] - | tr [:upper:] [:lower:] | sed -e 's/[^[:alnum:]]*$//' -e 's/^[^[:alnum:]]*//') dstfile=$dstdir/$newid-$slug.md date=${ADR_DATE:-$(date +%Y-%m-%d)} - mkdir -p $dstdir -cat $template | sed \ + +tempfile=$dstdir/.tempfile + +case $template_type in + "") + cat $template | sed \ -e "s|NUMBER|$newnum|" \ -e "s|TITLE|$title|" \ -e "s|DATE|$date|" \ -e "s|STATUS|Accepted|" \ > $dstfile + ;; + madr) + cat $template | sed \ + -e "s/\[short title of solved problem and solution\]/$title/" \ + -e "s/\* Status: \[accepted | superseeded by \[ADR-0005\](0005-example.md) | deprecated | …\] /\* Status: Accepted/" \ + -e "s/\* Date: \[YYYY-MM-DD when the decision was last updated\] /\* Date: $date/" \ + > $dstfile + ;; +esac + +type=$("$adr_bin_dir/_adr_type") +if [ -z $type ] +then + type_suffix="" +else + type_suffix="_$type" +fi for target in "${superceded[@]}" do - "$adr_bin_dir/_adr_add_link" "$target" "Superceded by" "$dstfile" - "$adr_bin_dir/_adr_remove_status" "Accepted" "$target" - "$adr_bin_dir/_adr_add_link" "$dstfile" "Supercedes" "$target" + "$adr_bin_dir/_adr_add_link$type_suffix" "$target" "Superceded by" "$dstfile" + "$adr_bin_dir/_adr_remove_status$type_suffix" "Accepted" "$target" + "$adr_bin_dir/_adr_add_link$type_suffix" "$dstfile" "Supercedes" "$target" done for l in "${links[@]}" do - target="$(echo $l | cut -d : -f 1)" - forward_link="$(echo $l | cut -d : -f 2)" - reverse_link="$(echo $l | cut -d : -f 3)" - - "$adr_bin_dir/_adr_add_link" "$dstfile" "$forward_link" "$target" - "$adr_bin_dir/_adr_add_link" "$target" "$reverse_link" "$dstfile" + target="$(echo $l | cut -d : -f 1)" + forward_link="$(echo $l | cut -d : -f 2)" + reverse_link="$(echo $l | cut -d : -f 3)" + + "$adr_bin_dir/_adr_add_link$type_suffix" "$dstfile" "$forward_link" "$target" + "$adr_bin_dir/_adr_add_link$type_suffix" "$target" "$reverse_link" "$dstfile" done ${VISUAL:-${EDITOR:-true}} $dstfile diff --git a/src/init-madr.md b/src/init-madr.md new file mode 100644 index 0000000..ba5d1e9 --- /dev/null +++ b/src/init-madr.md @@ -0,0 +1,25 @@ +# Use Markdown Architectural Decision Records + +## Context and Problem Statement + +We want to record architectural decisions made in this project. +Which format and structure should these records follow? + +## Considered Options + +* [MADR](https://adr.github.io/madr/) 2.1.0 - The Markdown Architectural Decision Records +* [Michael Nygard's template](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions) - The first incarnation of the term "ADR" +* [Sustainable Architectural Decisions](https://www.infoq.com/articles/sustainable-architectural-design-decisions) - The Y-Statements +* Other templates listed at +* Formless - No conventions for file format and structure + +## Decision Outcome + +Chosen option: "MADR 2.1.0", because +* Implicit assumptions should be made explicit. + Design documentation is important to enable people understanding the decisions later on. + See also [A rational design process: How and why to fake it](https://doi.org/10.1109/TSE.1986.6312940). +* The MADR format is lean and fits our development style. +* The MADR structure is comprehensible and facilitates usage & maintenance. +* The MADR project is vivid. +* Version 2.1.0 is the latest one available when starting to document ADRs. diff --git a/src/template-madr.md b/src/template-madr.md new file mode 100644 index 0000000..678f713 --- /dev/null +++ b/src/template-madr.md @@ -0,0 +1,72 @@ +# [short title of solved problem and solution] + +* Status: [accepted | superseeded by [ADR-0005](0005-example.md) | deprecated | …] +* Deciders: [list everyone involved in the decision] +* Date: [YYYY-MM-DD when the decision was last updated] + +Technical Story: [description | ticket/issue URL] + +## Context and Problem Statement + +[Describe the context and problem statement, e.g., in free form using two to three sentences. You may want to articulate the problem in form of a question.] + +## Decision Drivers + +* [driver 1, e.g., a force, facing concern, …] +* [driver 2, e.g., a force, facing concern, …] +* … + +## Considered Options + +* [option 1] +* [option 2] +* [option 3] +* … + +## Decision Outcome + +Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)]. + +### Positive Consequences + +* [e.g., improvement of quality attribute satisfaction, follow-up decisions required, …] +* … + +### Negative consequences + +* [e.g., compromising quality attribute, follow-up decisions required, …] +* … + +## Pros and Cons of the Options + +### [option 1] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +### [option 2] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +### [option 3] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +## Links + +* [Link type] [Link to ADR] +* … diff --git a/tests/create-first-record-madr.expected b/tests/create-first-record-madr.expected new file mode 100644 index 0000000..f4d6f1b --- /dev/null +++ b/tests/create-first-record-madr.expected @@ -0,0 +1,77 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new The First Decision +docs/0002-the-first-decision.md +cat docs/0002-the-first-decision.md +# The First Decision + +* Status: Accepted +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 + +Technical Story: [description | ticket/issue URL] + +## Context and Problem Statement + +[Describe the context and problem statement, e.g., in free form using two to three sentences. You may want to articulate the problem in form of a question.] + +## Decision Drivers + +* [driver 1, e.g., a force, facing concern, …] +* [driver 2, e.g., a force, facing concern, …] +* … + +## Considered Options + +* [option 1] +* [option 2] +* [option 3] +* … + +## Decision Outcome + +Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)]. + +### Positive Consequences + +* [e.g., improvement of quality attribute satisfaction, follow-up decisions required, …] +* … + +### Negative consequences + +* [e.g., compromising quality attribute, follow-up decisions required, …] +* … + +## Pros and Cons of the Options + +### [option 1] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +### [option 2] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +### [option 3] + +[example | description | pointer to more information | …] + +* Good, because [argument a] +* Good, because [argument b] +* Bad, because [argument c] +* … + +## Links + +* [Link type] [Link to ADR] +* … diff --git a/tests/create-first-record-madr.sh b/tests/create-first-record-madr.sh new file mode 100644 index 0000000..b3271c5 --- /dev/null +++ b/tests/create-first-record-madr.sh @@ -0,0 +1,3 @@ +adr init docs madr +adr new The First Decision +cat docs/0002-the-first-decision.md diff --git a/tests/create-multiple-records-madr.expected b/tests/create-multiple-records-madr.expected new file mode 100644 index 0000000..e37f041 --- /dev/null +++ b/tests/create-multiple-records-madr.expected @@ -0,0 +1,31 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Decision +docs/0002-first-decision.md +adr new Second Decision +docs/0003-second-decision.md +adr new Third Decision +docs/0004-third-decision.md +ls docs +0001-record-architecture-decisions.md +0002-first-decision.md +0003-second-decision.md +0004-third-decision.md +head -8 docs/0003-second-decision.md +# Second Decision + +* Status: Accepted +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 + +Technical Story: [description | ticket/issue URL] + +head -8 docs/0004-third-decision.md +# Third Decision + +* Status: Accepted +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 + +Technical Story: [description | ticket/issue URL] + diff --git a/tests/create-multiple-records-madr.sh b/tests/create-multiple-records-madr.sh new file mode 100644 index 0000000..58b6a88 --- /dev/null +++ b/tests/create-multiple-records-madr.sh @@ -0,0 +1,7 @@ +adr init docs madr +adr new First Decision +adr new Second Decision +adr new Third Decision +ls docs +head -8 docs/0003-second-decision.md +head -8 docs/0004-third-decision.md diff --git a/tests/generate-contents-madr.expected b/tests/generate-contents-madr.expected new file mode 100644 index 0000000..179048f --- /dev/null +++ b/tests/generate-contents-madr.expected @@ -0,0 +1,12 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Decision +docs/0002-first-decision.md +adr new Second Decision +docs/0003-second-decision.md +adr generate toc +# Architecture Decision Records + +* [Use Markdown Architectural Decision Records](0001-record-architecture-decisions.md) +* [First Decision](0002-first-decision.md) +* [Second Decision](0003-second-decision.md) diff --git a/tests/generate-contents-madr.sh b/tests/generate-contents-madr.sh new file mode 100644 index 0000000..c07d38f --- /dev/null +++ b/tests/generate-contents-madr.sh @@ -0,0 +1,4 @@ +adr init docs madr +adr new First Decision +adr new Second Decision +adr generate toc diff --git a/tests/generate-graph-madr.expected b/tests/generate-graph-madr.expected new file mode 100644 index 0000000..ae07198 --- /dev/null +++ b/tests/generate-graph-madr.expected @@ -0,0 +1,46 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new An idea that seems good at the time +docs/0002-an-idea-that-seems-good-at-the-time.md +adr new -s 2 A better idea +docs/0003-a-better-idea.md +adr new This will work +docs/0004-this-will-work.md +adr new -s 3 The end +docs/0005-the-end.md +# with default root and extension in links +adr generate graph +digraph { + node [shape=plaintext]; + subgraph { + _1 [label="Use Markdown Architectural Decision Records"; URL="0001-record-architecture-decisions.html"]; + _2 [label="An idea that seems good at the time"; URL="0002-an-idea-that-seems-good-at-the-time.html"]; + _1 -> _2 [style="dotted", weight=1]; + _3 [label="A better idea"; URL="0003-a-better-idea.html"]; + _2 -> _3 [style="dotted", weight=1]; + _4 [label="This will work"; URL="0004-this-will-work.html"]; + _3 -> _4 [style="dotted", weight=1]; + _5 [label="The end"; URL="0005-the-end.html"]; + _4 -> _5 [style="dotted", weight=1]; + } + _3 -> _2 [label="Supercedes", weight=0] + _5 -> _3 [label="Supercedes", weight=0] +} +# with specified root and extension in links +adr generate graph -p http://example.com/ -e .xxx +digraph { + node [shape=plaintext]; + subgraph { + _1 [label="Use Markdown Architectural Decision Records"; URL="http://example.com/0001-record-architecture-decisions.xxx"]; + _2 [label="An idea that seems good at the time"; URL="http://example.com/0002-an-idea-that-seems-good-at-the-time.xxx"]; + _1 -> _2 [style="dotted", weight=1]; + _3 [label="A better idea"; URL="http://example.com/0003-a-better-idea.xxx"]; + _2 -> _3 [style="dotted", weight=1]; + _4 [label="This will work"; URL="http://example.com/0004-this-will-work.xxx"]; + _3 -> _4 [style="dotted", weight=1]; + _5 [label="The end"; URL="http://example.com/0005-the-end.xxx"]; + _4 -> _5 [style="dotted", weight=1]; + } + _3 -> _2 [label="Supercedes", weight=0] + _5 -> _3 [label="Supercedes", weight=0] +} diff --git a/tests/generate-graph-madr.sh b/tests/generate-graph-madr.sh new file mode 100644 index 0000000..e9ae12d --- /dev/null +++ b/tests/generate-graph-madr.sh @@ -0,0 +1,9 @@ +adr init docs madr +adr new An idea that seems good at the time +adr new -s 2 A better idea +adr new This will work +adr new -s 3 The end +# with default root and extension in links +adr generate graph +# with specified root and extension in links +adr generate graph -p http://example.com/ -e .xxx diff --git a/tests/init-repository-madr.expected b/tests/init-repository-madr.expected new file mode 100644 index 0000000..130c06a --- /dev/null +++ b/tests/init-repository-madr.expected @@ -0,0 +1,30 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +ls docs +0001-record-architecture-decisions.md +cat docs/0001-record-architecture-decisions.md +# Use Markdown Architectural Decision Records + +## Context and Problem Statement + +We want to record architectural decisions made in this project. +Which format and structure should these records follow? + +## Considered Options + +* [MADR](https://adr.github.io/madr/) 2.1.0 - The Markdown Architectural Decision Records +* [Michael Nygard's template](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions) - The first incarnation of the term "ADR" +* [Sustainable Architectural Decisions](https://www.infoq.com/articles/sustainable-architectural-design-decisions) - The Y-Statements +* Other templates listed at +* Formless - No conventions for file format and structure + +## Decision Outcome + +Chosen option: "MADR 2.1.0", because +* Implicit assumptions should be made explicit. + Design documentation is important to enable people understanding the decisions later on. + See also [A rational design process: How and why to fake it](https://doi.org/10.1109/TSE.1986.6312940). +* The MADR format is lean and fits our development style. +* The MADR structure is comprehensible and facilitates usage & maintenance. +* The MADR project is vivid. +* Version 2.1.0 is the latest one available when starting to document ADRs. diff --git a/tests/init-repository-madr.sh b/tests/init-repository-madr.sh new file mode 100644 index 0000000..1b2d044 --- /dev/null +++ b/tests/init-repository-madr.sh @@ -0,0 +1,3 @@ +adr init docs madr +ls docs +cat docs/0001-record-architecture-decisions.md diff --git a/tests/linking-madr.expected b/tests/linking-madr.expected new file mode 100644 index 0000000..a67c3d1 --- /dev/null +++ b/tests/linking-madr.expected @@ -0,0 +1,29 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Record +docs/0002-first-record.md +adr new Second Record +docs/0003-second-record.md +adr new Third Record +docs/0004-third-record.md +adr link 4 Amends 2 "Amended by" +adr link 4 Clarifies 3 "Clarified by" +tail -5 docs/0002-first-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Amended by [Third Record](0004-third-record.md) +tail -5 docs/0003-second-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Clarified by [Third Record](0004-third-record.md) +tail -6 docs/0004-third-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Amends [First Record](0002-first-record.md) +* Clarifies [Second Record](0003-second-record.md) diff --git a/tests/linking-madr.sh b/tests/linking-madr.sh new file mode 100644 index 0000000..dcfb101 --- /dev/null +++ b/tests/linking-madr.sh @@ -0,0 +1,9 @@ +adr init docs madr +adr new First Record +adr new Second Record +adr new Third Record +adr link 4 Amends 2 "Amended by" +adr link 4 Clarifies 3 "Clarified by" +tail -5 docs/0002-first-record.md +tail -5 docs/0003-second-record.md +tail -6 docs/0004-third-record.md diff --git a/tests/linking-new-records-madr.expected b/tests/linking-new-records-madr.expected new file mode 100644 index 0000000..afc8da8 --- /dev/null +++ b/tests/linking-new-records-madr.expected @@ -0,0 +1,27 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Record +docs/0002-first-record.md +adr new Second Record +docs/0003-second-record.md +adr new -l "2:Amends:Amended by" -l "3:Clarifies:Clarified by" Third Record +docs/0004-third-record.md +tail -5 docs/0002-first-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Amended by [Third Record](0004-third-record.md) +tail -5 docs/0003-second-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Clarified by [Third Record](0004-third-record.md) +tail -6 docs/0004-third-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Amends [First Record](0002-first-record.md) +* Clarifies [Second Record](0003-second-record.md) diff --git a/tests/linking-new-records-madr.sh b/tests/linking-new-records-madr.sh new file mode 100644 index 0000000..3ae9319 --- /dev/null +++ b/tests/linking-new-records-madr.sh @@ -0,0 +1,7 @@ +adr init docs madr +adr new First Record +adr new Second Record +adr new -l "2:Amends:Amended by" -l "3:Clarifies:Clarified by" Third Record +tail -5 docs/0002-first-record.md +tail -5 docs/0003-second-record.md +tail -6 docs/0004-third-record.md diff --git a/tests/list-records-madr.expected b/tests/list-records-madr.expected new file mode 100644 index 0000000..9818fe3 --- /dev/null +++ b/tests/list-records-madr.expected @@ -0,0 +1,17 @@ +adr list +The doc/adr directory does not exist +adr init docs madr +docs/0001-record-architecture-decisions.md +adr list +docs/0001-record-architecture-decisions.md +adr new first +docs/0002-first.md +adr list +docs/0001-record-architecture-decisions.md +docs/0002-first.md +adr new second +docs/0003-second.md +adr list +docs/0001-record-architecture-decisions.md +docs/0002-first.md +docs/0003-second.md diff --git a/tests/list-records-madr.sh b/tests/list-records-madr.sh new file mode 100644 index 0000000..de0ac6b --- /dev/null +++ b/tests/list-records-madr.sh @@ -0,0 +1,7 @@ +adr list +adr init docs madr +adr list +adr new first +adr list +adr new second +adr list diff --git a/tests/supercede-existing-adr-madr.expected b/tests/supercede-existing-adr-madr.expected new file mode 100644 index 0000000..c482e43 --- /dev/null +++ b/tests/supercede-existing-adr-madr.expected @@ -0,0 +1,23 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Record +docs/0002-first-record.md +adr new -s 2 Second Record +docs/0003-second-record.md +head -10 docs/0002-first-record.md +# First Record + +* Status: Superceded by [Second Record](0003-second-record.md) +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 + +Technical Story: [description | ticket/issue URL] + +## Context and Problem Statement + +tail -5 docs/0003-second-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Supercedes [First Record](0002-first-record.md) diff --git a/tests/supercede-existing-adr-madr.sh b/tests/supercede-existing-adr-madr.sh new file mode 100644 index 0000000..a466491 --- /dev/null +++ b/tests/supercede-existing-adr-madr.sh @@ -0,0 +1,5 @@ +adr init docs madr +adr new First Record +adr new -s 2 Second Record +head -10 docs/0002-first-record.md +tail -5 docs/0003-second-record.md diff --git a/tests/supercede-multiple-adrs-madr.expected b/tests/supercede-multiple-adrs-madr.expected new file mode 100644 index 0000000..efd8908 --- /dev/null +++ b/tests/supercede-multiple-adrs-madr.expected @@ -0,0 +1,27 @@ +adr init docs madr +docs/0001-record-architecture-decisions.md +adr new First Record +docs/0002-first-record.md +adr new Second Record +docs/0003-second-record.md +adr new -s 2 -s 3 Third Record +docs/0004-third-record.md +head -5 docs/0002-first-record.md +# First Record + +* Status: Superceded by [Third Record](0004-third-record.md) +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 +head -5 docs/0003-second-record.md +# Second Record + +* Status: Superceded by [Third Record](0004-third-record.md) +* Deciders: [list everyone involved in the decision] +* Date: 1992-01-12 +tail -6 docs/0004-third-record.md +## Links + +* [Link type] [Link to ADR] +* … +* Supercedes [First Record](0002-first-record.md) +* Supercedes [Second Record](0003-second-record.md) diff --git a/tests/supercede-multiple-adrs-madr.sh b/tests/supercede-multiple-adrs-madr.sh new file mode 100644 index 0000000..c5bd7f7 --- /dev/null +++ b/tests/supercede-multiple-adrs-madr.sh @@ -0,0 +1,7 @@ +adr init docs madr +adr new First Record +adr new Second Record +adr new -s 2 -s 3 Third Record +head -5 docs/0002-first-record.md +head -5 docs/0003-second-record.md +tail -6 docs/0004-third-record.md