Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Dec 11, 2023
1 parent 4731f56 commit d0d8d38
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 122 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
!/**/_sidebar.md
!/**/_navbar.md

bin/runBuildContainer
/bin/test
/bin/buildPushDockerImages
/bin/buildPushDockerImage

# node modules
node_modules/
package*.json
yarn.lock

commit-msg.md
39 changes: 6 additions & 33 deletions Commands.tmpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
- [1.2. bin/waitForIt](#12-binwaitforit)
- [1.3. bin/waitForMysql](#13-binwaitformysql)
- [1.4. bin/doc](#14-bindoc)
- [1.5. bin/findShebangFiles](#15-binfindshebangfiles)
- [1.6. bin/test](#16-bintest)
- [2. Converter and Generator tools](#2-converter-and-generator-tools)
- [2.1. bin/generateShellDoc](#21-bingenerateshelldoc)
- [2.2. bin/mysql2puml](#22-binmysql2puml)
- [2.2.1. Help](#221-help)
- [2.2.2. Example](#222-example)
- [2.1. bin/mysql2puml](#21-binmysql2puml)
- [2.1.1. Help](#211-help)
- [2.1.2. Example](#212-example)
- [3. Git tools](#3-git-tools)
- [3.1. bin/gitIsAncestorOf](#31-bingitisancestorof)
- [3.2. bin/gitIsBranch](#32-bingitisbranch)
Expand Down Expand Up @@ -61,41 +58,17 @@
@@@doc_help@@@
```

### 1.5. bin/findShebangFiles

imported from bash-tools-framework

```text
@@@findShebangFiles_help@@@
```

### 1.6. bin/test

imported from bash-tools-framework

```text
@@@test_help@@@
```

## 2. Converter and Generator tools

### 2.1. bin/generateShellDoc

imported from bash-tools-framework

```text
@@@generateShellDoc_help@@@
```

### 2.2. bin/mysql2puml
### 2.1. bin/mysql2puml

#### 2.2.1. Help
#### 2.1.1. Help

```text
@@@mysql2puml_help@@@
```

#### 2.2.2. Example
#### 2.1.2. Example

Mysql dump of some tables

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ touch ~/.parallel/will-cite

Dependencies are automatically installed when used.

`bin/test` script will install the following libraries inside `vendor` folder:
`vendor/bash-tools-framework/bin/test` script will install the following libraries inside `vendor` folder:

- [bats-core/bats-core](https://github.com/bats-core/bats-core.git)
- [bats-core/bats-support](https://github.com/bats-core/bats-support.git)
- [bats-core/bats-assert](https://github.com/bats-core/bats-assert.git)
- [Flamefire/bats-mock](https://github.com/Flamefire/bats-mock.git)

`./bin/doc` script will install:
`bin/doc` script will install:

- [fchastanet/tomdoc.sh](https://github.com/fchastanet/tomdoc.sh.git)

Expand Down Expand Up @@ -181,25 +181,25 @@ All the commands are unit tested, you can run the unit tests using the following
command

```bash
./bin/test -r tests
vendor/bash-tools-framework/bin/test -r tests
```

Launch UT on different environments:

```bash
VENDOR="alpine" BASH_TAR_VERSION=4.4 BASH_IMAGE=bash \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 16
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 16
VENDOR="alpine" BASH_TAR_VERSION=5.0 BASH_IMAGE=bash \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 16
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 16
VENDOR="alpine" BASH_TAR_VERSION=5.1 BASH_IMAGE=bash \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 16
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 16

VENDOR="ubuntu" BASH_TAR_VERSION=4.4 BASH_IMAGE=ubuntu:20.04 \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 2
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 2
VENDOR="ubuntu" BASH_TAR_VERSION=5.0 BASH_IMAGE=ubuntu:20.04 \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 2
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 2
VENDOR="ubuntu" BASH_TAR_VERSION=5.1 BASH_IMAGE=ubuntu:20.04 \
SKIP_BUILD=1 SKIP_USER=1 ./bin/test -r src -j 2
SKIP_BUILD=1 SKIP_USER=1 vendor/bash-tools-framework/bin/test -r src -j 2
```

### 3.4. auto generated bash doc
Expand Down
31 changes: 0 additions & 31 deletions TODO.md

This file was deleted.

4 changes: 2 additions & 2 deletions bin/dbQueryAllDatabases

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/dbScriptAllDatabases

Large diffs are not rendered by default.

28 changes: 1 addition & 27 deletions bin/installRequirements
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ cleanOnExit() {
}
trap cleanOnExit EXIT HUP QUIT ABRT TERM

# @description concat each element of an array with a separator
#
# @arg $1 glue:String
# @arg $@ array:String[]
# @example
# declare -a array=(test1, test2)
# echo "Result= $(Array::join "," "${array[@]})"
# Result= test1,test2
Array::join() {
local glue="${1-}"
shift || true
local first="${1-}"
shift || true
printf %s "${first}" "${@/#/${glue}}"
}

# @description concat each element of an array with a separator
# but wrapping text when line length is more than provided argument
# The algorithm will try not to cut the array element if it can.
Expand Down Expand Up @@ -1387,9 +1371,7 @@ installRequirementsCommand() {
echo ' Possible values: OFF|ERROR|WARNING|INFO|DEBUG|TRACE'
echo -e """
${__HELP_TITLE}INSTALLS REQUIREMENTS:${__HELP_NORMAL}
- fchastanet/bash-tools-framework
- and fchastanet/bash-tools-framework useful binaries:
$(Array::join ", " "${externalBinaries[@]}")"""
- fchastanet/bash-tools-framework"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
echo '1.0'
Expand All @@ -1409,7 +1391,6 @@ ${__HELP_TITLE}INSTALLS REQUIREMENTS:${__HELP_NORMAL}
return 1
fi
}
declare -a externalBinaries=([0]="bin/test")

installRequirementsCommand parse "${BASH_FRAMEWORK_ARGV[@]}"

Expand All @@ -1419,13 +1400,6 @@ run() {
Git::cloneOrPullIfNoChanges \
"${BASH_TOOLS_ROOT_DIR}/vendor/bash-tools-framework" \
"https://github.com/fchastanet/bash-tools-framework.git"

Log::displayInfo "Copying useful binaries from bash-tools-framework"
local externalBinary
for externalBinary in "${externalBinaries[@]}"; do
cp -v "${BASH_TOOLS_ROOT_DIR}/vendor/bash-tools-framework/${externalBinary}" \
"${BASH_TOOLS_ROOT_DIR}/bin"
done
}

if [[ "${BASH_FRAMEWORK_QUIET_MODE:-0}" = "1" ]]; then
Expand Down
17 changes: 17 additions & 0 deletions commit-msg-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Title

Short 3 lines summary

# Breaking changes

# Bug fixes

# Binaries changes

# Updated Bash tools functions

# New Bash tools functions

# Documentation

# Validation/Tooling
6 changes: 0 additions & 6 deletions src/_binaries/build/installRequirements.options.tpl
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
%
declare -a externalBinaries=(
bin/test
)
declare versionNumber="1.0"
declare commandFunctionName="installRequirementsCommand"
declare help="installs requirements"
# shellcheck disable=SC2016
declare longDescription='''
${__HELP_TITLE}INSTALLS REQUIREMENTS:${__HELP_NORMAL}
- fchastanet/bash-tools-framework
- and fchastanet/bash-tools-framework useful binaries:
$(Array::join ", " "${externalBinaries[@]}")
'''
%

.INCLUDE "$(dynamicTemplateDir _binaries/options/options.base.tpl)"

%
Options::generateCommand "${options[@]}"
declare -p externalBinaries
%

<% ${commandFunctionName} %> parse "${BASH_FRAMEWORK_ARGV[@]}"
7 changes: 0 additions & 7 deletions src/_binaries/build/installRequirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ run() {
Git::cloneOrPullIfNoChanges \
"${BASH_TOOLS_ROOT_DIR}/vendor/bash-tools-framework" \
"https://github.com/fchastanet/bash-tools-framework.git"

Log::displayInfo "Copying useful binaries from bash-tools-framework"
local externalBinary
for externalBinary in "${externalBinaries[@]}"; do
cp -v "${BASH_TOOLS_ROOT_DIR}/vendor/bash-tools-framework/${externalBinary}" \
"${BASH_TOOLS_ROOT_DIR}/bin"
done
}

if [[ "${BASH_FRAMEWORK_QUIET_MODE:-0}" = "1" ]]; then
Expand Down

0 comments on commit d0d8d38

Please sign in to comment.