Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

cd "$(git rev-parse --show-toplevel)" || (echo "Couldn't find project folder. Please check your working dir."; exit 1)
cd "$(git rev-parse --show-toplevel)" || (
echo "Couldn't find project folder. Please check your working dir."
exit 1
)

pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
7 changes: 5 additions & 2 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash

cd "$(git rev-parse --show-toplevel)" || (echo "Couldn't find project folder. Please check your working dir."; exit 1)
cd "$(git rev-parse --show-toplevel)" || (
echo "Couldn't find project folder. Please check your working dir."
exit 1
)

flake8 ./ensysmod
flake8 ./tests

echo "Flake8 complete. Check for code smells above."
echo "Flake8 complete. Check for code smells above."
38 changes: 19 additions & 19 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ declare -a BUMP_OPTIONS=("major" "minor" "patch")
increment_version() {
local delimiter="."
local array=($(echo "$1" | tr $delimiter '\n'))
array[$2]=$((array[$2]+1))
array[$2]=$((array[$2] + 1))
if [ "$2" -lt 2 ]; then array[2]=0; fi
if [ "$2" -lt 1 ]; then array[1]=0; fi
echo "$(local IFS=$delimiter; echo "${array[*]}")"
echo "$(
local IFS=$delimiter
echo "${array[*]}"
)"
}

### Require main branch
require_main_branch() {
branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$branch" != "main" ]]
then
if [[ "$branch" != "main" ]]; then
echo "ERR: Please switch to main branch in order to run this script."
exit 10
else
Expand All @@ -27,8 +29,7 @@ require_main_branch() {
}
### Require no uncommitted changes
require_no_uncommitted_changes() {
if ! git diff-index --quiet HEAD --
then
if ! git diff-index --quiet HEAD --; then
echo "ERR: Found uncommitted changes. Commit them in order to run this script."
exit 11
else
Expand All @@ -38,7 +39,7 @@ require_no_uncommitted_changes() {

### Retrieve current version for project
get_current_version() {
version=$(grep -Po '(?<=__version__ = ")[^"]+' ./ensysmod/__init__.py)
version=$(sed -n '/^__version__/,//p' ./ensysmod/__init__.py | sed -e 's/__version__ = "\(.*\)"/\1/')
echo "$version"
}

Expand All @@ -53,25 +54,24 @@ update_version() {
## $1: bump option as string
get_bump_option() {
index=-1
for i in "${!BUMP_OPTIONS[@]}";
do
if [[ "${BUMP_OPTIONS[$i]}" = "$1" ]];
then
index=$i
break
fi
for i in "${!BUMP_OPTIONS[@]}"; do
if [[ "${BUMP_OPTIONS[$i]}" == "$1" ]]; then
index=$i
break
fi
done

echo "$index"
}


### Main Script
cd "$(git rev-parse --show-toplevel)" || (echo "Couldn't find project folder. Please check your working dir."; exit 1)
cd "$(git rev-parse --show-toplevel)" || (
echo "Couldn't find project folder. Please check your working dir."
exit 1
)

BUMP=$(get_bump_option "$1")
if [[ "$BUMP" == -1 ]];
then
if [[ "$BUMP" == -1 ]]; then
echo "ERR: Please specify a correct bump option. Use$(printf " %s" "${BUMP_OPTIONS[@]}") as first parameter."
exit 12
fi
Expand All @@ -98,4 +98,4 @@ git commit -m "Bump release version $CURRENT_VERSION -> $NEW_VERSION"
git push --set-upstream origin "release/$NEW_VERSION"

# Switch back to main branch
git checkout main
git checkout main
7 changes: 5 additions & 2 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

cd "$(git rev-parse --show-toplevel)" || (echo "Couldn't find project folder. Please check your working dir."; exit 1)
cd "$(git rev-parse --show-toplevel)" || (
echo "Couldn't find project folder. Please check your working dir."
exit 1
)

python -m ensysmod
python -m ensysmod
7 changes: 5 additions & 2 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

cd "$(git rev-parse --show-toplevel)" || (echo "Couldn't find project folder. Please check your working dir."; exit 1)
cd "$(git rev-parse --show-toplevel)" || (
echo "Couldn't find project folder. Please check your working dir."
exit 1
)

pytest ./tests
pytest ./tests