Skip to content

re-organize sources to follow BATS plugins best practice#46

Open
e-picas wants to merge 1 commit intojasonkarns:mainfrom
e-picas:chore-bats-lib-best-practice
Open

re-organize sources to follow BATS plugins best practice#46
e-picas wants to merge 1 commit intojasonkarns:mainfrom
e-picas:chore-bats-lib-best-practice

Conversation

@e-picas
Copy link

@e-picas e-picas commented Jul 7, 2024

To follow official BATS libs best practice and installation process, I propose the followings:

  • put the Bash sources in a src/ directory
  • add a load.bash entrypoint file for BATS classic loading

I've tested it in a docker image with bats and other libraries and it works fine.


The BATS default method to install a library is something like (cf. https://github.com/bats-core/bats-core/blob/master/docker/install_libs.sh):

  wget -q -O "${_tmpdir}/${_tarball}" ${BASE_BATS_URL}/bats-"${_libname}"/archive/refs/tags/v"${_libvers}".tar.gz

  tar -xz -f "${_tmpdir}/${_tarball}" -C "${_tmpdir}/"

  install -Dm755 "${_tmpdir}/${_libdir}/load.bash" "${_target}/bats-${_libname}/load.bash"
  for fn in "${_tmpdir}/${_libdir}"/src/*.bash
  do
      install -Dm755 "$fn" "${_target}/bats-${_libname}/src/$(basename "$fn")"
  done

@e-picas e-picas changed the title chore: re-organize sources to follow BATS plugins best practice re-organize sources to follow BATS plugins best practice Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant