Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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