Skip to content

Commit

Permalink
#929: test functions doc #751: improved function documentation (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Oct 7, 2022
1 parent a928e96 commit 7874acf
Show file tree
Hide file tree
Showing 35 changed files with 176 additions and 96 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file documents all notable changes to https://github.com/devonfw/ide[devonf
New release with various improvements and bugfixes:

* https://github.com/devonfw/ide/issues/826[#826]: List available versions for a tool
* https://github.com/devonfw/ide/issues/929[#929]: Ensure function documentation is in sync

The full list of changes for this release can be found in https://github.com/devonfw/ide/milestone/34?closed=1[milestone 2022.08.004].

Expand Down
1 change: 1 addition & 0 deletions documentation/DoD.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ However, chances to get your change merged quickly are higher if you address all
** [ ] The new commandlet installs potential dependencies automatically (e.g. `doDevonCommand «required-other-tool» setup silent`).
** [ ] The variable `«TOOL»_VERSION` is honored by your commandlet so if present that version will be downloaded and installed.
** [ ] The new commandlet is tested on all plattforms it is availible for. Assuming you are using Windows, testing for Linux can be done with the Windows Subsystem for Linux and for MacOS we have a virtual cloud instance.
* [ ] In case your PR adds, changes, or removes a function (in `functions` or `environment-project`) you need to update `functions.asciidoc` accordingly. There is an automated test that will fail otherwise.
192 changes: 127 additions & 65 deletions documentation/functions.asciidoc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function doLicenseAgreement() {
if doIsBatch
then
doFail "You need to accept these terms of use and all license agreements. Please rerun in interactive (non-batch) mode."
fi
fi
if doAskToContinue "Do you accept these terms of use and all license agreements?" "return"
then
echo -e "On $(date +"%Y-%m-%d") at $(date +"%H:%M:%S") you accepted the devonfw-ide License.\nhttps://github.com/devonfw/ide/blob/master/documentation/LICENSE.asciidoc" > "${DEVON_HOME_DIR}/.devon/.license.agreement"
Expand Down Expand Up @@ -376,7 +376,7 @@ function doDevonCommandAndReturn() {
doError "Command '${command_name} ${*}' failed with exit code ${result}"
return ${result}
fi
fi
fi
}

# $1: the URL to download
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-aws
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest aws
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-az
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest az
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-cobigen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest cobigen
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest docker
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-dotnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest dotnet
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-eclipse
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest eclipse
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-gcviewer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest gcviewer
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-gh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest gh
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-graalvm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest graalvm
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest gradle
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-helm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest helm
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-intellij
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest intellij
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-ionic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest ionic
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-jasypt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest jasypt
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest java
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-jenkins
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest jenkins
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-kubectl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest kuberctl
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-lazydocker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest lazydocker
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-mvn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest mvn
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-ng
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest ng
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-node
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest node
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-npm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest npm
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-oc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest oc
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-pip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest pip
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-python
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest python
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-sonar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest sonar
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-terraform
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest terraform
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-vscode
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest vscode
2 changes: 1 addition & 1 deletion scripts/src/test/bash/integration-test-yarn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

source "$(dirname "${0}")"/test-functions
source "$(dirname "${0}")"/functions-test
doCommandTest yarn
16 changes: 16 additions & 0 deletions scripts/src/test/bash/test-functions-doc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

SCRIPTS_PATH="../../../../scripts/src/main/resources/scripts"
( set -o pipefail; grep "function " "${SCRIPTS_PATH}/functions" "${SCRIPTS_PATH}/environment-project" | sed 's/.*function //' | sed 's/() {//' | sort -u > functions.list ) || exit 1
( set -o pipefail; grep "=== " "../../../../documentation/functions.asciidoc" | sed 's/=== //' | sort -u > functions.adoc.list ) || exit 1

diff functions.list functions.adoc.list
if [ "$?" = 0 ]
then
echo "Documentation of functions and function declarations are in sync."
echo "Awesome!"
else
echo "Documentation of functions does not match function declarations!"
echo "Please keep function documentation and declarations in sync!"
exit 1
fi

0 comments on commit 7874acf

Please sign in to comment.