A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/norlab-ulaval/norlab-shell-script-tools below:

norlab-ulaval/norlab-shell-script-tools: A library of shell script functions and a shell testing tools leveraging both bats-core and docker. This library purposes is to speed up shell script development and improve code reliability.

NorLab Shell Script Tools (N2ST)

NorLab TeamCity GUI (VPN/intranet access)   •   norlabulaval (Docker Hub)  

A library of shell script functions and a shell testing tools
leveraging both bats-core and docker
. N2ST purposes is
to speed up shell script development and improve code reliability.

Maintainer Luc Coupal


Install instructions and git submodule usage notes

Just clone the norlab-shell-script-tools as a submodule in your project repository (ie the superproject), in an arbitrary directory eg.: my-project/utilities/.

Procedure

cd <my-project>
mkdir utilities

git submodule init

git submodule \
  add https://github.com/norlab-ulaval/norlab-shell-script-tools.git \
  utilities/norlab-shell-script-tools

# Traverse the submodule recursively to fetch any sub-submodule
git submodule update --remote --recursive --init

# Commit the submodule to your repository
git add .gitmodules
git add utilities/norlab-shell-script-tools
git commit -m 'Added norlab-shell-script-tools submodule to repository'

To clone your repository and its submodule at the same time, use

git clone --recurse-submodules

Be advise, submodules are a snapshot at a specific commit of the norlab-shell-script-tools repository. To update the submodule to its latest commit, use

[sudo] git submodule update --remote --recursive --init [--force]

Notes:

To set the submodule to point to a different branch, use

cd <the/submodule/directory>
git checkout the_submodule_feature_branch_name

and use the --recurse-submodules flag when switching branch in your main project

cd <your/project/root>
git checkout --recurse-submodules the_feature_branch_name
Commiting to submodule from the main project (the one where the submodule is cloned) If you encounter error: insufficient permission for adding an object to repository database ...
# Change the `.git/objects` permissions
cd <main/project/root>/.git/objects/
chown -R $(id -un):$(id -gn) *
#       <yourname>:<yourgroup>

# Share the git repository (the submodule) with a Group
cd ../../<the/submodule/root>/
git config core.sharedRepository group
# Note: dont replace the keyword "group"

This should solve the problem permanently.

Try this in norlab-shell-script-tools root

source import_norlab_shell_script_tools_lib.bash
n2st::norlab_splash "NorLab rule 🦾"  https://github.com/norlab-ulaval
N2ST shell script function/script library

To import the library functions, execute the following

cd <path/to/norlab-shell-script-tools>

bash import_norlab_shell_script_tools_lib.bash
# All norlab-shell-script-tools functions are now sourced in your current shell. 

Note: N2ST functions are prefixed with n2st, i.e.: n2st::<function_name>

N2ST testing tools for shell script development
  1. Copy the norlab-shell-script-tools/tests/tests_template/ directory in your main project top directory and rename it, e.g. tests_template/tests_shell/ ( recommand using the convention tests/);

  2. Add project test code in this new test directory.

  3. Use the copied script run_bats_core_test_in_n2st.bash to execute your tests. They will be executed in isolation in a docker container tailormade for testing shell script or command level logic in your codebase.

Assuming that the superproject (i.e. the project which have cloned N2ST as a submodule) as the following structure, tests/ would be containing all the .bats files

myCoolSuperProject
┣━━ src/
┣━━ tests/
┃   ┣━━ run_bats_core_test_in_n2st.bash
┃   ┣━━ test_pew_poo_poo.bats
┃   ┗━━ tests_those/
┃       ┣━━ test_poo_po_pew_pow.bats
┃       ┗━━ test_poooow_pew_poo.bats
┣━━ utilities/
┃   ┗━━ norlab-shell-script-tools/
┃       ┣━━ src/
┃       ┣━━ tests/
┃       ┃    ┣━━ bats_testing_tools/
┃       ┃    ┣━━ tests_template/
┃       ┃    ┗━━ ...
┃       ┗━━ ...
┣━━ .env.my_superproject
┣━━ .git
┣━━ .gitmodules
┗━━ README.md
To execute your superproject shell script tests

To execute your superproject shell scripts bats test via 'norlab-shell-script-tools' library, just run the following from your repository root

cd "<path/to/superproject>/tests"
bash run_bats_core_test_in_n2st.bash ['<test-directory>[/<bats-test-file-name.bats>]' ['<image-distro>']]

Arguments:

See tests/tests_template/run_bats_core_test_in_n2st.bash for details.

Bats shell script testing framework references

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4