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

WIP - Improvements to bash code w/ test suite #2810

Draft
wants to merge 23 commits into
base: github
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.bpan/
/.test-tap-bash/
26 changes: 26 additions & 0 deletions bin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SHELL := bash

BPAN := .bpan
BPAN_REPO := https://github.com/bpan-org/bpan
TEST_TAP_BASH := .test-tap-bash
TEST_TAP_BASH_REPO := https://github.com/bpan-org/test-tap-bash

TEST_DEPS := \
$(BPAN) \
$(TEST_TAP_BASH) \

export v
t ?= test/

.PHONY: test
test: $(TEST_DEPS)
prove $${v:+-v }$t

clean:
$(RM) -r $(BPAN) $(TEST_TAP_BASH) ../target/

$(BPAN):
git clone $(BPAN_REPO) $@

$(TEST_TAP_BASH):
git clone $(TEST_TAP_BASH_REPO) $@
35 changes: 35 additions & 0 deletions bin/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Leiningen Bash Testing
======================

The Bash files in this directory have a test suite.

To run the test suite:

```bash
make test
```

To run the test suite in verbose mode:

```bash
make test v=1
```

To run a single test file:

```bash
make test t=test/00-shellcheck.t
```

To remove the generated test support files:

```bash
make clean
```


## Dependencies

The `test/00-shellcheck.t` test requires the `shellcheck` (v0.9.0+) command.
You can get it here:
https://github.com/koalaman/shellcheck/releases/tag/v0.9.0
29 changes: 21 additions & 8 deletions bin/bump
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#!/bin/bash
#!/usr/bin/env bash

CURRENT_VERSION=$1
SNAPSHOT_VERSION=$2
set -e -u -o pipefail

if [ "$CURRENT_VERSION" = "" ] || [ "$SNAPSHOT_VERSION" = "" ] ; then
echo "Usage: bin/bump 2.9.7 2.9.8-SNAPSHOT"
exit 1
CURRENT_VERSION=${1-}
SNAPSHOT_VERSION=${2-}

if [[ -z $CURRENT_VERSION ]] ||
[[ -z $SNAPSHOT_VERSION ]]
then
echo "Usage: bin/bump 2.9.7 2.9.8-SNAPSHOT"
exit 1
fi

for f in bin/lein bin/lein-pkg bin/lein.bat bin/lein.ps1 project.clj leiningen-core/project.clj; do
sed -i s/$CURRENT_VERSION/$SNAPSHOT_VERSION/ $f
files=(
bin/lein
bin/lein.bat
bin/lein-pkg
bin/lein.ps1
leiningen-core/project.clj
project.clj
)

for file in "${files[@]}"; do
sed -i "s/$CURRENT_VERSION/$SNAPSHOT_VERSION/" "$file"
done
Loading